A robust backend API built with NestJS for managing projects, tasks, users, and comments. This application provides a complete project management solution with authentication, email verification, and role-based access control.
This is a NestJS-based backend application that serves as the API for a project management system. It allows users to create and manage projects, assign tasks, add comments, and collaborate effectively. The system includes user authentication with JWT tokens, email verification via OTP, and password reset functionality.
- User Management: User registration, login, email verification, and password reset
- Project Management: Create, update, delete projects and manage project members
- Task Management: Create and manage tasks within projects
- Comment System: Add comments to tasks for collaboration
- Authentication & Authorization: JWT-based authentication with role-based access control
- Email Integration: OTP verification and password reset via email
- Database Integration: PostgreSQL with TypeORM for data persistence
- Framework: NestJS
- Language: TypeScript
- Database: PostgreSQL
- ORM: TypeORM
- Authentication: JWT, Passport
- Email Service: @nestjs-modules/mailer with Pug templates
- Validation: class-validator, class-transformer
- Testing: Jest
- Linting: ESLint
- Code Formatting: Prettier
-
Clone the repository:
git clone https://github.com/a-3isa/Project-Management-System cd project -
Install dependencies:
npm install
-
Database Setup:
- Ensure PostgreSQL is installed and running
- Create a database named
project-management-system
-
Environment Variables:
- Create a
.envfile in the root directory - Add the following variables:
PORT=3000 JWT_SECRET=your_jwt_secret_here JWT_EXPIRES_IN=3600 DB_HOST=localhost DB_PORT=5432 DB_USERNAME=your_db_username DB_PASSWORD=your_db_password DB_NAME=project-management-system MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USER=your_mail_user MAIL_PASS=your_mail_pass MAIL_FROM=noreply@yourapp.com
- Create a
-
Email Configuration:
- The email service is configured using environment variables
- Templates are stored in the
templates/directory (create if not exists) - Update the SMTP credentials in
.envif using a different email service
npm run start:devnpm run build
npm run start:prodThe application will start on http://localhost:3000 by default.
POST /auth/register- Register a new user (Admin only)POST /auth/verify-otp- Verify email with OTPPOST /auth/login- User loginPOST /auth/forgot-password- Request password resetPOST /auth/reset-password- Reset password with token
GET /users/me- Get current user infoGET /users- Get all usersGET /users/:id/tasks- Get tasks for a specific userDELETE /users/:id- Delete a user
POST /projects/create- Create a new projectPOST /projects/:id/add-user/:userId- Add user to projectPOST /projects/:projectId/tasks- Add task to projectGET /projects- Get all projectsGET /projects/:id- Get project by IDPATCH /projects/:id- Update projectDELETE /projects/:id- Delete project
GET /tasks/:id- Get task by IDPATCH /tasks/:id- Update taskDELETE /tasks/:id- Delete taskPOST /tasks/:taskId/comments- Add comment to taskGET /tasks/:taskId/comments- Get comments for task
# Unit tests
npm run test
# E2E tests
npm run test:e2e
# Test coverage
npm run test:covsrc/
├── app.controller.ts # Main app controller
├── app.module.ts # Main app module
├── app.service.ts # Main app service
├── auth/ # Authentication module
│ ├── auth.controller.ts
│ ├── auth.module.ts
│ ├── auth.service.ts
│ ├── dto/
│ ├── entities/
│ └── jwt.strategy.ts
├── user/ # User management module
│ ├── user.controller.ts
│ ├── user.module.ts
│ ├── user.service.ts
│ ├── dto/
│ └── entities/
├── project/ # Project management module
│ ├── project.controller.ts
│ ├── project.module.ts
│ ├── project.service.ts
│ ├── dto/
│ └── entities/
├── task/ # Task management module
│ ├── task.controller.ts
│ ├── task.module.ts
│ ├── task.service.ts
│ ├── dto/
│ └── entities/
└── comment/ # Comment module
├── comment.controller.ts
├── comment.module.ts
├── comment.service.ts
├── dto/
└── entities/
The application uses the following main entities:
- User: Stores user information, authentication data, and relationships
- Project: Represents projects with title and associated users/tasks
- Task: Individual tasks within projects with assignments and comments
- Comment: Comments on tasks for collaboration
This project is licensed under the UNLICENSED license.