Skip to content

NAHIAN-19/project_planner

Repository files navigation

Project Planner API

Description

The Project Planner API is a Django-based application designed for managing projects, tasks, subscriptions, and notifications. It provides a robust backend solution that supports user authentication, project and task management, real-time notifications, and an admin dashboard for comprehensive oversight. This API is built with scalability and performance in mind, making it suitable for various project management needs.

Tech Stack

Django DRF Channels Redis Celery SQLite Swagger

Features

  • User Authentication with JWT: Secure user authentication using JSON Web Tokens (JWT).
  • Project Management: Create, update, delete, and manage projects with assigned members.
  • Task Management with Comments: Manage tasks, including comments and status updates.
  • Subscription Management: Handle user subscriptions and payment integrations.
  • Real-time Notifications: Send and receive real-time notifications using WebSockets.
  • Admin Dashboard: Comprehensive admin interface for managing users, projects, tasks, and subscriptions.
  • API Documentation with Swagger/ReDoc: Detailed API documentation for easy integration.
  • Filters: Advanced filtering options for projects, tasks, and notifications.
  • Searching: Full-text search functionality across projects, tasks, and users.
  • Pagination: Paginated responses for large datasets to improve performance.
  • Throttling: Rate limiting to prevent abuse and ensure fair usage of the API.
  • Project Invitations via Email: Invite users to join a project via email. Registered users can join directly by clicking the link, while unregistered users will be prompted to register first and then automatically join the project.

Project Structure

project_planner/
├── apps/
│   ├── admins/
│   ├── notifications/
│   ├── projects/
│   ├── subscriptions/
│   ├── tasks/
│   └── users/
├── core/
│   ├── permissions.py
│   ├── signals.py
│   ├── tasks.py
│   └── services/
│       └── mail_service.py
├── media/
├── static/
├── templates/
├── .gitignore
├── generate_keys.py
├── manage.py
├── Project Planner API.yaml
└── requirements.txt

Installation Instructions

  1. Clone the repository

    git clone https://github.com/NAHIAN-19/project_planner.git
    cd project_planner
  2. Set up a virtual environment

    python3 -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  3. Install dependencies

    pip install -r requirements.txt

Environment Variables

To set up the environment variables, run the following command to generate a .env file:

python generate_keys.py

Make sure to update the .env file with your Redis password, email settings, and Stripe keys.

Redis Setup (Terminal - 1)

On Ubuntu

  1. Install Redis
    sudo apt-get install redis-server
  2. Start Redis
    redis-server

On macOS (using Homebrew)

  1. Install Redis
    brew install redis
  2. Start Redis
    redis-server

On Windows

  1. Install Redis: Follow the instructions from the Redis for Windows repository.
  2. Start Redis: Run the Redis server executable.

Celery Setup

  1. Run Celery Worker (Terminal - 2)

    celery -A project_planner worker --loglevel=info
  2. Run Celery Beat (Terminal - 3)

    celery -A project_planner beat --loglevel=info

Database Migrations (Terminal - 4)

  1. Create Migrations

    python manage.py makemigrations
  2. Apply Migrations

    python manage.py migrate

Running the Application

To run the application, use the following command:

python manage.py runserver

API Documentation

The API documentation is available at:

  • Swagger UI: /api/v1/schema/swagger-ui/
  • ReDoc: /api/v1/schema/redoc/

Key Endpoints

User Management
  • POST /api/v1/users/register/ - User registration

    • Request Body:
      {
        "username": "abc",
        "email": "[email protected]",
        "password": "project123",
        "password2": "project123"
      }
    • Response:
      {
        "message": "Registration successful. Please verify your email.",
        "email": "[email protected]"
      }
  • POST /api/v1/users/login/ - User login

    • Request Body:
      {
        "username": "abc",
        "password": "project123"
      }
    • Response:
      {
        "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "username": "abc",
        "email": "[email protected]",
        "role": "user"
      }
  • POST /api/v1/users/logout/ - User logout

    • Response:
      {
        "message": "Logged out successfully"
      }
  • POST /api/v1/users/otp/verify/ - Verify OTP for registration

    • Request Body:
      {
        "email": "[email protected]",
        "otp": "726729",
        "purpose": "REGISTRATION"
      }
    • Response:
      {
        "refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
        "username": "abc",
        "email": "[email protected]",
        "role": "user"
      }
  • GET/PUT /api/v1/users/profile/ - User profile management

Project Management
  • GET/POST /api/v1/admins/projects/ - List/Create projects

    • Request Body:
      {
        "name": "New Project",
        "description": "Project description",
        "members": [2]
      }
    • Response:
      {
        "id": 1,
        "name": "New Project",
        "description": "Project description",
        "created_at": "2024-12-21T22:42:26.389065+06:00",
        "total_tasks": 0,
        "status": "not_started",
        "due_date": "2024-12-31T00:00:00+06:00",
        "total_member_count": 1,
        "owner": {
          "id": 1,
          "username": "abc"
        },
        "members": [
          {
            "id": 1,
            "user": "abc",
            "joined_at": "2024-12-21T22:42:41.135085+06:00",
            "membership_url": "http://127.0.0.1:8000/api/v1/projects/memberships/1/",
            "role": "owner"
          },
          {
            "id": 2,
            "user": "jhon",
            "joined_at": "2024-12-21T22:42:41.145085+06:00",
            "membership_url": "http://127.0.0.1:8000/api/v1/projects/memberships/2/",
            "role": "owner"
          }
        ]
      }
  • GET/PUT/DELETE /api/v1/admins/projects/{id}/ - Retrieve/Update/Delete project

Task Management
  • GET /api/v1/tasks/ - List tasks

    • Response:
      {
        "count": 3,
        "next": null,
        "previous": null,
        "results": [
          {
            "id": 1,
            "name": "task001",
            "due_date": "2026-01-01T00:00:00+06:00",
            "status": "completed"
          },
          {
            "id": 2,
            "name": "task002",
            "due_date": "2025-01-10T19:38:50+06:00",
            "status": "overdue"
          },
          {
            "id": 3,
            "name": "task003",
            "due_date": null,
            "status": "not_started"
          }
        ]
      }
  • GET/PUT/DELETE /api/v1/tasks/{id}/ - Retrieve/Update/Delete task

Support

For support, please open an issue in the GitHub repository.

Contributions

Contributions are welcome! Please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix (git checkout -b feature/YourFeature).
  3. Make your changes and commit them (git commit -am 'Add new feature').
  4. Push your changes (git push origin feature/YourFeature).
  5. Create a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Manage tasks and members using Project Planner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published