Fastify Starter

ci status

An all-in-one Fastify starter project. It follows a MVC structure.

What's in this pack ?

  • A default CRUD model
  • DB server: MongoDB
  • DB adapter: Mongoose
  • A login route using jwt
  • Documentation of the API is set up (using Swagger)
  • Unit & Integration tests are set up
  • Lint & prettier installed
  • CI is set up (using github workflows)

Requirements

With Docker

If you don't want to bother with mongod, you can use the docker image in the project. All you need:

  • Docker server is running
  • docker-compose is installed on your machine, and is in your $PATH.

Without Docker

If you don't want to use Docker because it takes too much memory on your machine (especially Windows') or for any other reasons, you can also run the local DB test server directly with mongod.

You should have MongoDB@^4.0.0 Server installed on your computer. Please make sure that its binaries are added in your PATH variable. On Windows, by default you will find them in C:\Program Files\MongoDB\Server\4.4\bin.

Getting Started

  1. Install dependencies
yarn install
  1. Run the DB server:

    With Docker

yarn start:docker

...Or with mongod

yarn start:db

Note: You can run the DB server as a background task if you want, or you can open another terminal for the next operation.


  1. Run the API server:
yarn start

Testing

yarn validate

This will run both the linter and the test units.