Automated Action 7a43bab909 Add simple todo app backend with FastAPI
- Create FastAPI application with CORS support
- Add SQLAlchemy models for Todo with timestamps
- Set up SQLite database with proper configuration
- Create CRUD operations for todo management
- Add REST API endpoints for all todo operations
- Configure Alembic for database migrations
- Add Pydantic schemas for request/response validation
- Include health check and root info endpoints
- Set up proper project structure following best practices
- Add comprehensive README with usage instructions
2025-06-19 12:10:12 +00:00

1.4 KiB

Todo App Backend

A simple todo application backend built with FastAPI and SQLite.

Features

  • Create, read, update, and delete todos
  • RESTful API endpoints
  • SQLite database with SQLAlchemy ORM
  • Database migrations with Alembic
  • Automatic API documentation with Swagger UI
  • CORS support for cross-origin requests

API Endpoints

  • GET / - Root endpoint with API information
  • GET /health - Health check endpoint
  • POST /todos/ - Create a new todo
  • GET /todos/ - Get all todos (with pagination)
  • GET /todos/{todo_id} - Get a specific todo
  • PUT /todos/{todo_id} - Update a todo
  • DELETE /todos/{todo_id} - Delete a todo

Installation

  1. Install dependencies:
pip install -r requirements.txt
  1. The application will automatically create the database tables when started.

Usage

Start the application:

uvicorn main:app --reload

The API will be available at:

Database

The application uses SQLite database stored at /app/storage/db/db.sqlite. The database schema is managed with Alembic migrations.

Todo Schema

Each todo has the following fields:

  • id: Unique identifier
  • title: Todo title (required)
  • description: Optional description
  • completed: Boolean status (default: false)
  • created_at: Creation timestamp
  • updated_at: Last update timestamp