"""Reader service — FastAPI entrypoint.""" import logging from fastapi import FastAPI from app.api.categories import router as categories_router from app.api.feeds import router as feeds_router from app.api.entries import router as entries_router from app.config import DEBUG logging.basicConfig( level=logging.DEBUG if DEBUG else logging.INFO, format="%(asctime)s %(levelname)s %(name)s: %(message)s", ) app = FastAPI( title="Reader", description="Self-hosted RSS reader — replaces Miniflux.", version="1.0.0", docs_url="/api/docs" if DEBUG else None, redoc_url=None, ) app.include_router(categories_router) app.include_router(feeds_router) app.include_router(entries_router) @app.get("/api/health") async def health(): return {"status": "ok"} @app.on_event("startup") async def startup(): from app.database import engine, Base from app.models import Category, Feed, Entry # noqa: register models async with engine.begin() as conn: await conn.run_sync(Base.metadata.create_all) logging.getLogger(__name__).info("Reader service started")