Task Management System

A RESTful API for managing tasks and projects, built with FastAPI and SQLite.

Features

  • User authentication with JWT tokens
  • CRUD operations for tasks and projects
  • Task prioritization and status tracking
  • Project organization for tasks
  • Filter tasks by status, priority, and project

API Endpoints

  • GET /health - Health check endpoint
  • POST /token - Login and get access token
  • POST /users/ - Register a new user
  • GET /users/me - Get current user info
  • GET /tasks/ - List all tasks (with filters)
  • POST /tasks/ - Create a new task
  • GET /tasks/{task_id} - Get a specific task
  • PUT /tasks/{task_id} - Update a task
  • DELETE /tasks/{task_id} - Delete a task
  • GET /projects/ - List all projects
  • POST /projects/ - Create a new project
  • GET /projects/{project_id} - Get a specific project
  • PUT /projects/{project_id} - Update a project
  • DELETE /projects/{project_id} - Delete a project

Getting Started

Prerequisites

  • Python 3.8 or higher

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/task-management-system.git
    cd task-management-system
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run database migrations:

    alembic upgrade head
    
  4. Start the application:

    uvicorn main:app --reload
    
  5. Access the API documentation at http://localhost:8000/docs

Usage

Authentication

  1. Create a new user:

    curl -X 'POST' \
      'http://localhost:8000/users/' \
      -H 'Content-Type: application/json' \
      -d '{
        "username": "testuser",
        "email": "user@example.com",
        "password": "password123"
      }'
    
  2. Get an access token:

    curl -X 'POST' \
      'http://localhost:8000/token' \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -d 'username=testuser&password=password123'
    
  3. Use the token for authenticated requests:

    curl -X 'GET' \
      'http://localhost:8000/users/me' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
    

Task Management

  1. Create a new task:

    curl -X 'POST' \
      'http://localhost:8000/tasks/' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
      -H 'Content-Type: application/json' \
      -d '{
        "title": "Task Title",
        "description": "Task Description",
        "priority": "HIGH",
        "status": "TODO"
      }'
    
  2. Get all tasks:

    curl -X 'GET' \
      'http://localhost:8000/tasks/' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
    
  3. Filter tasks by status:

    curl -X 'GET' \
      'http://localhost:8000/tasks/?status=TODO' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN'
    

Project Management

  1. Create a new project:

    curl -X 'POST' \
      'http://localhost:8000/projects/' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
      -H 'Content-Type: application/json' \
      -d '{
        "name": "Project Name",
        "description": "Project Description"
      }'
    
  2. Create a task in a project:

    curl -X 'POST' \
      'http://localhost:8000/tasks/' \
      -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
      -H 'Content-Type: application/json' \
      -d '{
        "title": "Task Title",
        "description": "Task Description",
        "priority": "HIGH",
        "status": "TODO",
        "project_id": 1
      }'
    

API Documentation

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc
Description
Project: Task Management System
Readme 43 KiB
Languages
Python 98%
Mako 2%