# Task Manager API A simple and efficient Task Manager API built with FastAPI and SQLite. This API allows you to create, read, update, and delete tasks with full CRUD operations. ## Features - Create new tasks with title and description - List all tasks with pagination support - Get individual task details - Update existing tasks (title, description, completion status) - Delete tasks - Mark tasks as completed/incomplete - Health check endpoint - Interactive API documentation ## Technology Stack - **FastAPI** - Modern, fast web framework for building APIs - **SQLAlchemy** - SQL toolkit and Object-Relational Mapping (ORM) - **SQLite** - Lightweight, file-based database - **Alembic** - Database migration tool - **Pydantic** - Data validation using Python type annotations - **Uvicorn** - ASGI web server ## Installation 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Run database migrations: ```bash alembic upgrade head ``` 3. Start the development server: ```bash uvicorn main:app --reload ``` The API will be available at `http://localhost:8000` ## API Documentation - **Interactive docs**: http://localhost:8000/docs - **ReDoc**: http://localhost:8000/redoc - **OpenAPI JSON**: http://localhost:8000/openapi.json ## API Endpoints ### Root - `GET /` - API information and links ### Health Check - `GET /health` - Application health status ### Tasks - `POST /api/tasks/` - Create a new task - `GET /api/tasks/` - Get all tasks (supports pagination with `skip` and `limit` parameters) - `GET /api/tasks/{task_id}` - Get a specific task by ID - `PUT /api/tasks/{task_id}` - Update a specific task - `DELETE /api/tasks/{task_id}` - Delete a specific task ## Task Schema ```json { "id": 1, "title": "Sample Task", "description": "This is a sample task description", "completed": false, "created_at": "2024-01-01T12:00:00.000Z", "updated_at": "2024-01-01T12:00:00.000Z" } ``` ## Project Structure ``` ├── main.py # FastAPI application entry point ├── requirements.txt # Python dependencies ├── alembic.ini # Alembic configuration ├── alembic/ # Database migrations │ ├── versions/ # Migration files │ ├── env.py # Alembic environment configuration │ └── script.py.mako # Migration template ├── app/ │ ├── __init__.py │ ├── api/ # API route handlers │ │ ├── __init__.py │ │ └── tasks.py # Task-related endpoints │ ├── db/ # Database configuration │ │ ├── __init__.py │ │ ├── base.py # SQLAlchemy base │ │ └── session.py # Database session management │ ├── models/ # SQLAlchemy models │ │ ├── __init__.py │ │ └── task.py # Task model │ └── schemas/ # Pydantic schemas │ ├── __init__.py │ └── task.py # Task schemas for validation └── storage/ └── db/ # SQLite database storage └── db.sqlite # Database file (created automatically) ``` ## Development The application uses automatic CORS configuration to allow requests from any origin during development. Database migrations are handled through Alembic. The initial migration creates the tasks table with all necessary fields and indexes. ## Environment Variables No environment variables are required for basic operation. The application uses SQLite with a local file-based database stored in `/app/storage/db/db.sqlite`.