fastify-bookmarkly is an example backend API using the Fastify framework, MongoDB, and a clean architecture.
Parts of the original code are from Bill Sourour's DevMastery Comments Microservice API and Clean RESTful API with Node.js.
The project is a learning repository where I explore how to code a "clean" Node API from scratch.
- Node.js & Fastify
- Docker & Docker Compose
- MongoDB
- Node.js
- Docker
- Docker Compose
$ git clone [email protected]:sophiabrandt/fastify-bookmarkly.git && cd fastify-bookmarkly
Check the config
folder and change the name of variables as needed.
$ pnpm install # or npm install
$ docker-compose up -d
$ pnpm run db # or npm run db
$ pnpm run dev # or npm run dev
Visit http://localhost:3000/bookmarks with your browser.
Swagger documentation is available under http://localhost:3000/docs.
Example request with curl:
curl -X POST \
'http://127.0.0.1:3000/bookmarks/' \
-H 'Content-Type: application/json' \
-d '{"title": "hacker news", "description": "news for programmers", "url": "https://hackerweb.app"}'
To create a production build:
$ pnpm run build # or npm run build
$ pnpm run start # or npm run start
$ pnpm run test # or npm run test
For now, the tests contain stubs, but are are already connected to MongoDB.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Copyright © 2020 Sophia Brandt
MIT Licence
- Bill Sourour for DevMastery Comments Microservice API and Clean RESTful API with Node.js