TickLabVN / ssps-be

Back-end for HCMUT-SSPS
0 stars 1 forks source link

Student Smart Printing Service

formatter: prettier Commitizen friendly CI Deploy

Prerequisites

Commands

Project structure

📦prisma
 ┣ 📂migrations     # All SQL migration scripts go here
 ┣ 📜schema.prisma  # Database schema declaration
 ┗ 📜seed.ts        # Generate sample data script
📦src
 ┣ 📂configs        # Contain environment variables & other app configurations
 ┣ 📂constants      # Constants and enums go here
 ┣ 📂dtos           # Schema for input (from requests) & output (from responses)
 ┃ ┣ 📂in
 ┃ ┗ 📂out
 ┣ 📂handlers       # Handlers, which are responsible for handling core business logic
 ┣ 📂interfaces     # Interfaces
 ┣ 📂middlewares    # Middlewares such as logging or verifying tokens
 ┣ 📂plugins        # Plugin, in charge of organizing api routings & registering middleware
 ┣ 📂repositories   # Datasource configurations & connections. Could have more than one datasource.
 ┣ 📂services       # 3rd-party services or business logic services
 ┣ 📂types          # Types
 ┣ 📂utils          # Helping classes and functions
 ┣ 📜Server.ts      # Server setting & binding modules
 ┗ 📜index.ts       # Program entry

Setup and Run Instructions

Step 1: Set up Environment Variables

Create a .env file and fill it with the required environment variables. Ensure you replace placeholders like with the actual values.
Note: Fill in .env file (use template from .env.example) before starts.
For example:

FASTIFY_PORT=3000
FASTIFY_TEST_PORT=3001

POSTGRES_USER=db_user
POSTGRES_PASSWORD=db_password
POSTGRES_DB=ssps_db
POSTGRES_PORT=5432
POSTGRES_TEST_PORT=5433
POSTGRES_URL=postgresql://db_user:db_password@localhost:5432/ssps_db

# ... (Other environment variables)

Step 2: Run Bootstrap Command

Run the following command to set up the development environment:

yarn bootstrap

This command will likely install dependencies, set up configurations, and perform other necessary tasks.

Step 3: Start the Application

Run the following command to start the application:

yarn start

This command will start your Node.js application. Ensure that ports 5432 and 8080 are available and not in use by other processes.