A tour API built with NestJS and using some good development practices like: automated tests with coverage follow up and CI tool, docker automated builds and Swagger Documentation.
More is coming...
- Features / ToDo
- Requirements
- Installation (development)
- Deploy (production)
- Docker instructions
- API Documentation
- Related projects
- References
- Docker environments (production and development)
- Swagger Docs
- Use Routing Controllers and Typescript!
- Write tests and use some CI tool
- Manage users, tours, reviews and bookings
- Queues
- Redis cache layer
- Web Socket
- GraphQL
- Get (and keep) 100% code coverage
- PostGIS (The challenge)
...
- NodeJS
- PostgreSQL
or
- Docker
- docker-compose
git clone https://github.com/chsjr1996/tours-nest-api.git
npm install
- Create a copy of file
.env.example
with name.env
and fill it npm run typeorm -- migration:run
- needed to create database tablesnpm run start:dev
- for run and watch modifications
If you have docker and docker-compose, you can use this command:
docker-compose up -d
See Docker instructions section.
- Copy
docker-compose.yaml
with namedocker-compose.prod.yaml
- Modify app > entrypoint and use
./.docker/entrypoint-prod.sh
file - (IMPORTANT) Modify passwords, ports, and others sensitives envs
- Run with
docker-compose -f docker-compose.prod.yaml up -d
You can use docker hub image too:
docker pull sourcevortex/tours-nest-api
In this case you need to have a running PostgreSQL instance and adjust the .env file.
See more in:
3000
application5432
PostgreSQL8080
pgAdmin4
If you are using docker then you need run typeorm
inside of APP container using exec
docker command, like this:
docker exec -it tours-nest-api bash
npm run typeorm -- migration:run
docker-compose down
Stop and destroy containersdocker-compose stop
Only stop containersdocker-compose start
Start stopped containersdocker-compose restart
Restart all containers
If you are using the production file (docker-compose.prod.yaml) then you need specify this after of docker-compose
, e.g.:
docker-compose -f docker-compose.prod.yaml down
You can access the API Documentation in http://localhost:3000/api (or in other defined APP Port). The /api
endpoint will display a documentation built with Swagger, if you want the OAS data then access the /api-json
endpoint. (1)
Notes
- The OAS (OpenAPI Specification) is a language-agnostic interface to RESTful. You can use the OAS output in Insomnia Designer, only copy
/api-json
result and paste in 'Design' tab.
The Admin panel to manage this API (e.g.: create tours, remover users, ...). This app is built with Angular (11), in SPA mode and follow best development practices.
Flutter APP to user navigation (booking, register, pay, ...), coming soon...
Site (Angular Universal SSR) to user navigation (booking, register, pay, ...), coming soon...
This repository is based on some articles and videos. I used them as study object, then here has some differences because I merged several concepts and did some adjusts.
- NestJS Docs
- Node.js, Express, MongoDB & More: The Complete Bootcamp 2020
(1)
- Nest.js: desenvolvimento de APIs, by: Full Cycle
- Agilidade brutal no backend com Nest.js, by: Full Cycle
- Best Way to Structure Your Directory/Code (NestJS), by: Prateek Kathal
Notes
- This repository is inspired on udemy course Node.js, Express, MongoDB & More: The Complete Bootcamp 2020, originally built with vanilla Javascript and MongoDB.
If you see any error or want a new feature, please open a issue!