# Task Manager API A RESTful API for managing tasks and user accounts. Built with FastAPI, SQLAlchemy, and SQLite. ## Features - **User Management**: Registration, authentication, and profile management - **Task Management**: Create, read, update, and delete tasks - **Task Status Tracking**: Track tasks as todo, in-progress, or done - **Task Prioritization**: Set task priorities as low, medium, or high - **API Documentation**: Interactive API documentation with Swagger UI and ReDoc ## Technology Stack - **FastAPI**: High-performance web framework for building APIs - **SQLAlchemy**: SQL toolkit and Object-Relational Mapping (ORM) - **SQLite**: File-based database - **Alembic**: Database migration tool - **Pydantic**: Data validation and settings management - **JWT**: JSON Web Tokens for authentication - **Uvicorn**: ASGI server for running the application ## Project Structure ``` task-manager-api/ ├── app/ │ ├── api/ │ │ ├── endpoints/ # API endpoint modules │ │ │ ├── health.py # Health check endpoint │ │ │ ├── login.py # Login endpoints │ │ │ ├── tasks.py # Task management endpoints │ │ │ └── users.py # User management endpoints │ │ ├── deps.py # Dependency injection functions │ │ └── routes.py # API router configuration │ ├── core/ │ │ ├── config.py # Application configuration │ │ └── security.py # Security utilities │ ├── crud/ # CRUD operations │ │ ├── base.py # Base CRUD class │ │ ├── crud_task.py # Task CRUD operations │ │ └── crud_user.py # User CRUD operations │ ├── db/ │ │ └── session.py # Database session setup │ ├── models/ # SQLAlchemy models │ │ ├── task.py # Task model │ │ └── user.py # User model │ └── schemas/ # Pydantic schemas │ ├── task.py # Task schemas │ ├── token.py # Token schemas │ └── user.py # User schemas ├── migrations/ # Alembic migrations │ ├── versions/ # Migration versions │ ├── env.py # Migration environment │ └── script.py.mako # Migration script template ├── alembic.ini # Alembic configuration ├── main.py # Application entry point └── requirements.txt # Project dependencies ``` ## Getting Started ### Prerequisites - Python 3.8+ - pip (Python package installer) ### Installation 1. Clone the repository ```bash git clone cd task-manager-api ``` 2. Install dependencies ```bash pip install -r requirements.txt ``` 3. Set up environment variables ```bash # Create a .env file in the project root touch .env # Add the following variables to the .env file SECRET_KEY=your-secret-key ``` 4. Run database migrations ```bash alembic upgrade head ``` 5. Start the server ```bash uvicorn main:app --reload ``` The API will be available at http://localhost:8000. ## API Documentation Once the server is running, you can access the API documentation at: - Swagger UI: http://localhost:8000/docs - ReDoc: http://localhost:8000/redoc ## API Endpoints ### Authentication - `POST /api/v1/login/access-token` - Get JWT access token ### Users - `POST /api/v1/users/open` - Register a new user - `GET /api/v1/users/me` - Get current user - `PUT /api/v1/users/me` - Update current user ### Tasks - `GET /api/v1/tasks` - List all tasks for the current user - `POST /api/v1/tasks` - Create a new task - `GET /api/v1/tasks/{task_id}` - Get task by ID - `PUT /api/v1/tasks/{task_id}` - Update task - `DELETE /api/v1/tasks/{task_id}` - Delete task - `POST /api/v1/tasks/{task_id}/complete` - Mark task as complete - `POST /api/v1/tasks/{task_id}/incomplete` - Mark task as incomplete - `POST /api/v1/tasks/{task_id}/status/{status}` - Update task status ### Health Check - `GET /health` - API health check ## License This project is licensed under the MIT License - see the LICENSE file for details.