# Task Management Tool A FastAPI backend for managing tasks with user authentication and SQLite database. ## Features - User registration and authentication with JWT tokens - Task management with CRUD operations - Task prioritization and status tracking - RESTful API with JSON responses - SQLite database with SQLAlchemy ORM - Database migrations with Alembic - Health check endpoint ## API Endpoints ### Health Check - `GET /health` - Check API health ### User Management - `POST /users/register` - Register a new user - `POST /users/login` - Login and get access token - `GET /users/me` - Get current user info - `PUT /users/me` - Update current user info ### Task Management - `GET /tasks` - List all tasks for current user - `POST /tasks` - Create a new task - `GET /tasks/{task_id}` - Get a specific task - `PUT /tasks/{task_id}` - Update a task - `DELETE /tasks/{task_id}` - Delete a task ## Tech Stack - [FastAPI](https://fastapi.tiangolo.com/) - Modern, fast web framework for building APIs - [SQLAlchemy](https://www.sqlalchemy.org/) - SQL toolkit and Object-Relational Mapping - [Alembic](https://alembic.sqlalchemy.org/) - Database migration tool - [Pydantic](https://pydantic-docs.helpmanual.io/) - Data validation and settings management - [SQLite](https://www.sqlite.org/) - Lightweight relational database - [Python-Jose](https://python-jose.readthedocs.io/) - JavaScript Object Signing and Encryption (JOSE) implementation - [Passlib](https://passlib.readthedocs.io/) - Password hashing library ## Setup and Installation ### Prerequisites - Python 3.9+ - pip (Python package installer) ### Environment Setup 1. Clone the repository: ```bash git clone cd taskmanagementtool ``` 2. Create and activate a virtual environment (optional but recommended): ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. Install dependencies: ```bash pip install -r requirements.txt ``` 4. Set environment variables (optional, defaults are provided): ```bash export SECRET_KEY="your-secret-key" export ACCESS_TOKEN_EXPIRE_MINUTES=30 ``` ### Database Setup 1. Run Alembic migrations to set up the database: ```bash alembic upgrade head ``` ### Running the Application 1. Start the FastAPI server: ```bash uvicorn main:app --host 0.0.0.0 --port 8000 --reload ``` 2. Access the API documentation: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## Development ### Adding Migrations When you modify the database models, create a new migration: ```bash alembic revision --autogenerate -m "Description of changes" ``` ### Applying Migrations To update your database to the latest schema: ```bash alembic upgrade head ``` ## API Documentation The API documentation is automatically generated and can be accessed at `/docs` or `/redoc` endpoints.