This is a fastify with mongo starter project in typescript.
The projects follows the plugins & controllers/models architecture. You can find two plugin in the plugins folder. The buildFastifyEnvPlugin links the .env file to the fastify server and the connectToDbPlugin connects the server to your Mongo Atlas Cluster.
$ git clone https://github.com/imevanc/fastify-typescript-mongo-starter.git
$ cd fastify-typescript-mongo-starter
$ npm run install
You need to create a .env file in the root of your project and populate it with the following entries.
NODE_ENV=
MONGO_URL=
MONGO_DB_NAME=
MONGO_COLLECTION_NAME=
HTTP_PORT=
HTTP_HOST=
You can run the project with hot reload.
$ npm run dev