A simple task management REST API built with FastAPI.
- CRUD Operations: Create, Read, Update, Delete tasks
- Task Filtering: Filter tasks by status
- Pagination: List tasks with page and limit parameters
- Validation: Pydantic models with field validation
- Auto-generated API Docs: Swagger UI at
/docs
- Python 3.11 or higher
- pip
- Clone the repository (or navigate to project directory):
cd taskflow- Create and activate virtual environment:
# Create venv
python -m venv venv
# Activate (Windows)
venv\Scripts\activate
# Activate (Unix/MacOS)
source venv/bin/activate- Install dependencies:
pip install -r requirements.txtStart the server:
python main.pyThe API will be available at: http://localhost:8000
API Documentation (Swagger UI): http://localhost:8000/docs
POST /tasks/
Content-Type: application/json
{
"title": "My task",
"description": "Optional description",
"status": "pending"
}GET /tasks/
GET /tasks/?status_filter=pending
GET /tasks/?page=1&limit=10GET /tasks/{task_id}PUT /tasks/{task_id}
Content-Type: application/json
{
"status": "completed"
}DELETE /tasks/{task_id}id(UUID): Auto-generated unique identifiertitle(string, max 140 chars): Task title (required)description(string, optional): Task descriptionstatus(string): Task status (pending, in_progress, completed, unknown)created_at(datetime): Auto-generated creation timestampupdated_at(datetime): Auto-updated modification timestamp
Valid status values:
pending- Task not startedin_progress- Task being worked oncompleted- Task finishedunknown- Invalid status values are normalized to 'unknown'
Create a task:
curl -X POST "http://localhost:8000/tasks/" \
-H "Content-Type: application/json" \
-d '{"title": "Buy groceries", "status": "pending"}'List all tasks:
curl "http://localhost:8000/tasks/"Get specific task:
curl "http://localhost:8000/tasks/{task_id}"Update task:
curl -X PUT "http://localhost:8000/tasks/{task_id}" \
-H "Content-Type: application/json" \
-d '{"status": "completed"}'Delete task:
curl -X DELETE "http://localhost:8000/tasks/{task_id}"import requests
base_url = "http://localhost:8000"
# Create task
response = requests.post(f"{base_url}/tasks/", json={
"title": "Test task",
"description": "Testing the API",
"status": "pending"
})
task = response.json()
task_id = task["id"]
# Get task
task = requests.get(f"{base_url}/tasks/{task_id}").json()
print(task)
# Update task
updated = requests.put(f"{base_url}/tasks/{task_id}", json={
"status": "completed"
}).json()
print(updated)
# Delete task
requests.delete(f"{base_url}/tasks/{task_id}")Run the test suite:
pytest ai-state/regressions/backend/ -vIf you see "Address already in use" error:
# Windows: Find and kill process on port 8000
netstat -ano | findstr :8000
taskkill /PID <PID> /F
# Unix/MacOS: Find and kill process
lsof -ti:8000 | xargs killMake sure you've activated the virtual environment and installed dependencies:
# Activate venv
venv\Scripts\activate # Windows
source venv/bin/activate # Unix/MacOS
# Install dependencies
pip install -r requirements.txtTests are organized in ai-state/regressions/backend/ and include path setup. Run from project root:
pytest ai-state/regressions/backend/ -vtaskflow/
├── main.py # FastAPI app and startup
├── models.py # Pydantic models
├── storage.py # In-memory storage
├── routes/
│ ├── __init__.py
│ └── tasks.py # Task endpoints
├── requirements.txt # Dependencies
├── README.md # This file
└── ai-state/
└── regressions/
└── backend/ # Test files
This project uses the Khujta Sphere Framework for structured development.
1. /core:brainstorm → Refine requirements
2. /core:write-plan → Create tasks.yaml
3. /core:analyze-tasks → Generate config files
4. /core:prepare-standards → Create implementation standards
5. /core:execute-tasks → Implement systematically
For detailed workflow documentation, see .claude/docs/CORE-WORKFLOW.md
- brainstorm - Socratic requirement refinement
- write-plan - Phase-appropriate task planning
- task-analyzer - Auto-identify config opportunities
- config-generator - Master config file creation
- standards-creator - Latest docs-based standards
- execute-tasks - Guided implementation
See .claude/skills/INDEX.md for all available skills.
- Storage: Uses in-memory storage (data lost on restart)
- Authentication: None (prototype phase)
- Persistence: No database (use for testing/prototyping only)
- Framework: Khujta Sphere for structured AI-assisted development
- FastAPI 0.104+: Modern web framework
- Pydantic v2: Data validation
- Uvicorn: ASGI server
- Python 3.11+
Prototype project - no license specified.