This project was born to be a scaffold for a new Node REST microservice. It is a simple project that uses the following technologies / tools / architectures:
- Hexagonal Architecture Ready 🏛
- Typescript 🔒
- Fastify ⏩
- OpenAPI docs ready 📖
- JsonRPC app/client ready 📦
- SQLite3 with Knex 🔧
- Tap for tests 🧪
- Clone this repository
- Run
npm installfor install all dependencies - Run
npm run db:initfor create the database - Run
npm run start:devfor start the app in development mode - Have fun 🎉
- Run
npm run start:devto start the app in development mode - Run
npm run startto start the project in production mode - Run
npm run testto run the tests - Run
npm run build:${env}to build the project - Run
npm run db:initto reset or create the database - Run
npm run db:migrate:latestto run the latest migrations - Run
npm run db:migrate:resetto rollback all the migrations
env:
- development
- staging
- production
Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express and as far as we know, it is one of the fastest web frameworks in town. Check out the Fastify documentation.
Knex is a SQL query builder that can be used to build queries for different databases. It is used in this project to build queries for SQLite3, but it can be used for other SQL databases as well. To learn more about Knex, check out the Knex documentation.
To folders migrations and seeds are used to create the database and populate it with data. See the Knex documentation for more information.
Tap is a test framework for Node.js. It is used in this project to run the tests. To learn more about Tap, check out the Tap documentation.
Build docker image
env:
- development
- staging
- production
`docker build --build-arg env=${env} -t cherry:latest -f Docker/Dockerfile .'