# Task Manager API A modern REST API service built with FastAPI and SQLite for task management and item resources. ## Features - FastAPI-based REST API with automatic OpenAPI documentation - SQLAlchemy ORM with SQLite database - Alembic database migrations - CRUD operations for task and item resources - Task management with status, priority, and due dates - Health check endpoint - Async-ready with uvicorn ## Project Structure ``` . ├── alembic.ini ├── app/ │ ├── api/ │ │ ├── api.py │ │ └── endpoints/ │ │ ├── items.py │ │ └── tasks.py │ ├── core/ │ │ ├── config.py │ │ └── database.py │ ├── models/ │ │ ├── base.py │ │ ├── item.py │ │ └── task.py │ └── schemas/ │ ├── item.py │ └── task.py ├── main.py ├── migrations/ │ ├── env.py │ ├── README │ ├── script.py.mako │ └── versions/ │ ├── 001_initial_migration.py │ └── 002_add_task_table.py └── requirements.txt ``` ## Prerequisites - Python 3.8+ - virtualenv (recommended) ## Installation 1. Clone the repository: ```bash git clone cd ``` 2. Create and activate a virtual environment (optional but recommended): ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. Install dependencies: ```bash pip install -r requirements.txt ``` 4. Initialize the database: ```bash alembic upgrade head ``` ## Running the API Start the API server with: ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000 ## API Documentation FastAPI automatically generates interactive API documentation: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## API Endpoints ### Health - **GET /health** - Health check endpoint ### Items - **GET /api/v1/items/** - List all items - **POST /api/v1/items/** - Create a new item - **GET /api/v1/items/{item_id}** - Get a specific item - **PUT /api/v1/items/{item_id}** - Update a specific item - **DELETE /api/v1/items/{item_id}** - Delete a specific item ### Tasks - **GET /api/v1/tasks/** - List all tasks (with optional status filtering) - **POST /api/v1/tasks/** - Create a new task - **GET /api/v1/tasks/{task_id}** - Get a specific task - **PUT /api/v1/tasks/{task_id}** - Update a specific task - **DELETE /api/v1/tasks/{task_id}** - Delete a specific task - **POST /api/v1/tasks/{task_id}/complete** - Mark a task as completed ## Development ### Database Migrations After modifying models, create a new migration: ```bash alembic revision -m "description of changes" ``` Apply migrations: ```bash alembic upgrade head ``` Revert migrations: ```bash alembic downgrade -1 # Go back one migration ``` ### Code Quality Run linting with Ruff: ```bash ruff check . ruff check --fix . # Auto-fix issues ```