App Configuration
Configure app name, site sections, themes, and organization settings.
The app configuration file (config/app.config.ts) contains application-wide settings including the app name, site sections, theme configuration, and organization settings.
Configuration File
import { getBaseUrl } from '@/lib/utils';
export const appConfig = {
appName: 'Acme',
description: `Acme's description`,
baseUrl: getBaseUrl(),
// Contact information (displayed on contact page)
contact: {
enabled: true,
email: 'hello@yourdomain.com',
phone: '(123) 456-7890',
address: '123 Main St, San Francisco, CA'
},
// Site sections - enable/disable major parts of the site
site: {
// Marketing website (landing page, blog, docs, etc.)
// When disabled, all marketing routes redirect to /dashboard
marketing: {
enabled: true
},
// SaaS application (dashboard, auth, etc.)
// When disabled, all /dashboard and /auth routes redirect to marketing homepage
saas: {
enabled: true
}
},
// Theme configuration
theme: {
// Default theme for new users: "light", "dark", or "system"
default: 'system' as const,
// Available themes users can choose from
available: ['light', 'dark'] as const
},
// Organization settings
organizations: {
// Allow regular users to create organizations
// When false, only admins can create organizations
allowUserCreation: true
},
// Pagination defaults
pagination: {
// Default page size for lists
defaultLimit: 20,
// Maximum allowed page size
maxLimit: 100
}
} satisfies AppConfig;Configuration Options
App Information
appName: The name of your application, displayed throughout the UIdescription: A brief description of your applicationbaseUrl: The base URL of your application (automatically detected)
Contact Information
The contact object configures contact information displayed on the contact page:
enabled: Whether the contact form is enabledemail: Contact email addressphone: Contact phone numberaddress: Physical address
Site Sections
The site object controls which parts of your application are enabled:
marketing.enabled: Enable/disable the marketing website (landing page, blog, docs)- When disabled, all marketing routes redirect to
/dashboard
- When disabled, all marketing routes redirect to
saas.enabled: Enable/disable the SaaS application (dashboard, auth)- When disabled, all
/dashboardand/authroutes redirect to marketing homepage
- When disabled, all
Theme Configuration
The theme object controls theme settings:
default: Default theme for new users ("light","dark", or"system")available: Array of themes users can choose from
Organization Settings
The organizations object controls organization-related features:
allowUserCreation: Whether regular users can create organizations- When
false, only admins can create organizations
- When
Pagination
The pagination object sets default pagination values:
defaultLimit: Default number of items per pagemaxLimit: Maximum allowed items per page
Use Cases
Deploy Marketing Site Only
To deploy only the marketing site without the SaaS application:
export const appConfig = {
// ... other config
site: {
marketing: {
enabled: true
},
saas: {
enabled: false // Disables SaaS routes
}
}
};Deploy SaaS Application Only
To deploy only the SaaS application without the marketing site:
export const appConfig = {
// ... other config
site: {
marketing: {
enabled: false // Disables marketing routes
},
saas: {
enabled: true
}
}
};Restrict Organization Creation
To allow only admins to create organizations:
export const appConfig = {
// ... other config
organizations: {
allowUserCreation: false // Only admins can create organizations
}
};Customize Theme Options
To customize available themes:
export const appConfig = {
// ... other config
theme: {
default: 'dark' as const,
available: ['light', 'dark', 'system'] as const
}
};Type Definitions
The configuration uses TypeScript types for type safety:
export type ContactConfig = {
enabled: boolean;
email: string;
phone: string;
address: string;
};
export type SiteConfig = {
marketing: {
enabled: boolean;
};
saas: {
enabled: boolean;
};
};
export type ThemeConfig = {
default: 'light' | 'dark' | 'system';
available: readonly ('light' | 'dark')[];
};
export type OrganizationsConfig = {
allowUserCreation: boolean;
};
export type PaginationConfig = {
defaultLimit: number;
maxLimit: number;
};
export type AppConfig = {
appName: string;
description: string;
baseUrl: string;
contact: ContactConfig;
site: SiteConfig;
theme: ThemeConfig;
organizations: OrganizationsConfig;
pagination: PaginationConfig;
};Using the Configuration
Import and use the configuration in your code:
import { appConfig } from "@/config/app.config";
export function AppHeader() {
return <h1>{appConfig.appName}</h1>;
}import { appConfig } from '@/config/app.config';
export function getDefaultLimit() {
return appConfig.pagination.defaultLimit;
}