Automated Action c8aed27755 Create SaaS invoicing application with FastAPI and SQLite
- Set up project structure with modular organization
- Implement database models for users, organizations, clients, invoices
- Create Alembic migration scripts for database setup
- Implement JWT-based authentication and authorization
- Create API endpoints for users, organizations, clients, invoices
- Add PDF generation for invoices using ReportLab
- Add comprehensive documentation in README
2025-06-06 11:21:11 +00:00

51 lines
1.5 KiB
Python

from typing import List, Optional
from pydantic import AnyHttpUrl, EmailStr, validator
from pydantic_settings import BaseSettings
from pathlib import Path
class Settings(BaseSettings):
# Base
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "SaaS Invoicing Application"
PROJECT_DESCRIPTION: str = "A SaaS invoicing application API built with FastAPI"
VERSION: str = "0.1.0"
# Server configuration
SERVER_HOST: str = "http://localhost:8000"
# Authentication
SECRET_KEY: str = "CHANGE_ME_TO_A_SECURE_RANDOM_STRING"
ALGORITHM: str = "HS256"
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
# Database
DB_DIR: Path = Path("/app") / "storage" / "db"
SQLALCHEMY_DATABASE_URL: str = f"sqlite:///{DB_DIR}/db.sqlite"
# CORS
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = []
@validator("BACKEND_CORS_ORIGINS", pre=True)
def assemble_cors_origins(cls, v: str | List[str]) -> List[str] | str:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
# Emails
EMAILS_ENABLED: bool = False
EMAILS_FROM_EMAIL: Optional[EmailStr] = None
EMAILS_FROM_NAME: Optional[str] = None
# First superuser
FIRST_SUPERUSER_EMAIL: EmailStr = "admin@example.com"
FIRST_SUPERUSER_PASSWORD: str = "admin"
class Config:
case_sensitive = True
env_file = ".env"
settings = Settings()