
- Set up project structure with FastAPI - Implement SQLAlchemy models for User and Task - Create Alembic migrations - Implement authentication with JWT - Add CRUD operations for tasks - Add task filtering and prioritization - Configure health check endpoint - Update README with project documentation
Task Manager API
A RESTful API for managing tasks, built with FastAPI and SQLite.
Features
- User registration and authentication with JWT tokens
- CRUD operations for tasks
- Task filtering by status
- Task prioritization
- Due dates and completion tracking
- Health check endpoint
- OpenAPI documentation
Getting Started
Prerequisites
- Python 3.8+
- pip (Python package manager)
Installation
- Clone this repository:
git clone <repository-url>
cd taskmanagerapi-oyn0px
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables (optional):
# For production, you should change these values
export SECRET_KEY="CHANGE_ME_IN_PRODUCTION"
export ACCESS_TOKEN_EXPIRE_MINUTES=10080 # 7 days
- Apply database migrations:
alembic upgrade head
- Start the server:
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
The API will be available at http://localhost:8000
API Documentation
Once the server is running, you can access the interactive API documentation at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
Authentication
POST /api/v1/auth/register
- Register a new userPOST /api/v1/auth/login
- Login and get access token
Users
GET /api/v1/users/me
- Get current user informationPATCH /api/v1/users/me
- Update current user information
Tasks
GET /api/v1/tasks
- List all tasks for the current userPOST /api/v1/tasks
- Create a new taskGET /api/v1/tasks/{task_id}
- Get a specific taskPATCH /api/v1/tasks/{task_id}
- Update a taskDELETE /api/v1/tasks/{task_id}
- Delete a task
Health Check
GET /health
- Check API health status
Task Model
Tasks have the following properties:
id
: Unique identifier (string)title
: Task title (string, required)description
: Task description (string, optional)status
: Task status (enum: todo, in_progress, done)priority
: Task priority (enum: low, medium, high)due_date
: Due date for the task (datetime, optional)completed_at
: When the task was completed (datetime, set automatically when status changes to "done")created_at
: When the task was created (datetime, automatic)updated_at
: When the task was last updated (datetime, automatic)
Database
The API uses SQLite as the database. The database file is stored at /app/storage/db/db.sqlite
.
Development
Running Tests
To run the tests (when implemented):
pytest
Linting
To run linting:
ruff check .
To automatically fix linting issues:
ruff check --fix .
Contributing
- Fork the repository
- Create your feature branch:
git checkout -b feature/my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin feature/my-new-feature
- Submit a pull request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Description
Languages
Python
97.6%
Mako
2.4%