LobeHub open-source monorepo architecture map. Use when locating code layers, understanding apps/packages/src layout, business stubs, project structure, or onboarding to the repository.
An architecture map and onboarding reference for the LobeHub open-source monorepo (formerly LobeChat), a modern AI Agent Workspace hosted at github.com/lobehub/lobehub. It orients contributors to a flat monorepo layout where apps/, packages/, and src/ all sit at the repo root with no git submodules, and provides a curated (not exhaustive) map of key locations — the reader is reminded to ls the real directories since packages, stores, and route groups grow over time. The document summarizes the full tech stack: Next.js 16 with React 19, TypeScript, SPA routing via react-router-dom, @lobehub/ui and antd components with antd-style CSS-in-JS, zustand state, nuqs URL params, SWR data fetching, ahooks, dayjs, es-toolkit, type-safe tRPC, a Neon PostgreSQL database with Drizzle ORM, and Vitest testing, noting that exact versions live in the root package.json. Under apps/ it describes the cli, desktop (Electron), device-gateway, and server (the Next.js-backed backend with featureFlags, globalConfig, modules, routers, services, utils, and workflows); packages/ holds roughly 80 @lobechat/* workspace packages including agent-runtime, model-runtime, model-bank, database, and builtin-tool packages; and src/ contains the app, routes, spa entries, features, store, and business layers. An architecture table maps each layer (UI components, SPA pages, React Router, providers, stores, client services, REST and tRPC APIs, server services and modules, DB schema/model/repository, third-party libs, builtin tools, and open-source stubs) to its location, and a data-flow diagram traces React UI through store actions, client services, tRPC lambda, server services, DB models, to PostgreSQL. A final section explains the relationship to a separate private cloud SaaS repo that mounts this repo as a submodule and overrides the business stubs, clarifying that within this repo the stubs are the source of truth.
Next.js 16 with React 19 and TypeScript, SPA routing via react-router-dom, zustand for state, type-safe tRPC for APIs, and Neon PostgreSQL with Drizzle ORM, tested with Vitest.
It uses a flat layout with apps/, packages/, and src/ at the repo root and no git submodules; packages/ holds around 80 @lobechat/* workspace packages.
In apps/server (a Next.js-backed server) with tRPC routers, server services that can access the DB, and server modules that cannot; database schema, models, and repositories live under packages/database.
A separate private cloud (SaaS) repo mounts this open-source repo as a git submodule and provides implementations that override the src/business and packages/business stubs shipped here; the cloud override wins.
React UI to store actions, to a client service, to a tRPC lambda, to server services, to a DB model, and finally to PostgreSQL.
Quick Setup:
.claude/skills/Repository
lobehub/lobehub