mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
Initial public release
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
This commit is contained in:
68
backend/app/main.py
Normal file
68
backend/app/main.py
Normal file
@@ -0,0 +1,68 @@
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from app.api.routes import (
|
||||
accounts,
|
||||
advice,
|
||||
assets,
|
||||
backup,
|
||||
budgets,
|
||||
cash_flow,
|
||||
categories,
|
||||
dashboard,
|
||||
goals,
|
||||
insights,
|
||||
net_worth,
|
||||
recurring,
|
||||
reports,
|
||||
settings as settings_routes,
|
||||
transactions,
|
||||
)
|
||||
from app.core.config import APP_VERSION, get_settings
|
||||
from app.db.seed import seed_default_account, seed_default_app_settings, seed_default_categories
|
||||
from app.db.session import AsyncSessionLocal
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
async with AsyncSessionLocal() as session:
|
||||
await seed_default_categories(session)
|
||||
await seed_default_account(session)
|
||||
await seed_default_app_settings(session)
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(title="Aurum API", version=APP_VERSION, lifespan=lifespan)
|
||||
|
||||
app.add_middleware(
|
||||
CORSMiddleware,
|
||||
allow_origins=settings.cors_origins_list,
|
||||
allow_credentials=True,
|
||||
allow_methods=["*"],
|
||||
allow_headers=["*"],
|
||||
)
|
||||
|
||||
app.include_router(dashboard.router, prefix="/api")
|
||||
app.include_router(accounts.router, prefix="/api")
|
||||
app.include_router(categories.router, prefix="/api")
|
||||
app.include_router(transactions.router, prefix="/api")
|
||||
app.include_router(assets.router, prefix="/api")
|
||||
app.include_router(net_worth.router, prefix="/api")
|
||||
app.include_router(backup.router, prefix="/api")
|
||||
app.include_router(reports.router, prefix="/api")
|
||||
app.include_router(insights.router, prefix="/api")
|
||||
app.include_router(settings_routes.router, prefix="/api")
|
||||
app.include_router(budgets.router, prefix="/api")
|
||||
app.include_router(advice.router, prefix="/api")
|
||||
app.include_router(goals.router, prefix="/api")
|
||||
app.include_router(recurring.router, prefix="/api")
|
||||
app.include_router(cash_flow.router, prefix="/api")
|
||||
|
||||
|
||||
@app.get("/api/health")
|
||||
async def health() -> dict[str, str]:
|
||||
return {"status": "ok"}
|
||||
Reference in New Issue
Block a user