Implements complete FastAPI backend infrastructure for MoreThanADiagnosis with:
Core Infrastructure:
- FastAPI application with CORS, error handling, health checks
- SQLAlchemy ORM with PostgreSQL support
- Pydantic configuration management
- Docker & Docker Compose for production deployment
Database Models (7 MVPs + Auth):
- User, Profile, Role, Consent (identity)
- RefreshToken, AuthAuditLog (authentication)
- ForumCategory, ForumThread, ForumPost, ForumReaction, ForumReport (forum)
- BlogPost (blog)
- PodcastEpisode (podcast)
- Resource (resources)
- TributeEntry (tribute)
- MerchProduct, Order, OrderItem (merch)
API Endpoints (Alphabetical MVPs):
- /api/v1/blog - Blog posts (list, get)
- /api/v1/forum - Categories, threads, posts, reactions, reports
- /api/v1/merch - Products, orders
- /api/v1/podcast - Episodes
- /api/v1/profiles - User profiles
- /api/v1/resources - Knowledge base
- /api/v1/tribute - Memorials
- /api/v1/health - Health checks
Configuration & Deployment:
- .env.example for configuration
- Dockerfile with multi-stage build
- docker-compose.yml for PostgreSQL + Redis + API
- Production-ready on nexus-vector with port 8000
- Non-root user, health checks, security best practices
Dependencies:
- FastAPI, SQLAlchemy, Pydantic
- PostgreSQL, Redis
- Testing (pytest), Security (passlib, python-jose)
- Full requirements.txt with 30+ packages
Status: Foundation complete, MVP endpoint stubs ready
Next: Database migrations, authentication implementation
Job ID: MTAD-IMPL-2025-11-18-CL
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
86 lines
2.1 KiB
Python
86 lines
2.1 KiB
Python
"""
|
|
Application configuration using Pydantic Settings.
|
|
|
|
Job ID: MTAD-IMPL-2025-11-18-CL
|
|
"""
|
|
|
|
from typing import List
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
"""Application settings loaded from environment variables."""
|
|
|
|
# Environment
|
|
env: str = "development"
|
|
debug: bool = False
|
|
|
|
# API
|
|
api_version: str = "v1"
|
|
api_title: str = "MoreThanADiagnosis API"
|
|
api_description: str = "Community Hub for Chronically/Terminally Ill Individuals"
|
|
|
|
# Database
|
|
database_url: str = "sqlite:///./test.db"
|
|
database_pool_size: int = 20
|
|
database_max_overflow: int = 10
|
|
|
|
# Security
|
|
secret_key: str = "change-me-in-production"
|
|
algorithm: str = "HS256"
|
|
access_token_expire_minutes: int = 15
|
|
refresh_token_expire_days: int = 30
|
|
password_hashing_algorithm: str = "argon2"
|
|
|
|
# CORS
|
|
cors_origins: List[str] = [
|
|
"https://morethanadiagnosis.com",
|
|
"http://localhost:3000",
|
|
"http://localhost:8081",
|
|
]
|
|
cors_credentials: bool = True
|
|
cors_methods: List[str] = ["*"]
|
|
cors_headers: List[str] = ["*"]
|
|
|
|
# Logging
|
|
log_level: str = "INFO"
|
|
log_format: str = "json"
|
|
|
|
# Observability
|
|
jaeger_enabled: bool = False
|
|
jaeger_host: str = "localhost"
|
|
jaeger_port: int = 6831
|
|
|
|
# Rate Limiting
|
|
rate_limit_enabled: bool = True
|
|
rate_limit_requests: int = 100
|
|
rate_limit_period: int = 60
|
|
|
|
# Redis
|
|
redis_url: str = "redis://localhost:6379/0"
|
|
|
|
# Email
|
|
smtp_server: str = "smtp.gmail.com"
|
|
smtp_port: int = 587
|
|
smtp_username: str = "noreply@morethanadiagnosis.com"
|
|
smtp_password: str = ""
|
|
smtp_from: str = "noreply@morethanadiagnosis.com"
|
|
|
|
# File Storage
|
|
storage_type: str = "s3"
|
|
s3_bucket: str = "morethanadiagnosis-media"
|
|
s3_region: str = "us-east-1"
|
|
s3_access_key: str = ""
|
|
s3_secret_key: str = ""
|
|
|
|
# Feature Flags
|
|
feature_mfa_enabled: bool = True
|
|
feature_social_login_enabled: bool = False
|
|
feature_pseudonym_enabled: bool = True
|
|
|
|
class Config:
|
|
env_file = ".env"
|
|
case_sensitive = False
|
|
|
|
|
|
settings = Settings()
|