A modern fullstack police application for BUPD
This monorepo contains the following packages:-
@bupd/client: Next.js client package for BUPD@bupd/seeder: Database seeder package for BUPD@bupd/server: Node.js Express server package for BUPD@bupd/types: Typescript type definition package for BUPD@bupd/validation: Payload validation package for BUPD@bupd/constants: Shared constants package
- Make sure you have at least node 14 install
- Run
node -vand check the version - If its less than
14go here to download the required version - You can also use nvm to maintain multiple node versions in your system
- Check if
npmis installed usingnpm -v(It should be installed along side node.js)
- Run
npm installto install shared dependencies - Run
npm run bootstrapto install package dependencies and symlink binaries - Run
npm run buildto build all packages except the client usingtypescript - Run
npm run lintto lint all packages usingeslint - Run
npm run testto run tests for all packages usingjest - Run
npm run build:watchto starting building in watch mode - Add environment variable files environment variables
- Go to server package using
cd packages/serverand start the server usingnpm run start - After starting the server go to seeder package using
cd packages/seederand run the following commandsnpm run create-db <db-name>to create a database with all the tablesnpm run seederto generate and populate database with random data- Check out the
polices.jsonfile generated inpackages/seeder/dist/polices.jsonto view the info about the generated police.
- Go to client package using
cd packages/clientand start the client usingnpm run dev
Before proceeding further please make sure you create the .env files
- Create a
.envfolder in root directory - Create two files
seeder.envand.envthere - Inside
seeder.envstore these variablesADMIN_PASSWORD: Password of admin userADMIN_EMAIL: Email of admin user
- Inside
.envstore these variablesDATABASE_PASSWORD: Mysql database passwordDATABASE_USER: Mysql Database userDATABASE_HOST: Mysql database hostDATABASE_NAME: Mysql database nameSERVER_PORT: Express server portPASSWORD_SALT: Password salt used when hashingJWT_SECRET: Jwt secret
A sample .env directory
We tried to maintain a specific git workflow in this project.
- Only repository owner has push access to
prodandstagingbranches - Every member must create a branch from
stagingto work on their tasks - Once they've completed their task they push to the same remote branch.
- From there they need to create a PR to the
stagingbranch and add other members to review it - Two github workflows will run when a PR is sent to
stagingbranch- First workflow lints, builds and tests the code
- Second workflow creates a preview deployment to vercel
- If the reviewer leaves any comments to be further resolved, the member must resolve those.
- Once everything's been resolved, the reviewer will merge the PR to
stagingbranch. - After an accumulation of commits to
stagingbranch, the owner will create a PR fromstagingtoprodbranch - This will trigger one github workflow
- Automated server deployment to our
digitalocean droplet - Automated client deployment to our
vercelproject.
- Automated server deployment to our
server: Our server is deployed on a digitalocean dropletclient: Our client is deployed on a vercel hobby plan project
NOTE: We are hosting our database on the same droplet as the server
We are using a few shared dependencies across the monorepo to avoid installing same npm packages multiple times
tsc: typescript compilerjest: Javascript test runnereslint: Javascript/Typescript linterdel-cli: Package to delete directoriesnodemon: Package to automatically restart node processlerna: Javascript framework to maintain multi-package repositories (monorepo)
- Safwan Shaheer devorein Backend, Frontend, Devops, Testing, Documentation, ER & Schema Design
- Zayed Humayun abystoma Backend, Testing, Documentation, ER & Schema Design
- Rafid Hamid xImouto Backend, Testing, Documentation, ER & Schema Design
- Rakinul Haque rakinulhaque Backend, ER & Schema Design, Documentation
- Abrar Awsaf ShababKabab Backend, ER & Schema Design, Documentation