Parking system (backend)

Run with docker compose for stage environment (🧪)

# (update the values in .env)
cp .env.example .env
docker compose up -d --build

⚠️ Important: In the compilation of the project you are including the environment variables as part of the bundle, if you want to compile for cloud or production environment, insert the values of secrets for environment variables or in the safest way offered by the infrastructure.

Run app in development mode (🧑‍💻)

Pre-requisites

  • node >= 18
  • yarn >= 1.22
  • MySQL >= 8.0
  • Docker >= 27.2.0
  • Docker compose >= 2.29.2

Steps

  • Copy .env.example to .env (update the values in .env)
cp .env.example .env
  • Install dependencies
yarn install
  • Run the database
docker compose up database -d database
  • Run the server in development mode
yarn dev

Structure of the project (🏗️)

Folders

  • __test__: Contains the tests of the application.
  • .husky: Contains the configuration of the Husky.
  • assets: Contains images, files or any file of the application.
  • db: Contains the database init file of the application.
  • logs: Contains the logs of the application generated by the winston logger.
  • src: Contains the source code of the application.
  • src/contexts: Contains the modules of the application.
  • src/server: Contains the server and configuration of the application.
  • src/server/config/database: Contains the database connection of the application.
  • src/server/config/env: Contains the environment variables of the application from the .env file.
  • src/server/middlewares: Contains the global middlewares of the application.
  • src/server/utils: Contains the global utils of the application.

Files

  • src/index.ts: Contains the entry point of the application.
  • .dockerignore: Contains the list of files and folders that should be ignored by Docker when building the image.
  • .editorconfig: Contains the configuration of the EditorConfig.
  • .env.example: Contains the example of the environment variables.
  • .gitignore: Contains the list of files and folders that should be ignored by git.
  • docker-compose.yml: Contains the configuration of the Docker Compose for MySQL and the server.
  • Dockerfile: Contains the configuration of the Docker to build the image.
  • package.json: Contains the configuration of the Node.js.

Scripts

  • yarn build: Builds the application for production.
  • yarn dev: Runs the application in development mode with cross-env and ts-node-dev.
  • yarn format: Runs the formatter with Prettier.
  • yarn lint: Runs the linter with ESLint.