Official backend of the Loregon Projetct.
This project was developed using Node.js + TypeScript, using a modular architecture, environment variable support, and ready for execution via Docker.
To run Loregon follow the steps in Loregon_Docker
- Node.js v22
- TypeScript
- Express
- tsx
- tsconfig-paths
- Docker
- Docker Compose
- dotenv
- jsonwebtoken
- bcryptjs
- typeORM
After cloning the repository, follow the steps below:
npm install- Create a
.envfile based on .env.example - Run
npm run createDBto create the database tables - Run
npm run devto start the application
Note
These commands only start the application server.
To configure the database locally, create the database beforehand with the name LoregonDB.
As an alternative to a local Node.js environment, you can test the application using Docker and Docker Compose, which ensures a standardized environment with the database automatically configured.
-
Make sure Docker and Docker Compose are installed.
-
Run the following command:
npm run docker
This will:
- Build the Docker image of the backend
- Start a PostgreSQL database container
- Run the migration to create tables and an admin user
- Run the application in development mode (port 8000 by default)
The following scripts can be run using npm run <command>:
| Command | Description |
|---|---|
dev |
Starts the server in development mode with auto-reload using tsx and nodemon. |
build |
Compiles the TypeScript code to JavaScript and resolves paths, generating files in dist. |
start |
Runs the migrations and starts the application from the compiled JavaScript files in dist. |
docker |
Builds and runs the application and database containers using Docker Compose. |
typeorm |
Runs the TypeORM CLI with ES Modules support. |
createDB |
Generates an initial migration named createDB and runs it immediately. |
migrations:generate |
Generates a new migration based on detected changes in the entities. |
migrations:run |
Runs all pending migrations. |
migrations:revert |
Reverts the last executed migration. |
