Automated Action d09d61a7c8 Implement Task Manager API with FastAPI and SQLite
- Created FastAPI application structure with main.py and requirements.txt
- Setup SQLite database with SQLAlchemy models for tasks
- Implemented Alembic migrations for database schema management
- Added CRUD endpoints for task management (GET, POST, PUT, DELETE)
- Configured CORS middleware to allow all origins
- Added health endpoint and base route with API information
- Updated README with comprehensive documentation
- Applied code formatting with Ruff linter
2025-06-24 14:17:11 +00:00
2025-06-24 14:12:35 +00:00

Task Manager API

A simple task management API built with FastAPI and SQLite.

Features

  • Create, read, update, and delete tasks
  • Task priority levels (high, medium, low)
  • Task completion status tracking
  • RESTful API design
  • Automatic API documentation with Swagger UI

Quick Start

  1. Install dependencies:

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

    alembic upgrade head
    
  3. Start the application:

    uvicorn main:app --reload
    
  4. Open your browser and navigate to:

API Endpoints

Base Routes

  • GET / - API information and links
  • GET /health - Health check endpoint

Task Management

  • GET /api/v1/tasks - Get all tasks (with pagination)
  • GET /api/v1/tasks/{id} - Get a specific task
  • POST /api/v1/tasks - Create a new task
  • PUT /api/v1/tasks/{id} - Update a task
  • DELETE /api/v1/tasks/{id} - Delete a task

Task Schema

{
  "title": "string",
  "description": "string (optional)",
  "completed": "boolean (default: false)",
  "priority": "string (default: medium)",
  "id": "integer (auto-generated)",
  "created_at": "datetime (auto-generated)",
  "updated_at": "datetime (auto-generated)"
}

Project Structure

├── main.py                 # FastAPI application entry point
├── requirements.txt        # Python dependencies
├── alembic.ini            # Alembic configuration
├── alembic/               # Database migrations
├── app/
│   ├── db/
│   │   ├── base.py        # SQLAlchemy Base
│   │   └── session.py     # Database session management
│   ├── models/
│   │   └── task.py        # Task SQLAlchemy model
│   ├── routers/
│   │   └── tasks.py       # Task API endpoints
│   └── schemas/
│       └── task.py        # Pydantic schemas
└── storage/
    └── db/                # SQLite database storage

Database

The application uses SQLite for data storage. The database file is created automatically at /app/storage/db/db.sqlite.

Development

The application is configured with:

  • CORS enabled for all origins
  • Automatic API documentation
  • Database migrations with Alembic
  • Pydantic models for request/response validation
Description
Project: Task Manager API
Readme 36 KiB
Languages
Python 93.1%
Mako 6.9%