Giter VIP home page Giter VIP logo

bupd's Introduction

BUPD

A modern fullstack police application for BUPD

Packages

This monorepo contains the following packages:-

Requirements

  1. Make sure you have at least node 14 install
  2. Run node -v and check the version
  3. If its less than 14 go here to download the required version
  4. You can also use nvm to maintain multiple node versions in your system
  5. Check if npm is installed using npm -v (It should be installed along side node.js)

Steps

  1. Run npm install to install shared dependencies
  2. Run npm run bootstrap to install package dependencies and symlink binaries
  3. Run npm run build to build all packages except the client using typescript
  4. Run npm run lint to lint all packages using eslint
  5. Run npm run test to run tests for all packages using jest
  6. Run npm run build:watch to starting building in watch mode
  7. Add environment variable files environment variables
  8. Go to server package using cd packages/server and start the server using npm run start
  9. After starting the server go to seeder package using cd packages/seeder and run the following commands
    1. npm run create-db <db-name> to create a database with all the tables
    2. npm run seeder to generate and populate database with random data
    3. Check out the polices.json file generated in packages/seeder/dist/polices.json to view the info about the generated police.
  10. Go to client package using cd packages/client and start the client using npm run dev

Environment Variables

Before proceeding further please make sure you create the .env files

  1. Create a .env folder in root directory
  2. Create two files seeder.env and .env there
  3. Inside seeder.env store these variables
    1. ADMIN_PASSWORD: Password of admin user
    2. ADMIN_EMAIL: Email of admin user
  4. Inside .env store these variables
    1. DATABASE_PASSWORD: Mysql database password
    2. DATABASE_USER: Mysql Database user
    3. DATABASE_HOST: Mysql database host
    4. DATABASE_NAME: Mysql database name
    5. SERVER_PORT: Express server port
    6. PASSWORD_SALT: Password salt used when hashing
    7. JWT_SECRET: Jwt secret

A sample .env directory

Sample env directory

Workflow

We tried to maintain a specific git workflow in this project.

  1. Only repository owner has push access to prod and staging branches
  2. Every member must create a branch from staging to work on their tasks
  3. Once they've completed their task they push to the same remote branch.
  4. From there they need to create a PR to the staging branch and add other members to review it
  5. Two github workflows will run when a PR is sent to staging branch
    1. First workflow lints, builds and tests the code
    2. Second workflow creates a preview deployment to vercel
  6. If the reviewer leaves any comments to be further resolved, the member must resolve those.
  7. Once everything's been resolved, the reviewer will merge the PR to staging branch.
  8. After an accumulation of commits to staging branch, the owner will create a PR from staging to prod branch
  9. This will trigger one github workflow
    1. Automated server deployment to our digitalocean droplet
    2. Automated client deployment to our vercel project.

Deployments

  • server: Our server is deployed on a digitalocean droplet
  • client: Our client is deployed on a vercel hobby plan project

NOTE: We are hosting our database on the same droplet as the server

Shared dependencies

We are using a few shared dependencies across the monorepo to avoid installing same npm packages multiple times

  1. tsc: typescript compiler
  2. jest: Javascript test runner
  3. eslint: Javascript/Typescript linter
  4. del-cli: Package to delete directories
  5. nodemon: Package to automatically restart node process
  6. lerna: Javascript framework to maintain multi-package repositories (monorepo)

Contributors

  1. Safwan Shaheer devorein Backend, Frontend, Devops, Testing, Documentation, ER & Schema Design
  2. Zayed Humayun abystoma Backend, Testing, Documentation, ER & Schema Design
  3. Rafid Hamid xImouto Backend, Testing, Documentation, ER & Schema Design
  4. Rakinul Haque rakinulhaque Backend, ER & Schema Design, Documentation
  5. Abrar Awsaf ShababKabab Backend, ER & Schema Design, Documentation

bupd's People

Contributors

abystoma avatar arionrefat avatar devorein avatar imoxto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

abystoma

bupd's Issues

Update casefiles

Casefile should also be updatable, but right now there is no form to update a casefile.

put on /police

Updating rank, name, address, designation, phone of police updates the columns for ALL polices instead of the logged in police only.

Before:
image

after put on authenticated police:
image

EDIT: We cant update nid and email through PUT on /police either

Correct status code when response.status is `error`

Currently, all request responses with a status code of 200 even if the request failed.
image
This request failed with an error message of police already exists with this NID but the status code is still 200, we should return the appropriate status code along with the response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.