feat: initialize zhixing-web with React, React Router, and Tailwind CSS
- Set up the main application structure with App component and routing. - Implemented global state management for UI theme using Zustand. - Created API utilities for fetching system status. - Developed system status page with responsive design and theme toggle. - Added testing setup with Vitest and initial tests for system status page. - Configured TypeScript with appropriate settings for the application. - Integrated Tailwind CSS for styling and responsive design. - Established Vite configuration for development and testing environments.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
"""Application composition and startup boundaries."""
|
||||
@@ -0,0 +1,19 @@
|
||||
"""FastAPI application factory."""
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from zhixing_server.bootstrap.config import get_settings
|
||||
from zhixing_server.interfaces.http.router import api_v1_router, operational_router
|
||||
|
||||
|
||||
def create_app() -> FastAPI:
|
||||
"""Compose the HTTP application without leaking FastAPI into domain modules.
|
||||
|
||||
Returns:
|
||||
A configured FastAPI application instance.
|
||||
"""
|
||||
settings = get_settings()
|
||||
application = FastAPI(title=settings.app_name)
|
||||
application.include_router(operational_router)
|
||||
application.include_router(api_v1_router)
|
||||
return application
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Environment-backed application configuration."""
|
||||
|
||||
from functools import lru_cache
|
||||
from typing import Literal
|
||||
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Validated process configuration at the application boundary."""
|
||||
|
||||
app_name: str = "Zhixing Server"
|
||||
app_env: Literal["development", "test", "production"] = "development"
|
||||
log_level: str = "INFO"
|
||||
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=".env",
|
||||
env_prefix="ZHIXING_",
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
"""Return one immutable-by-convention configuration object per process.
|
||||
|
||||
Returns:
|
||||
Settings populated from defaults, `.env`, and process environment variables.
|
||||
"""
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user