Skip to content

This project implements a RESTful Bookmark API using NestJS, following clean architecture principles. It provides endpoints to manage bookmarks for authenticated users, supporting operations like creating, retrieving, updating, and deleting bookmarks.

Notifications You must be signed in to change notification settings

HarshMN2345/Bookmark-api

Repository files navigation

Nest Logo

Description

Nest Bookmark API using NestJS

Overview

This project implements a RESTful Bookmark API using NestJS, following clean architecture principles. It provides endpoints to manage bookmarks for authenticated users, supporting operations like creating, retrieving, updating, and deleting bookmarks. The application is designed with separation of concerns in mind, ensuring maintainability, testability, and scalability.

Features

  • CRUD Operations: Create, Read, Update, and Delete bookmarks.
  • Authentication: JWT-based authentication with guards to protect routes.
  • Validation: Input validation using NestJS pipes and DTOs (Data Transfer Objects).
  • Error Handling: Centralized error handling using NestJS filters.
  • Database Integration: Persistence layer with TypeORM (or any other ORM of your choice).
  • Scalable Architecture: Modular structure with independent layers for controllers, services, repositories, entities, and DTOs.
  • Testing: Unit tests for services and controllers using Jest.
  • Middleware: Custom middleware for logging, error handling, etc.
  • Documentation: Clear and concise API documentation (Swagger/OpenAPI) for easy integration.

Project Structure

The project follows a clean architecture approach, organizing code into distinct layers:

  • src/: Contains the source code for the application.
    • controllers/: HTTP request handlers.
    • services/: Business logic and data manipulation.
    • entities/: Database models and business objects.
    • dto/: Data Transfer Objects for input validation.
    • middlewares/: Middleware functions for cross-cutting concerns.
    • auth/: Authentication guards and decorators.
    • exceptions/: Custom exception filters for error handling.
    • app.module.ts: Main application module.
    • main.ts: Entry point for the application.
  • test/: Unit tests for services and controllers using Jest.

Getting Started

Prerequisites

  • Node.js (version >= 12)
  • npm or yarn
  • Docker
  • Docker Compose

Installation

  1. Clone the repository:

    git clone https://github.com/HarshMN2345/Bookmark-api/
    
$ npm install

Running the app

# development
$ npm run start:dev

$ npm run db:dev:restart

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

API DOCUMENTATION

API documentation is generated using Swagger. After starting the application, navigate to http://localhost:3333/api to explore the API using Swagger UI.

About

This project implements a RESTful Bookmark API using NestJS, following clean architecture principles. It provides endpoints to manage bookmarks for authenticated users, supporting operations like creating, retrieving, updating, and deleting bookmarks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published