This readme can also be read in Portuguese or English.
This is the backend of the delivery system, developed in Node.js, Express, Typescript, Prisma ORM with PostgreSQL and Swagger for API documentation.
- src/controllers: Contains route controllers.
- src/repositories: Contains the repositories to interact with the database.
- src/services: Contains the services that implement the business logic.
- src/http/server.ts: Express server input file.
- src/http/routes/index.ts: Contains the application routes.
Full API documentation can be accessed at http://localhost:5555/api-docs after starting the server. Documentation is generated using Swagger.
- Node.js Version >= v20.0.0
- PostgreSQL
- pnpm ou npm
- Docker
- Clone the repository:
git clone https://github.com/ThiLourenco/delivery-backend.git
cd delivery-backend
- Install dependencies:
pnpm install
or
npm install
- Installation with Docker-Compose:
This repository contains the artifacts necessary to run using Docker. First of all, you will need to install some prerequisites, if they are not already installed:
- Install Docker.
docker compose up
- Configure the PostgreSQL database and create a .env file in the project root with the database URL:
DATABASE_URL=postgresql://<user>:<password>@<host>:<port>/<database>?schema=public
- Run Prisma migrations to create the tables in the database:
npx prisma migrate dev --name init
- Generate the Prisma client:
npx prisma generate
To start the server in development mode, use:
pnpm dev
or
npm run dev
The server will start at http://localhost:5555 or your preferred port.
pnpm test
or
npm run test
If you want to contribute to this project, follow the steps below:
- Fork the repository.
- Create a branch for your feature (git checkout -b my-feature).
- Commit your changes (git commit -am 'Add new feature').
- Push to the branch (git push origin my-feature).
- Create a new Pull Request.
This project is licensed under the MIT License - see the MIT License file for details.