- JWT Authentication
- OAuth2 Password Flow
- Async SQLAlchemy
- SQLite + aiosqlite
- User Management
- Task CRUD Operations
- User-specific Tasks
- Partial Updates with
PATCH - Task Completion Tracking
git clone https://github.com/syswitzz/task-tracker-api.git
cd task-tracker-apiThis project uses uv.
uv syncCreate a .env file in the project root.
SECRET_KEY=your_secret_key
ACCESS_TOKEN_EXPIRE_MINUTES=30
ALGORITHM=HS256Generate a secure secret key:
python3 -c "import secrets; print(secrets.token_hex(32))"uv run uvicorn main:app --reloadServer starts at:
http://127.0.0.1:8000
| Service | URL |
|---|---|
| Swagger UI | http://127.0.0.1:8000/docs |
| ReDoc | http://127.0.0.1:8000/redoc |
Swagger UI supports JWT authentication using the built-in Authorize button.
The project uses SQLite with aiosqlite.
Database file:
tasks.db
The database is automatically created on startup.
curl -X POST http://127.0.0.1:8000/tasks \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"title":"Finish README","description":"Write project documentation"}'Example response:
{
"id": 1,
"title": "Finish README",
"description": "Write project documentation",
"completed": false,
"user_id": 1
}API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /users |
Get all users |
| POST | /users |
Create user |
| POST | /users/token |
Login and get access token |
| GET | /users/me |
Get current authenticated user |
| PUT | /users/{user_id} |
Update user |
| DELETE | /users/{user_id} |
Delete user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /tasks |
Get all tasks |
| POST | /tasks |
Create task |
| GET | /tasks/me |
Get current user's tasks |
| GET | /tasks/{task_id} |
Get task by ID |
| PATCH | /tasks/{task_id} |
Partially update task |
| DELETE | /tasks/{task_id} |
Delete task |
| POST | /tasks/{task_id}/complete |
Mark task completed |
| POST | /tasks/{task_id}/incomplete |
Mark task incomplete |
.
├── router/
│ ├── __init__.py
│ ├── tasks.py
│ └── users.py
├── auth.py
├── config.py
├── database.py
├── main.py
├── models.py
├── schemas.py
├── pyproject.toml
├── uv.lock
└── README.md
- Task priority system
- Tags & categories
- Deadlines & reminders
- Stats & analytics
- Pagination & filtering
- Docker support
- Unit tests
MIT