How burnsbert/comfyui-ebu-lmstudio works
Project Type and Purpose
• This is a full-stack LLM gateway and AI asset management system ("New API")
• Frontends: a React/Vite SPA under web/ and an Electron desktop client under electron/
• Backend: a Go-based HTTP API server (entry point main.go), using Gin for routing, layered into routers, middleware, controllers, services, models, and common utilities
• Core purpose: receive user requests, enforce auth/quotas, route to downstream LLMs (OpenAI, Claude, Gemini, etc.), perform format conversions, billing, caching, analytics, and persist data
File Structure & Architectural Insights
• Top-level “layers”:
• router/ – API endpoints grouping (api, relay, web, dashboard)
• middleware/ – request preprocessing (auth, rate-limit, logging, CORS, etc.)
• controller/ – HTTP handlers implementing business flows
• service/ – core business logic, external calls, billing, caching
• model/ + common/database.go – ORM/data objects and DB access
• relay/ – adapter implementations for each external LLM provider, organized by channel
• oauth/ – OAuth provider registry and handling
• pkg/ – reusable libraries (cachex, ionet)
• setting/ – runtime configuration definitions (rate limits, quotas, payment, model settings)
• types/ + dto/ – algebraic types, request/response schemas
• web/ + electron/ – two UIs consuming the same HTTP API
• bin/, Dockerfile, docker-compose.yml – build & deployment scripts
• External dependencies: MySQL/PostgreSQL or SQLite, Redis cache, Pyroscope for profiling, multiple third-party LLMs via HTTP/gRPC