Public Access
feat: add Phase 1 infrastructure skeleton
Backend (FastAPI): - docker-compose with all 4 services - FastAPI app with health endpoints - SQLAlchemy models for all tables - Placeholder API endpoints for all routes - Config and database modules - requirements.txt with all dependencies Frontend (React): - package.json with React, Tailwind, React Query, React Router - Vite config with API proxy - Tailwind and TypeScript configs - Basic App with routing skeleton - Placeholder pages (Dashboard, MealDetail, Pantry) Infrastructure: - nginx config for reverse proxy - Dockerfile for backend and frontend
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
from fastapi import FastAPI, Depends
|
||||
from sqlalchemy.orm import Session
|
||||
from app.database import get_db, engine, Base
|
||||
from app.models import family_profile, ingredient, recipe, meal_plan, home_pantry, feedback, grocery_item, scrape_log, email_log
|
||||
from app.config import settings
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=settings.LOG_LEVEL)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
app = FastAPI(
|
||||
title="MealPlanner",
|
||||
description="Self-hosted meal planning system",
|
||||
version="0.1.0",
|
||||
)
|
||||
|
||||
Base.metadata.create_all(bind=engine)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health_check(db: Session = Depends(get_db)):
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/health/db")
|
||||
def health_check_db(db: Session = Depends(get_db)):
|
||||
try:
|
||||
db.execute("SELECT 1")
|
||||
return {"status": "ok", "database": "connected"}
|
||||
except Exception as e:
|
||||
return {"status": "error", "database": "disconnected", "error": str(e)}
|
||||
|
||||
|
||||
from app.api import profile, recipes, meals, shopping_list, pantry, admin
|
||||
|
||||
app.include_router(profile.router, prefix="/api/profile", tags=["profile"])
|
||||
app.include_router(recipes.router, prefix="/api/recipes", tags=["recipes"])
|
||||
app.include_router(meals.router, prefix="/api/meals", tags=["meals"])
|
||||
app.include_router(shopping_list.router, prefix="/api/shopping-list", tags=["shopping-list"])
|
||||
app.include_router(pantry.router, prefix="/api/pantry", tags=["pantry"])
|
||||
app.include_router(admin.router, prefix="/api/admin", tags=["admin"])
|
||||
Reference in New Issue
Block a user