77 lines
2.0 KiB
Markdown
77 lines
2.0 KiB
Markdown
# Todo Application API
|
|
|
|
A Todo application backend built with Python, FastAPI, and SQLAlchemy.
|
|
|
|
## Features
|
|
|
|
- Create, read, update, and delete todo items
|
|
- List all todos with pagination
|
|
- Persistent storage using SQLite
|
|
- API documentation with Swagger UI and ReDoc
|
|
|
|
## Tech Stack
|
|
|
|
- **FastAPI**: High-performance web framework for building APIs
|
|
- **SQLAlchemy**: SQL toolkit and ORM
|
|
- **Alembic**: Database migration tool
|
|
- **Pydantic**: Data validation and settings management
|
|
- **SQLite**: Lightweight disk-based database
|
|
- **Uvicorn**: ASGI server
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
.
|
|
├── alembic/ # Database migrations
|
|
│ └── versions/ # Migration scripts
|
|
├── app/ # Application code
|
|
│ ├── api/ # API endpoints
|
|
│ │ └── endpoints/ # API route handlers
|
|
│ ├── core/ # Core functionality
|
|
│ ├── db/ # Database
|
|
│ │ └── repositories/ # Database repositories
|
|
│ ├── models/ # SQLAlchemy models
|
|
│ └── schemas/ # Pydantic schemas
|
|
├── alembic.ini # Alembic config
|
|
├── main.py # Application entry point
|
|
└── requirements.txt # Dependencies
|
|
```
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Python 3.8+
|
|
|
|
### Installation
|
|
|
|
1. Clone the repository
|
|
2. Install the dependencies:
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
3. Run database migrations:
|
|
```
|
|
alembic upgrade head
|
|
```
|
|
|
|
4. Start the server:
|
|
```
|
|
uvicorn main:app --reload
|
|
```
|
|
|
|
### API Documentation
|
|
|
|
Once the server is running, you can access:
|
|
|
|
- Swagger UI: http://localhost:8000/docs
|
|
- ReDoc: http://localhost:8000/redoc
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/v1/todos`: List all todos
|
|
- `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 specific todo
|
|
- `DELETE /api/v1/todos/{todo_id}`: Delete a specific todo |