Overview
Guccho is a Nuxt 3-based web frontend for private osu! servers. It uses a layered architecture with backend adapters to support different server implementations while maintaining a consistent API through TRPC.Architecture Diagram
The following diagram illustrates how data flows through Guccho’s architecture:Project Structure
Backend Structure
The server-side code is organized in/src/server/:
Key Directories
backend/$base/: Abstract base providers that define interfaces for all server functionalitybackend/bancho.py/: Concrete implementation for bancho.py serversbackend/[email protected]/: Extended implementation for ppy.sbtrpc/routers/: API route definitions (user, score, map, etc.)trpc/middleware/: Request pipeline components (session, auth, roles)
Abstraction Layers
$base Layer
The$base directory contains abstract provider classes that define the contract for backend implementations:
UserProvider- User management and authenticationScoreProvider- Score queries and leaderboardsMapProvider- Beatmap dataSessionProvider- Session storageArticleProvider- News/article contentRankProvider- Rankings and statistics
$active Adapter
The$active alias points to the currently active backend adapter configured in guccho.backend.config.ts:
$active to access the active adapter’s implementation:
Data Flow
Client to Server
- User Action: User interacts with a page component
- TRPC Client: Component calls TRPC procedure via the client
- HTTP Transport: Request sent with superjson serialization
- TRPC Server: Handler receives request, runs middleware
- Provider Call: Router invokes backend provider method
- Data Source: Provider queries MySQL/Redis/API as needed
- Response: Data flows back through the same chain
Example Flow
Configuration System
Guccho uses two main configuration files:Backend Configuration
guccho.backend.config.ts configures the server adapter and data sources:
UI Configuration
guccho.ui.config.ts configures frontend presentation (themes, features, branding).
Type Safety
Guccho maintains end-to-end type safety:- Generic ID Types: Adapters define
IdandScoreIdtypes (e.g.,numbervsbigint) - TRPC Inference: Client types automatically match server definitions
- Provider Contracts: Abstract classes ensure implementations match interfaces
- Transform Functions: Explicit
idToString/stringToIdconversions at boundaries
Next Steps
Backend Adapters
Learn how backend adapters work and how to create your own
TRPC Setup
Understand TRPC configuration and creating procedures