
- Set up FastAPI application structure - Implemented SQLite database integration with SQLAlchemy - Added Alembic migrations for database versioning - Created bet model and API endpoints for CRUD operations - Added comprehensive README with setup and usage instructions - Added health check endpoint and CORS support
Sports Betting Verification API
A FastAPI-based REST API for verifying sports betting information. This application provides endpoints to manage and verify sports bets.
Features
- RESTful API with FastAPI
- SQLite database integration with SQLAlchemy ORM
- Database migrations with Alembic
- CORS support for all origins
- Health check endpoint
- OpenAPI documentation
- Input validation with Pydantic
Getting Started
Prerequisites
- Python 3.8 or higher
- pip (Python package installer)
Installation
-
Clone the repository:
git clone <repository-url> cd sportsbettingverificationapi
-
Install dependencies:
pip install -r requirements.txt
-
Run database migrations:
alembic upgrade head
-
Start the API server:
uvicorn main:app --reload
The API will be available at http://localhost:8000
API Documentation
Once the application is running, you can access the automatically generated API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
API Endpoints
GET /
: Root endpoint with API informationGET /health
: Health check endpointGET /api/v1/bets
: List all betsPOST /api/v1/bets
: Create a new betGET /api/v1/bets/{id}
: Get details of a specific betPUT /api/v1/bets/{id}
: Update a betDELETE /api/v1/bets/{id}
: Delete a bet
Project Structure
.
├── alembic.ini # Alembic configuration
├── app/ # Application code
│ ├── api/ # API endpoints
│ │ └── api_v1/ # API version 1
│ │ ├── api.py # API router
│ │ └── endpoints/ # API endpoint modules
│ ├── core/ # Core functionality
│ │ └── config.py # Application configuration
│ ├── crud/ # CRUD operations
│ ├── db/ # Database setup
│ │ ├── base.py # SQLAlchemy models registry
│ │ ├── base_class.py # SQLAlchemy base class
│ │ ├── deps.py # Dependencies for database
│ │ └── session.py # Database session
│ ├── models/ # SQLAlchemy models
│ ├── schemas/ # Pydantic schemas
│ └── utils/ # Utility functions
├── migrations/ # Alembic migration scripts
│ └── versions/ # Migration versions
├── main.py # Application entry point
└── requirements.txt # Python dependencies
Database
The application uses SQLite for data storage. The database file is located at /app/storage/db/db.sqlite
.
Environment Variables
The application supports the following environment variables:
API_V1_STR
: API version 1 prefix (default: "/api/v1")PROJECT_NAME
: Project name (default: "Sports Betting Verification API")PROJECT_DESCRIPTION
: Project descriptionCORS_ORIGINS
: Comma-separated list of allowed CORS origins (default: all origins are allowed)
Development
Running Tests
pytest
Linting
ruff check .
Auto-fix Linting Issues
ruff check --fix .
License
[Specify license information]
Description
Languages
Python
96.9%
Mako
3.1%