Automated Action f8bb3dd21d Implement Task Management Tool with FastAPI and SQLite
- Set up FastAPI project structure with API versioning
- Create database models for users and tasks
- Implement SQLAlchemy ORM with SQLite database
- Initialize Alembic for database migrations
- Create API endpoints for task management (CRUD)
- Create API endpoints for user management
- Add JWT authentication and authorization
- Add health check endpoint
- Add comprehensive README.md with API documentation
2025-06-02 20:40:57 +00:00

113 lines
2.8 KiB
Markdown

# 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 <repository-url>
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.