Skip to content

Kuwuwuwu/Mini-Task-Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini-Task Manager

A simple NestJS CRUD API for task management with in-memory storage.

Features

  • GET /tasks - Retrieve all tasks
  • POST /tasks - Create a new task with validation
  • PATCH /tasks/:id - Toggle task completion status
  • DELETE /tasks/:id - Remove a task

Task Model

interface Task {
  id: string;          // Auto-generated UUID
  title: string;       // Task title (required)
  description: string; // Task description (required)
  isDone: boolean;     // Completion status (default: false)
  createdAt: Date;     // Creation timestamp
}

Setup

  1. Install dependencies:
npm install
  1. Start the development server:
npm run start:dev

The API will be available at http://localhost:3000

Testing

Use the provided tasks.http file with VS Code REST Client extension or any API client like Postman/Insomnia.

Sample API Calls

Create a task:

curl -X POST http://localhost:3000/tasks \
  -H "Content-Type: application/json" \
  -d '{"title":"Learn NestJS","description":"Complete the tutorial"}'

Get all tasks:

curl http://localhost:3000/tasks

Toggle task status:

curl -X PATCH http://localhost:3000/tasks/{taskId}

Delete a task:

curl -X DELETE http://localhost:3000/tasks/{taskId}

Project Structure

src/
├── tasks/
│   ├── dto/
│   │   └── create-task.dto.ts    # Validation DTO
│   ├── task.entity.ts            # Task model
│   ├── tasks.controller.ts       # REST endpoints
│   ├── tasks.module.ts           # Module configuration
│   └── tasks.service.ts          # Business logic
├── app.module.ts                 # Root module
└── main.ts                       # Application bootstrap

Dependencies

  • @nestjs/core - NestJS framework
  • class-validator - Input validation
  • class-transformer - Data transformation
  • uuid - Unique ID generation

Validation

The API validates input using class-validator decorators:

  • title and description are required
  • Both must be non-empty strings
  • Invalid requests return HTTP 400 with error details

About

Backend API for task management built with NestJS and Clean Architecture

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors