Where to Find Lobe Chat Configuration Files: Complete Monorepo Guide
Lobe Chat configuration files are distributed across build tooling, runtime services, router definitions, and feature-specific modules throughout the monorepo, with central application settings exposed via src/services/config.ts and build-time configs residing at the repository root.
The lobehub/lobe-chat repository organizes its configuration across multiple architectural layers to separate build-time tooling from runtime behavior. Whether you are customizing the Vite bundler, modifying feature flags, or adjusting serverless edge settings, understanding the location of Lobe Chat configuration files is essential for effective customization. All files referenced below are located in the canary branch on GitHub.
Build and Tooling Configuration
Build-time settings define bundler behavior, compiler options, test runners, and container settings. These files reside at the repository root and control the development pipeline.
vite.config.ts– Configures the Vite bundler for both web and desktop builds, handling plugins, optimizations, and dev server settings.next.config.ts– Controls Next.js server-side rendering, image optimization, and experimental features.tsconfig.json– Defines global TypeScript compiler options, path mappings, and strictness rules across the monorepo.drizzle.config.ts– Supplies database ORM connection strings and migration settings for Drizzle Kit.docker-compose/*/bucket.config.json– Configures S3-compatible storage buckets for development environments, typically found indocker-compose/dev/bucket.config.json.
Central Runtime Configuration
The application-wide runtime configuration lives in src/services/config.ts. This central service exposes a config object used by both client and server code, holding global defaults such as API base URLs, theme settings, and feature toggles.
import { config } from '@/services/config';
export const ThemeSwitcher = () => {
const { theme, setTheme } = config.useTheme();
return (
<button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
Switch to {theme === 'light' ? 'dark' : 'light'} mode
</button>
);
};
Routing Configuration
Route definitions determine which pages load on desktop versus mobile devices. These configurations map route paths to layout components and are split by device type in the src/spa/router/ directory.
src/spa/router/desktopRouter.config.tsx– Desktop-specific route definitions and layout wrappers.src/spa/router/desktopRouter.config.desktop.tsx– Extended desktop routing for specific desktop builds.src/spa/router/mobileRouter.config.tsx– Mobile-optimized route definitions with touch-friendly layouts.
import { desktopRoutes } from '@/spa/router/desktopRouter.config';
desktopRoutes.push({
path: '/custom',
element: <CustomPage />,
});
Feature-Specific Configuration
Individual features maintain isolated configuration files to enable granular control without modifying global settings. These modules reside within their respective feature directories under src/features/.
src/features/DataImporter/config.ts– Controls automatic import flows and parsing options.src/features/ChatInput/ActionBar/config.ts– Defines action button visibility and behavior defaults.src/features/AgentSetting/store/reducers/config.ts– Manages agent configuration state reducers.src/components/FileIcon/config.ts– Maps file extensions to icon components.
import { dataImporterConfig } from '@/features/DataImporter/config';
if (dataImporterConfig.enableAutoImport) {
// trigger automatic import flow
}
Third-Party and Server-Side Configuration
Integration-specific settings and serverless environment variables are isolated in dedicated library and business server directories.
src/libs/oidc-provider/config.ts– OpenID Connect provider endpoints and client credentials.src/libs/better-auth/utils/config.ts– Better-Auth SDK defaults for authentication flows.src/libs/langchain/loaders/config.ts– LangChain loader parameters and model endpoints.src/business/server/lambda-routers/config.ts– Environment-specific variables for serverless lambda functions.packages/business/config/src/server/edge-config.ts– Edge-runtime configuration for Vercel Edge Functions and similar platforms.
Summary
- Build configs live at the repository root, including
vite.config.ts,next.config.ts, andtsconfig.json. - Central runtime settings are exported from
src/services/config.tsas a hook-based API consumed across the application. - Route definitions are split by device type in
src/spa/router/with separate files for desktop and mobile. - Feature modules contain localized configs like
src/features/DataImporter/config.tsfor granular control. - Third-party integrations and serverless edge settings are isolated in
src/libs/andsrc/business/server/respectively.
Frequently Asked Questions
Where is the main configuration file in Lobe Chat?
There is no single monolithic configuration file. Instead, the central runtime configuration is located at src/services/config.ts, which exports a config object used by both client components and server logic. Build-specific settings reside in root-level files like vite.config.ts and next.config.ts.
How do I modify build settings like the bundler or TypeScript compiler?
Edit the root-level configuration files according to the tool you need to adjust. Modify vite.config.ts for bundler behavior, next.config.ts for Next.js server settings, tsconfig.json for TypeScript compiler options, and drizzle.config.ts for database connection parameters.
Can I configure feature-specific behavior without changing global settings?
Yes, feature modules export localized configuration objects that allow independent customization. Files such as src/features/DataImporter/config.ts and src/features/ChatInput/ActionBar/config.ts provide granular control over specific functionality without affecting the global service configuration.
Where are serverless and edge runtime configurations stored?
Edge and lambda configurations reside in src/business/server/lambda-routers/config.ts and packages/business/config/src/server/edge-config.ts. These files supply environment-specific variables and runtime settings for serverless functions deployed to edge networks.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →