Task Manager API
A FastAPI-based Task Manager API with SQLite database and JWT authentication.
Features
- User management (register, login, update profile)
- Task management (create, read, update, delete)
- Task assignment to other users
- Task filtering by status
- JWT authentication
- Role-based access control (regular users and superusers)
Tech Stack
- Framework: FastAPI
- Database: SQLite with SQLAlchemy ORM
- Migrations: Alembic
- Authentication: JWT tokens (via python-jose)
- Password Hashing: Bcrypt
- Validation: Pydantic
Project Structure
├── app/
│ ├── api/
│ │ └── v1/
│ │ ├── endpoints/
│ │ │ ├── auth.py
│ │ │ ├── tasks.py
│ │ │ └── users.py
│ │ └── api.py
│ ├── core/
│ │ ├── auth.py
│ │ └── config.py
│ ├── crud/
│ │ ├── task.py
│ │ └── user.py
│ ├── db/
│ │ ├── base_class.py
│ │ ├── base.py
│ │ └── session.py
│ ├── models/
│ │ ├── task.py
│ │ └── user.py
│ ├── schemas/
│ │ ├── task.py
│ │ ├── token.py
│ │ └── user.py
│ └── storage/
│ └── db/
├── migrations/
│ └── versions/
├── alembic.ini
├── main.py
├── README.md
└── requirements.txt
Environment Variables
This application uses the following environment variables:
Variable | Description | Default |
---|---|---|
SECRET_KEY | JWT secret key | supersecretkey |
ACCESS_TOKEN_EXPIRE_MINUTES | JWT token expiration time in minutes | 60 |
Getting Started
Prerequisites
- Python 3.8 or higher
Installation
-
Clone the repository
-
Install dependencies
pip install -r requirements.txt
-
Run the application
uvicorn main:app --reload
-
Access the API documentation
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
Database Migrations
Apply migrations to create the database schema:
alembic upgrade head
API Endpoints
Authentication
POST /api/v1/auth/register
- Register a new userPOST /api/v1/auth/token
- Login and get access token
Users
GET /api/v1/users/me
- Get current userPUT /api/v1/users/me
- Update current userGET /api/v1/users/{user_id}
- Get user by IDGET /api/v1/users/
- List all users (superuser only)POST /api/v1/users/
- Create a new user (superuser only)PUT /api/v1/users/{user_id}
- Update a user (superuser only)
Tasks
GET /api/v1/tasks/
- List tasks (with optional status filter)POST /api/v1/tasks/
- Create a new taskGET /api/v1/tasks/{task_id}
- Get a task by IDPUT /api/v1/tasks/{task_id}
- Update a taskDELETE /api/v1/tasks/{task_id}
- Delete a taskPOST /api/v1/tasks/{task_id}/assign/{user_id}
- Assign a task to a user
Health Check
GET /health
- Check API health
License
This project is licensed under the MIT License.
Description
Languages
Python
97.9%
Mako
2.1%