File Structure Guide
Understanding the project structure helps you navigate the codebase and make customizations. This guide explains the organization of files and directories.
Root Directory Structure
The project root contains configuration files, documentation, and main directories:
App Directory (/app)
The app directory contains all Next.js pages and API routes using the App Router structure:
Domain Routes (/app/[domain])
Admin Routes (/app/admin)
API Routes (/app/api)
Components Directory (/components)
React components organized by functionality:
Library Directory (/lib)
Core libraries and utilities:
Scripts Directory (/scripts)
Database migration and utility scripts:
Public Directory (/public)
Static assets served directly:
Key Files Explained
proxy.ts
The core domain routing system. This file intercepts all requests, extracts the domain from the Host header, and routes to domain-specific pages. This is what enables multi-domain functionality.
lib/db/schema.ts
Defines all database tables and relationships using Drizzle ORM. This is where you'll find the structure of domains, posts, categories, themes, plugins, etc.
lib/plugins/core/
Core plugin system files. The plugin manager, registry, hooks system, and type definitions are here. This is the foundation of the extensible plugin architecture.
app/[domain]/layout.tsx
Domain-specific layout that injects theme CSS and applies domain configuration. This is where domain isolation happens at the presentation layer.
next.config.ts
Next.js configuration. Currently configures image domains for remote images. You can add custom configurations here.
Understanding the Domain Routing
The platform uses a proxy-based routing system:
- Request arrives with
Host: example.com proxy.tsintercepts the request- Domain is extracted and looked up in database
- URL is rewritten from
/blog/post-slugto/example.com/blog/post-slug - Domain layout applies theme and configuration
- Page component renders with domain-isolated data
Making Customizations
Theme Customization
To customize themes:
- Edit theme colors/fonts in Admin > Themes (no code required)
- For advanced customization, modify
lib/themes/utils.ts - CSS is generated dynamically from theme settings
Component Customization
To customize components:
- Edit files in
components/directory - Components are React/TypeScript
- Changes require rebuilding the application
Adding Custom Routes
To add custom routes:
- Create new files in
app/[domain]/orapp/admin/ - Follow Next.js App Router conventions
- Use
page.tsxfor pages,route.tsfor API routes
Next Steps
Now that you understand the file structure: