Task Management API

This is a simple REST API for managing tasks built with FastAPI and SQLite.

Features

  • Create, read, update, and delete tasks
  • Filter tasks by status, priority, and completion status
  • Health check endpoint
  • OpenAPI documentation
  • CORS enabled

Tech Stack

  • FastAPI: Modern, fast web framework for building APIs
  • SQLAlchemy: SQL toolkit and ORM
  • Alembic: Database migration tool
  • SQLite: Lightweight disk-based database
  • Pydantic: Data validation and settings management
  • Uvicorn: ASGI server

API Endpoints

  • GET /: Root endpoint with API information
  • GET /openapi.json: OpenAPI schema
  • GET /docs: Swagger UI documentation
  • GET /redoc: ReDoc documentation
  • GET /api/v1/health: Health check endpoint

Task Endpoints

  • GET /api/v1/tasks: List all tasks
  • POST /api/v1/tasks: Create a new task
  • GET /api/v1/tasks/{task_id}: Get a task by ID
  • PUT /api/v1/tasks/{task_id}: Update a task
  • DELETE /api/v1/tasks/{task_id}: Delete a task

Setup and Installation

Prerequisites

  • Python 3.8 or higher

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd taskmanagementapi
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the application:

    uvicorn main:app --reload
    
  4. The API will be available at http://localhost:8000

Database Migrations

The application uses Alembic for database migrations. Migrations are automatically applied when the application starts. If you need to run migrations manually:

alembic upgrade head

Environment Variables

The application uses the following environment variables:

  • None required as it uses SQLite with a fixed path

Development

Running Tests

Currently, no tests are implemented.

Linting

The project uses Ruff for linting:

ruff check .

API Documentation

When the application is running, you can access the Swagger UI documentation at http://localhost:8000/docs and the ReDoc documentation at http://localhost:8000/redoc.

Description
Project: Task Management API
Readme 40 KiB
Languages
Python 96%
Mako 4%