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 -v
and check the version - If its less than
14
go here to download the required version - You can also use nvm to maintain multiple node versions in your system
- Check if
npm
is installed usingnpm -v
(It should be installed along side node.js)
- Run
npm install
to install shared dependencies - Run
npm run bootstrap
to install package dependencies and symlink binaries - Run
npm run build
to build all packages except the client usingtypescript
- Run
npm run lint
to lint all packages usingeslint
- Run
npm run test
to run tests for all packages usingjest
- Run
npm run build:watch
to starting building in watch mode - Add environment variable files environment variables
- Go to server package using
cd packages/server
and start the server usingnpm run start
- After starting the server go to seeder package using
cd packages/seeder
and run the following commandsnpm run create-db <db-name>
to create a database with all the tablesnpm run seeder
to generate and populate database with random data- Check out the
polices.json
file generated inpackages/seeder/dist/polices.json
to view the info about the generated police.
- Go to client package using
cd packages/client
and start the client usingnpm run dev
Before proceeding further please make sure you create the .env
files
- Create a
.env
folder in root directory - Create two files
seeder.env
and.env
there - Inside
seeder.env
store these variablesADMIN_PASSWORD
: Password of admin userADMIN_EMAIL
: Email of admin user
- Inside
.env
store 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
prod
andstaging
branches - Every member must create a branch from
staging
to 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
staging
branch and add other members to review it - Two github workflows will run when a PR is sent to
staging
branch- 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
staging
branch. - After an accumulation of commits to
staging
branch, the owner will create a PR fromstaging
toprod
branch - This will trigger one github workflow
- Automated server deployment to our
digitalocean droplet
- Automated client deployment to our
vercel
project.
- 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