docker
v20.10.22docker-compose
v1.29.2node
v18.13.0npm
8.19.3cups
2.4.1cups-pdf
3.0.1-14 (Virtual printer in case your computer is not connected to any actual printer)yarn bootstrap
: Set up developmentyarn barrels
: Gather export objects from many files in a folder and re-export in index.ts
file. See configs in .barrelsby.json
.yarn start
: Start application in dev modeyarn db:migrate
: Apply new migration to current databaseyarn db:reset
: Reset database and run seedyarn db:deploy
: Deploy all migrations without confirmations (use in production)yarn db:generate
: Just generate prisma client libraryyarn db:studio
: Interact with database by a web UIyarn lint
: Check lintingyarn format
: Format codeyarn start:docker
: Run docker-compose.dev.yml
file to set up local databaseyarn clean:docker
: Remove local database instance include its data.yarn clean:git
: Clean local branches which were merged on remote📦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
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)
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.
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.