Automated Action 4e92bb1338 Create FastAPI E-commerce API with SQLite
This commit includes:
- Project structure setup with FastAPI
- Database models with SQLAlchemy (users, products, categories, orders)
- SQLite database configuration
- Alembic migration scripts
- API endpoints for authentication, users, products, categories, and orders
- JWT authentication
- Comprehensive documentation

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

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

27 lines
702 B
Python

import secrets
from pathlib import Path
from typing import Any, Dict, Optional
from pydantic import BaseSettings
# Build paths
BASE_DIR = Path(__file__).resolve().parent.parent.parent
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
SECRET_KEY: str = secrets.token_urlsafe(32)
# 60 minutes * 24 hours * 8 days = 8 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
# CORS
BACKEND_CORS_ORIGINS: list[str] = ["*"]
# Database
DB_DIR = BASE_DIR.parent / "storage" / "db"
DB_DIR.mkdir(parents=True, exist_ok=True)
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
class Config:
case_sensitive = True
settings = Settings()