
A Kanban-style task management backend API built with FastAPI. Features board/column/card management with drag-drop ordering support, role-based permissions, and comprehensive activity logging.
- Board Management: Create and manage multiple boards
- Column/Card Hierarchy: Organize tasks in columns with cards
- Fractional Indexing: Efficient drag-drop reordering using fractional positions
- Role-Based Permissions: Owner, Editor, and Viewer roles
- Activity Logging: Track all board activities (create, update, move, delete)
- JWT Authentication: Secure API access with token-based auth
- OpenAPI Documentation: Interactive API docs at
/docs
| Component |
Technology |
| Framework |
FastAPI |
| Database |
PostgreSQL |
| ORM |
SQLAlchemy 2.0 (async) |
| Migrations |
Alembic |
| Authentication |
JWT (python-jose) |
| Validation |
Pydantic v2 |
| Testing |
pytest + pytest-asyncio |
The easiest way to run the application:
# Clone the repository
git clone <repository-url>
cd task-board-api
# Copy environment file
cp .env.example .env
# Build and run with Docker Compose
docker compose up --build
The API will be available at:
- Python 3.11+
- PostgreSQL 15+
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Copy and configure environment
cp .env.example .env
# Edit .env with your database credentials
# Run database migrations
alembic upgrade head
# Start the development server
uvicorn app.main:app --reload
# Install test dependencies (included in requirements.txt)
pip install pytest pytest-asyncio httpx aiosqlite
# Run tests
pytest
| Method |
Endpoint |
Description |
| POST |
/api/v1/auth/register |
Register new user |
| POST |
/api/v1/auth/login |
Login and get token |
| GET |
/api/v1/auth/me |
Get current user |
| Method |
Endpoint |
Description |
| GET |
/api/v1/boards |
List user's boards |
| POST |
/api/v1/boards |
Create board |
| GET |
/api/v1/boards/{id} |
Get board details |
| PATCH |
/api/v1/boards/{id} |
Update board |
| DELETE |
/api/v1/boards/{id} |
Delete board |
| Method |
Endpoint |
Description |
| POST |
/api/v1/boards/{id}/members |
Add member |
| PATCH |
/api/v1/boards/{id}/members/{user_id} |
Update role |
| DELETE |
/api/v1/boards/{id}/members/{user_id} |
Remove member |
| Method |
Endpoint |
Description |
| GET |
/api/v1/boards/{id}/columns |
List columns |
| POST |
/api/v1/boards/{id}/columns |
Create column |
| GET |
/api/v1/boards/{id}/columns/{col_id} |
Get column |
| PATCH |
/api/v1/boards/{id}/columns/{col_id} |
Update column |
| POST |
/api/v1/boards/{id}/columns/{col_id}/move |
Move column |
| DELETE |
/api/v1/boards/{id}/columns/{col_id} |
Delete column |
| Method |
Endpoint |
Description |
| GET |
/api/v1/columns/{col_id}/cards |
List cards |
| POST |
/api/v1/columns/{col_id}/cards |
Create card |
| GET |
/api/v1/columns/{col_id}/cards/{card_id} |
Get card |
| PATCH |
/api/v1/columns/{col_id}/cards/{card_id} |
Update card |
| DELETE |
/api/v1/columns/{col_id}/cards/{card_id} |
Delete card |
| POST |
/api/v1/cards/{card_id}/move |
Move card |
| Method |
Endpoint |
Description |
| GET |
/api/v1/boards/{id}/activities |
Get activity log |
Board
├── BoardMember (user_id, role: owner/editor/viewer)
├── Column (position: fractional index)
│ └── Card (position: fractional index)
└── ActivityLog (actor, action, payload)
| Role |
Boards |
Columns/Cards |
Members |
| Owner |
Full access |
Full access |
Manage |
| Editor |
Read/Update |
Full access |
- |
| Viewer |
Read only |
Read only |
- |
The API uses fractional indexing for efficient reordering:
- Items are assigned numeric positions (e.g., 1000, 2000, 3000)
- Moving an item between two others sets position to midpoint
- Example: Moving between 1000 and 2000 results in 1500
POST /api/v1/cards/123/move
{
"target_column_id": 5,
"position": 1500.0
}
| Variable |
Description |
Default |
DATABASE_URL |
PostgreSQL async URL |
- |
DATABASE_URL_SYNC |
PostgreSQL sync URL (migrations) |
- |
SECRET_KEY |
JWT secret key |
- |
ALGORITHM |
JWT algorithm |
HS256 |
ACCESS_TOKEN_EXPIRE_MINUTES |
Token expiry |
30 |
DEBUG |
Debug mode |
False |
task-board-api/
├── app/
│ ├── api/ # API routes
│ ├── core/ # Config, database, security
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ ├── services/ # Business logic
│ └── main.py # FastAPI app
├── alembic/ # Database migrations
├── tests/ # Test suite
├── compose.yml # Docker Compose
├── Dockerfile # Container image
└── requirements.txt # Dependencies
MIT License