Best Practices
Creating templates can get complex, but these best practices will help you create templates that are easy to use and maintain.
Checklist
Depending on the type of template, there are different things to consider:
Template Icons
Template icons are important for branding and recognition, as they give the template a more professional look and feel.
Always use 1:1 aspect ratio icons or logos with transparent backgrounds.
Transparent backgrounds ensure logos integrate seamlessly with dFlow's interface and provide a more polished, professional appearance.
Naming Conventions
Naming conventions are important for readability and consistency; using proper names enhances the overall quality and credibility of your template.
Always follow the naming conventions for the software that the template is made for.
Example, if the template is for ClickHouse, template name should be named ClickHouse with a capital C and H, since that is how the brand name is spelled.
For services,
- Use lower case.
- Avoid using special characters.
- If a space is included in the service name, it will automatically be replaced with a
-
. - Prefer shorter names over longer names for better readability.
- Keep names concise while maintaining clarity.
Environment Variables
Properly set up environment variables are a great way to increase the usability of your template.
When using environment variables:
For any secrets, passwords, keys, etc., use template variable functions to generate them, avoid hardcoding default credentials at all costs.
Use reference variables when possible for dynamic service configuration.
Include helpful pre-built variables that the user may need, such as database connection strings, API keys, hostnames, ports, and so on.
Persistant Storage
Persistent storage is essential for templates that include file servers, or other stateful services that need to retain data across deployments.
Always include a volume for these services.
Without persistent storage, data will be lost between redeployments, leading to unrecoverable data loss for template users.
When configuring the service, ensure the volume is mounted to the correct path. An incorrect mount path will prevent data from being stored in the volume.
For more details, see the volumes guide.
Dry Code
This is most applicable to templates that deploy from GitHub.
When creating templates that deploy from GitHub, include only the essential files needed for deployment. Avoid unnecessary documentation, example files, or unused code and configurations that don't contribute to the core functionality.
A clean, minimal repository helps users quickly understand the template's structure and make customizations when needed.