Skip to content

MannyNe/bookstore-api

Repository files navigation

Bookstore API

TypeScript NodeJS Express MongoDB Biome OpenAPI Socket.io

Description

Advanced bookstore api with multiple features

  • Biome: A powerful and flexible linter and formatter for TypeScript.
  • OpenAPI: A standard for building APIs with a focus on design and documentation.
  • Socket.io: A library for building real-time applications with WebSockets.

Features

The following features are available in the API based on the user role:

Admin:

  • CRUD operations on books
  • CRUD operations on users

User:

  • View books
  • Advanced search for books
  • Review books
  • Rate books
  • Add interests
  • Report reviews
  • View reviews
  • Update their profile
  • Delete their profile

Entity Diagram

The following diagram shows the relationship between the entities in the database: Bookstore Graphic

Installation

Pre-Requisites

  • Node.js
  • Docker Engine (For developement)
  • Yarn

Steps

  • Install all the project dependency using Yarn:

    $ yarn
  • Run the application from command prompt:

    $ yarn dev

Logging and Monitoring

  • If you want to monitor the API, you can query(PromQL) the logged data by heading over to prometheus dashboard to check the performance of the API as well as database queries and modifications. Examples are given below:
rate(fetch_database_duration_seconds_sum[2m]) / rate(fetch_database_duration_seconds_count[2m])
histogram_quantile(0.99, rate(fetch_database_duration_seconds_bucket[2m]))
fetch_requests_total

The files to check the index names can be found within the metrics explorer or can be found here

Documentation

  • There is a deployed version of the documentation (recommended) which can be located here. There is a swagger documentation located at here as well when running the code. But the best documentation you will get is by importing the postman collection which I will link here

License

© MIT License

About

Bookstore API done using NodeJS, Express and MongoDB

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors