
- Implemented user authentication with JWT tokens - Created comprehensive task management with CRUD operations - Added category system for task organization - Set up SQLite database with SQLAlchemy ORM - Configured Alembic for database migrations - Added API documentation with OpenAPI/Swagger - Implemented proper authorization and user scoping - Created health check and root endpoints - Updated README with complete documentation
Personal Task Management API
A comprehensive FastAPI-based REST API for managing personal tasks, categories, and user authentication. Built with Python, FastAPI, SQLAlchemy, and SQLite.
Features
- User Authentication: JWT-based authentication with registration and login
- Task Management: Full CRUD operations for tasks with status and priority tracking
- Category Management: Organize tasks with custom categories
- User Authorization: All operations are user-scoped and protected
- Database Migrations: Alembic for database schema management
- API Documentation: Auto-generated OpenAPI/Swagger documentation
Quick Start
Prerequisites
- Python 3.8+
- pip
Installation
- Install dependencies:
pip install -r requirements.txt
- Run database migrations:
alembic upgrade head
- Start the application:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Documentation
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
- OpenAPI JSON:
http://localhost:8000/openapi.json
API Endpoints
Authentication
POST /auth/register
- Register a new userPOST /auth/login
- Login with email and passwordGET /auth/me
- Get current user information
Tasks
GET /tasks/
- List all tasks (with filtering options)POST /tasks/
- Create a new taskGET /tasks/{task_id}
- Get a specific taskPUT /tasks/{task_id}
- Update a taskDELETE /tasks/{task_id}
- Delete a task
Categories
GET /categories/
- List all categoriesPOST /categories/
- Create a new categoryGET /categories/{category_id}
- Get a specific categoryPUT /categories/{category_id}
- Update a categoryDELETE /categories/{category_id}
- Delete a category
System
GET /
- API information and linksGET /health
- Health check endpoint
Data Models
Task
id
: Unique identifiertitle
: Task title (required)description
: Optional task descriptionstatus
: pending, in_progress, completed, cancelledpriority
: low, medium, high, urgentdue_date
: Optional due datecategory_id
: Optional category associationcompleted_at
: Timestamp when task was completedcreated_at/updated_at
: Timestamps
Category
id
: Unique identifiername
: Category name (required)description
: Optional descriptioncolor
: Optional color codecreated_at/updated_at
: Timestamps
User
id
: Unique identifieremail
: User email (unique, required)full_name
: Optional full nameis_active
: Account statuscreated_at/updated_at
: Timestamps
Environment Variables
Set the following environment variables for production:
SECRET_KEY
: JWT secret key for token signing (required for production)
Example:
export SECRET_KEY="your-super-secret-key-here"
Database
The application uses SQLite by default with the database file stored at /app/storage/db/db.sqlite
. The database is automatically created when the application starts.
Authentication
The API uses JWT bearer tokens for authentication. To access protected endpoints:
- Register a new user or login with existing credentials
- Include the access token in the Authorization header:
Authorization: Bearer <token>
Development
Code Quality
The project uses Ruff for linting and code formatting:
ruff check .
ruff format .
Database Migrations
Create new migrations after model changes:
alembic revision --autogenerate -m "Description of changes"
alembic upgrade head
Architecture
- FastAPI: Modern, fast web framework for building APIs
- SQLAlchemy: ORM for database operations
- Alembic: Database migration tool
- Pydantic: Data validation using Python type annotations
- JWT: JSON Web Tokens for authentication
- SQLite: Lightweight database for development and small deployments
The application follows a clean architecture pattern with separate layers for:
- API routes (
app/api/
) - Database models (
app/models/
) - Data schemas (
app/schemas/
) - Core utilities (
app/core/
) - Database configuration (
app/db/
)
Description
Languages
Python
99.6%
Mako
0.4%