Automated Action 2e537b276d Add Todo API implementation
- Set up project structure with FastAPI, SQLAlchemy, and Alembic
- Create Todo model and database operations
- Implement CRUD API endpoints for Todo items
- Configure database migrations
- Add comprehensive documentation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-11 15:46:42 +00:00

1.9 KiB

FastAPI Todo Backend Service

This is a simple Todo API backend service built with FastAPI, SQLAlchemy, and SQLite.

Features

  • CRUD operations for Todo items
  • API documentation with Swagger UI and ReDoc
  • Database migrations with Alembic
  • SQLite database

Project Structure

.
├── alembic/              # Database migrations
├── app/
│   ├── api/              # API endpoints
│   │   └── v1/           # API version 1
│   ├── core/             # Core application configurations
│   ├── db/               # Database connection and CRUD operations
│   ├── models/           # SQLAlchemy models
│   └── schemas/          # Pydantic schemas for request/response
├── main.py               # Application entry point
├── requirements.txt      # Python dependencies
└── alembic.ini           # Alembic configuration

Getting Started

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt
  1. Run database migrations:
alembic upgrade head
  1. Start the application:
uvicorn main:app --reload

API Documentation

Once the application is running, you can access:

API Endpoints

  • GET /api/v1/todos/: List all todo items
  • POST /api/v1/todos/: Create a new todo item
  • GET /api/v1/todos/{todo_id}: Get a specific todo item
  • PUT /api/v1/todos/{todo_id}: Update a todo item
  • DELETE /api/v1/todos/{todo_id}: Delete a todo item

Example

Create a new todo

curl -X 'POST' \
  'http://localhost:8000/api/v1/todos/' \
  -H 'Content-Type: application/json' \
  -d '{
  "title": "Buy groceries",
  "description": "Milk, bread, eggs",
  "completed": false
}'

List all todos

curl -X 'GET' \
  'http://localhost:8000/api/v1/todos/' \
  -H 'accept: application/json'