feat(T01): auth + user management + RBAC + base frontend + i18n

- Backend: FastAPI, JWT auth (HS256), bcrypt, RBAC middleware
- User CRUD (admin-only), soft-delete, pagination
- Pydantic BaseSettings config, async SQLAlchemy 2.0
- 50 backend tests, 88% coverage
- Frontend: Next.js 14 App Router, Tailwind, design tokens
- Login page, auth context, API client with auto-refresh
- i18n: next-intl, DE/EN (31 keys each)
- 6 base UI components (Button, Input, Card, Table, Modal, Toast)
- 12 frontend tests, npm build success
This commit is contained in:
2026-07-14 11:51:32 +02:00
parent 5459a43e2b
commit d89304845a
56 changed files with 7581 additions and 9 deletions
+57
View File
@@ -0,0 +1,57 @@
"""FastAPI application entry point.
Configures CORS, registers routers under /api/v1, exposes health endpoint.
"""
from contextlib import asynccontextmanager
from fastapi import APIRouter, FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.config import settings
from app.routers import auth, users
@asynccontextmanager
async def lifespan(app: FastAPI):
"""Application startup and shutdown lifecycle."""
# Startup: could run alembic migrations here in production
yield
# Shutdown: cleanup resources
app = FastAPI(
title=settings.APP_NAME,
description="ERP Nutzfahrzeuge Backend API",
version="1.0.0",
lifespan=lifespan,
)
# CORS configuration from settings
app.add_middleware(
CORSMiddleware,
allow_origins=settings.cors_origins_list,
allow_credentials=True,
allow_methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"],
allow_headers=["*"],
)
# API v1 router
api_v1_router = APIRouter(prefix="/api/v1")
api_v1_router.include_router(auth.router)
api_v1_router.include_router(users.router)
# Health endpoint (no auth required)
@api_v1_router.get("/health", tags=["health"])
async def health_check():
"""Health check endpoint."""
return {"status": "ok"}
app.include_router(api_v1_router)
@app.get("/")
async def root():
"""Root redirect info."""
return {"name": settings.APP_NAME, "version": "1.0.0", "docs": "/docs"}