Application Configuration
Configure and customize the Next.js Prisma SaaS Kit for your application's needs including branding, settings, and features.
Configure your MakerKit application through environment variables and TypeScript config files - no core code changes required.
MakerKit uses environment variables (.env files) for runtime settings like database URLs, API keys, and feature toggles. TypeScript config files in apps/web/config/ handle complex structures like navigation menus. Set NEXT_PUBLIC_* variables for client-accessible values; keep secrets in .env.local (git-ignored). Configuration sources cascade by priority: .env.local overrides .env.development, which overrides .env.
Configuration in MakerKit refers to the centralized settings that control your app's behavior, branding, features, and integrations. All configuration is type-safe (validated with Zod at build time).
Quick Start
Most configuration happens through environment variables in your .env files:
# Essential settings (apps/web/.env)NEXT_PUBLIC_PRODUCT_NAME="Your SaaS"NEXT_PUBLIC_SITE_URL="http://localhost:3000"NEXT_PUBLIC_ACCOUNT_MODE="hybrid"DATABASE_URL="postgresql://..."BETTER_AUTH_SECRET="your-32-char-secret"Use environment variables when: you need different values per environment (dev/staging/prod), the value contains secrets, or you want to change settings without redeploying.
Use config files when: you need complex objects, TypeScript validation, or the setting requires code (like React components in navigation).
If unsure: start with environment variables - you can always refactor later.
Configuration Architecture
Configuration Sources (Priority: High → Low)├── .env.local # Local secrets (git-ignored)├── .env.development # Dev defaults (committed)├── .env # Shared defaults (committed)├── apps/web/config/ # TypeScript configs└── Package defaults # Sensible fallbacksHigher-priority sources override lower ones. For example, a value in .env.local overrides the same key in .env.
Configuration Areas
| Area | File/Variable | Purpose |
|---|---|---|
| App Settings | NEXT_PUBLIC_* vars | Branding, URLs, themes |
| Environment Variables | .env files | All runtime settings |
| Account Modes | NEXT_PUBLIC_ACCOUNT_MODE | B2B vs B2C vs hybrid |
| Feature Flags | feature-flags.config.ts | Toggle functionality |
| Navigation | *-navigation.config.tsx | Menus and sidebars |
Common Pitfalls
- Forgetting to restart the dev server after changing
.envfiles - Next.js only reads env vars at startup - Using
NEXT_PUBLIC_prefix for secrets - these are exposed to the browser; never prefix sensitive values - Trailing slashes in
SITE_URL- causes broken OAuth redirects and canonical URLs; always omit the trailing slash - Mismatched env files across team members - use
.env.exampleas a template and document required variables - Hardcoding values that should be configurable - if it might change per environment, use an env var
Principles
The configuration system follows these patterns:
- Convention over configuration: Sensible defaults work out of the box. Only change what you need.
- Environment-based: Development and production use different files. Secrets stay in
.env.local. - Type-safe: All config files use Zod schemas. Typos and invalid values fail at build time.
- Centralized: Config lives in
apps/web/config/and.envfiles. No hunting through the codebase.
Configuration Topics
Explore each area in detail:
- App Configuration: Product name, site URL, theme, locale settings
- Environment Variables: Complete reference for all variables
- Account Modes: Personal-only, organizations-only, or hybrid
- Feature Flags: Enable/disable features without code changes
- Navigation: Header, footer, and sidebar menu structure
Next: App Configuration →