Configuration System
Flexible configuration with config files, environment variables, and TypeScript support.
Core Systems
Configuration
MoroJS provides a powerful configuration system that supports config files, environment variables, TypeScript, and module-specific configuration with proper priority handling and type safety.
Overview
MoroJS provides a powerful configuration system that supports config files, environment variables, TypeScript, and module-specific configuration with proper priority handling and type safety.
Config Files
moro.config.js or moro.config.ts support
Environment Override
Environment variables take precedence
TypeScript Support
Full type safety and IDE autocompletion
Module Configuration
createModuleConfig() for module-specific settings
Configuration Priority
Loading Order (Highest to Lowest Priority)
- 1Environment Variables (highest priority)
- 2Configuration Files (moro.config.js or moro.config.ts)
- 3Schema Defaults (lowest priority)
Basic Configuration File
Create a moro.config.js file in your project root for zero-setup configuration. Perfect for JavaScript projects.
TypeScript Configuration
Use moro.config.ts for full type safety, IDE autocompletion, and validation. Import the AppConfig type for complete type checking.
Module Configuration
Create module-specific configuration with Zod validation, default values, and environment variable override support. Perfect for reusable modules.
Environment Variables
Environment variables have the highest priority and will override config file settings. Perfect for deployment-specific configuration and secrets.
Configuration Features
Core Features
- Automatic configuration discovery
- Environment variable override
- TypeScript support with full typing
- Zod schema validation
- Backward compatibility
Advanced Features
- Module-specific configuration
- Environment prefix support
- Automatic type coercion
- Configuration priority handling
- IDE autocompletion support