Automated Action c5e673d2ea Implement complete beat marketplace API with FastAPI
- Set up FastAPI project structure with main.py and requirements.txt
- Created SQLite database models for users, beats, and transactions
- Implemented Alembic database migrations
- Added user authentication system with JWT tokens
- Created beat management endpoints (CRUD operations)
- Implemented purchase/transaction system
- Added file upload/download functionality for beat files
- Created health endpoint and API documentation
- Updated README with comprehensive documentation
- Fixed all linting issues with Ruff

Environment variables needed:
- SECRET_KEY: JWT secret key for authentication
2025-07-06 17:42:23 +00:00

44 lines
1.3 KiB
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.db.session import init_db
from app.api.auth import router as auth_router
from app.api.beats import router as beats_router
from app.api.transactions import router as transactions_router
from app.api.files import router as files_router
app = FastAPI(
title="Beat Marketplace API",
description="A REST API for selling beats",
version="1.0.0",
openapi_url="/openapi.json"
)
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(auth_router, prefix="/api/v1/auth", tags=["authentication"])
app.include_router(beats_router, prefix="/api/v1/beats", tags=["beats"])
app.include_router(transactions_router, prefix="/api/v1/transactions", tags=["transactions"])
app.include_router(files_router, prefix="/api/v1/files", tags=["files"])
@app.on_event("startup")
async def startup_event():
init_db()
@app.get("/")
async def root():
return {
"title": "Beat Marketplace API",
"description": "A REST API for selling beats",
"documentation": "/docs",
"health_check": "/health"
}
@app.get("/health")
async def health_check():
return {"status": "healthy", "service": "Beat Marketplace API"}