← BACK

manga-web-api

TypeScript ⭐ 0

Manga Web API 📚

NestJS
TypeScript
Prisma
PostgreSQL

This project is a robust backend API built with NestJS, designed to manage and serve manga-related data. It leverages Prisma as an ORM for seamless database interactions with PostgreSQL and provides a RESTful API for various manga operations.

Table of Contents 🗺️

About the Project 🌟

The Manga Web API provides a structured backend for managing manga series, chapters, and sources. It is built with a focus on scalability and maintainability, utilizing modern TypeScript and the NestJS framework. The API supports core functionalities like creating, retrieving, updating, and deleting manga-related entities.

Features ⭐

  • Manga Series Management: Create, read, update, and delete manga series entries.
  • Manga Chapter Management: Manage chapters associated with manga series, including details like chapter number, title, and download status.
  • Manga Source Integration: Support for different manga sources, allowing for flexible data fetching.
  • Database Integration: Utilizes Prisma ORM for efficient and type-safe database operations with PostgreSQL.
  • RESTful API: Exposes a clean and organized RESTful API for client interactions.
  • Swagger Documentation: Integrated Swagger UI for interactive API documentation.
  • Input Validation: Robust data validation using class-validator and class-transformer.
  • Rate Limiting: Throttling implemented to protect the API from abuse.
  • Custom Error Handling: Global exception filter for consistent error responses.
  • Response Interceptor: Standardized API response format.

Tech Stack 🚀

  • Language: TypeScript
  • Framework: NestJS
  • Database: PostgreSQL
  • ORM: Prisma
  • Package Manager: npm
  • API Documentation: Swagger
  • Validation: class-validator, class-transformer
  • Utilities: slugify

Installation 📋

To set up this project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/phambaophuc/manga-web-api.git
    cd manga-web-api
    
  2. Install dependencies:

    npm install
    
  3. Database Setup:

    • Ensure you have PostgreSQL installed and running.
    • Configure your database connection by creating a .env file in the root directory and adding your DATABASE_URL and DIRECT_URL:
      PORT=3000
      DATABASE_URL="postgresql://user:password@host:port/database?schema=public"
      DIRECT_URL="postgresql://user:password@host:port/database?schema=public"
      
    • Run Prisma migrations:
      npx prisma migrate deploy
      
  4. Run the development server:

    npm run dev
    

Usage ▶️

This API provides endpoints for managing manga sources, series, and chapters.

Running the Application

  • Development:

    npm run dev
    

    The server will start at http://localhost:3000.

  • Production:

    npm run build
    npm run start:prod
    

API Endpoints

Swagger Documentation:
Access the interactive API documentation at http://localhost:3000/docs.

Example Endpoints:

  • Create a Manga Source:

    POST /api/v1/sources
    

    Request Body:

    {
      "name": "Example Source",
      "base_url": "https://example.com",
      "parser_class": "ExampleParser",
      "status": "ACTIVE",
      "rate_limit_per_minute": 30
    }
    
  • Get a Manga Series by Slug:

    GET /api/v1/comics/one-piece
    
  • Get a Manga Chapter by Series Slug and Chapter Number:

    GET /api/v1/chapters/one-piece/1
    

License 🔑

This project is licensed under the MIT License - see the LICENSE.md file for details.

Footer 😃

© 2023 phambaophuc. All rights reserved.

Feel free to Fork 🍴, Star ⭐, and Watch 👁️ the repository!