
- Created main.py with FastAPI app, CORS configuration, and basic endpoints - Added requirements.txt with necessary dependencies - Set up app directory structure with proper organization - Implemented base URL endpoint with app info and documentation links - Added health check endpoint that reports application and database status - Configured CORS to allow all origins - Set up Alembic for database migrations with proper SQLite configuration - Updated README with comprehensive project documentation
2.2 KiB
2.2 KiB
Todo App API
A simple Todo application API built with FastAPI and SQLite.
Features
- FastAPI web framework
- SQLite database with SQLAlchemy ORM
- Alembic database migrations
- CORS enabled for all origins
- Health check endpoint
- Interactive API documentation
Project Structure
todoapp-ns86xt/
├── main.py # FastAPI application entry point
├── requirements.txt # Python dependencies
├── alembic.ini # Alembic configuration
├── alembic/ # Database migration files
│ ├── env.py
│ ├── script.py.mako
│ └── versions/
├── app/ # Application modules
│ ├── db/ # Database configuration
│ │ ├── base.py # SQLAlchemy Base
│ │ └── session.py # Database session management
│ ├── models/ # SQLAlchemy models
│ └── api/ # API endpoints
└── storage/ # Application storage directory
└── db/ # SQLite database files
Installation
- Install dependencies:
pip install -r requirements.txt
Running the Application
Start the development server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
The application will be available at:
- API: http://localhost:8000
- Interactive API docs (Swagger): http://localhost:8000/docs
- Alternative API docs (ReDoc): http://localhost:8000/redoc
- OpenAPI JSON: http://localhost:8000/openapi.json
API Endpoints
GET /
- Root endpoint with application informationGET /health
- Health check endpointGET /docs
- Interactive API documentation (Swagger UI)GET /redoc
- Alternative API documentation (ReDoc)
Database
The application uses SQLite database stored at /app/storage/db/db.sqlite
. Database migrations are managed with Alembic.
Environment Variables
Currently, no environment variables are required for basic operation.
Development
The project uses Ruff for code linting and formatting. Make sure to run linting before committing changes.
Health Check
The /health
endpoint provides information about:
- Application status
- Database connectivity
- Service version