77 lines
2.4 KiB
Markdown
77 lines
2.4 KiB
Markdown
# Todo Application with FastAPI
|
|
|
|
This is a simple Todo Application backend built with FastAPI and SQLite.
|
|
|
|
## Features
|
|
|
|
- RESTful API for managing todo items
|
|
- CRUD operations for todos
|
|
- SQLite database with SQLAlchemy ORM
|
|
- Database migrations with Alembic
|
|
- OpenAPI documentation
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.8+
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository
|
|
2. Install dependencies:
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
3. Run database migrations:
|
|
```bash
|
|
alembic upgrade head
|
|
```
|
|
4. Start the application:
|
|
```bash
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
The application will be available at http://localhost:8000.
|
|
|
|
## API Documentation
|
|
|
|
After starting the server, you can access the interactive API documentation at:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
- **GET /api/v1/todos**: List all todos (can filter by completion status)
|
|
- **POST /api/v1/todos**: Create a new todo
|
|
- **GET /api/v1/todos/{todo_id}**: Get a specific todo
|
|
- **PUT /api/v1/todos/{todo_id}**: Update a todo
|
|
- **DELETE /api/v1/todos/{todo_id}**: Delete a todo
|
|
- **GET /api/v1/health**: Health check endpoint
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── alembic.ini # Alembic configuration
|
|
├── app # Application package
|
|
│ ├── api # API endpoints
|
|
│ │ ├── api.py # API router
|
|
│ │ └── endpoints # API endpoint modules
|
|
│ │ ├── health.py # Health check endpoint
|
|
│ │ └── todos.py # Todo endpoints
|
|
│ ├── core # Core modules
|
|
│ │ └── config.py # Application configuration
|
|
│ ├── crud # CRUD operations
|
|
│ │ └── crud_todo.py # CRUD for todos
|
|
│ ├── db # Database modules
|
|
│ │ └── session.py # Database session
|
|
│ ├── models # SQLAlchemy models
|
|
│ │ └── todo.py # Todo model
|
|
│ └── schemas # Pydantic schemas
|
|
│ └── todo.py # Todo schemas
|
|
├── main.py # Application entry point
|
|
├── migrations # Alembic migrations
|
|
└── requirements.txt # Project dependencies
|
|
``` |