Configuration
Config Parameters
Config Parameters provide a powerful way to manage your application's runtime behavior directly from Firestore. Use them to control feature flags, manage configuration settings, or store any dynamic values that your application needs to query.
Why Use Config Parameters?
While Firebase offers Remote Config, it comes with certain limitations. Dogen Config Parameters on the other hand are stored in a dedicated collection in your Firestore database, making them easy to manage and query. They provide a more robust alternative with:
- Full type safety and schema validation
- Support for complex, nested data structures
- Integration with your existing Firestore data model
- No hard limits on the number of fetches, number of parameters, and so on.
However, Firebase Remote Config is still a powerful product with its own unique strengths, and depending on your needs, you might want to use Remote Config, Dogen Config Parameters, or even both in combination to achieve your specific goals.
Common Use Cases
Feature Flags
Control feature availability in your application without deploying new code. Perfect for:
- A/B testing
- Gradual feature rollouts
- Beta program management
Application Settings
Manage application-wide settings that need to be easily updated:
- API endpoints
- Service configurations
- Global parameters
Complex Configurations
For more sophisticated needs, create structured configuration objects by leveraging Dogen's entity types. Your application can query these values from Firestore to control complex behaviors.
Your application can query these parameters directly from Firestore to enable dynamic behavior changes without redeployment.
For example, check if a feature flag is enabled before showing new functionality, or load service configurations at startup.
Creating Parameters
Start by creating a Config Parameter Blueprint. You can make it as simple or complex as needed:

- Use simple types for basic flags and values
- Leverage Embedded Entities for reusable structured data
- Create Lists or Maps for collections of values
Managing Parameters
Once you've created your Config Parameters, you can manage them directly in the Config section, under the Parameters tab:

Here you can view and modify parameters. Clicking on the "Launch" parameter lets us modify it:

Entity Configuration
The Entity Configuration section provides field-level control over Object and Embedded Entities in your application. This include Dogen's internal entities. This means you can set default values, validation rules, and UI settings for each field of each entity.

Available Configurations
Default Values
Set initial values for fields when creating new entities.
Validation Rules
Define custom validation rules for each field to ensure data integrity.
Preview Settings
Configure UI options:
- Hide fields from preview
- Set colors, font options, and more.
Entity List Page Settings
Configure options:
- Set sort order
- Set items shown per page
Example: Adding Field Validation
Let's walk through adding a validation rule to make the "description" field on Object Entity Blueprints require a minimum length of 10 characters. Keep in mind this field is normally optional.
To start, go to the Config section, and select the Entities tab. Next, click on the "Object Entity" type.

Next click on the "validations" field and specify a minimum length for the description field:

Once you save this configuration, any attempt to create a new Object Entity Blueprint with a description shorter than 10 characters will display the following validation error:

Example: Setting Default Values
Here's how to set a default category value for all new Products:
Start by going to the Config section, and select the Entities tab. Next, click on the "Product" type.

Next click on the "Value" field and specify a default category value:

After saving, any new Product forms will automatically have the category pre-selected with this default value:

Configuration changes should take effect immediately upon saving without requiring a generation. However, if you don't see your changes reflected try refreshing your browser window.
While most types do support configuration, some entities and types may not support it at this time. Stay tuned for updates on this feature.