Skip to content

mohammadhasanii/NestTodo-API

Repository files navigation

NestJS Todo API

A RESTful API for a simple todo list manager, built with NestJS, TypeScript, and Prisma. This project serves as a demonstration of modern backend development practices, including JWT authentication, robust validation, and a clean, modular architecture.

Alt Text


Features

  • JWT-based Authentication: Secure user registration and login endpoints.
  • Protected Routes: All todo-related endpoints require a valid access token.
  • Full CRUD Functionality: Create, Read, Update, and Delete operations for user-specific todos.
  • Validation: DTO-based validation for all incoming request bodies using class-validator.
  • API Documentation: Auto-generated and detailed API documentation with Swagger.

Tech Stack


Getting Started

Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

  • Node.js (v18 or later recommended)
  • npm
  • A running MongoDB instance (must be running as a replica set for Prisma transactions).

Installation & Setup

  1. Clone the repository:

    git clone https://github.com/mohammadhasanii/NestTodo-API.git
  2. Navigate to the project directory:

    cd NestTodo-API
  3. Install dependencies:

    npm install
  4. Configure environment variables: Create a .env file in the root of the project by copying the example file:

    cp .env.example .env

    Then, update the .env file with your specific configuration.

    # The connection string for your MongoDB instance.
    # Note: ?replicaSet=rs0 is required if your MongoDB is running as a replica set.
    DATABASE_URL="mongodb://localhost:27017/db?replicaSet=rs0"
    
    # A strong, secret key for signing JWTs
    JWT_SECRET="YOUR_SUPER_SECRET_KEY"
    JWT_EXPIRES_IN="1h"

Running the Application

To run the application in development mode with hot-reloading:

npm run start:dev

About

A simple RESTful API for a Todo Manager, built with NestJS, TypeScript, and Prisma.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published