Code structure
Why code structure matters
As projects and template workflows grow, code tends to expand, change, and move around. Without a clear structure, your templates become harder to read and maintain—and you increase the risk of issues like:
- Liquid errors
- Circular reference errors
- Non-functioning templates
A solid structure helps you keep code clean, readable, maintainable, and organised—both when starting something new and when improving existing work.
What we mean by “code structure”
In the Silverfin Templating Language (as in any coding language), code structure is about where your code lives and how it is reused. For example:
- Where you store code (main template, template part, or shared part)
- Whether code is used once or reused across multiple templates
- How code is called and how dependencies are managed
- Extra considerations when working with export files
How to implement a good code structure
Start with clean, consistent formatting—this improves readability and makes reviews easier. See: Code formatting.
Next, apply structure and reuse patterns appropriate to your workflow. Below you’ll find design patterns and guidance on:
- leveraging shared parts as functions
- centralising reusable logic in shared parts
- structuring code for export files
- using common templates in workflows
- using integrations and synchs within a workflow
Visualise your code structure
For larger projects that span multiple templates and shared parts, it can be helpful to create a visual overview of your architecture.
A simple diagram showing templates, shared parts, and the links between them can help you:
- clarify and validate your structure early
- spot duplication and efficiency improvements
- onboard new team members more easily
- keep a long-term reference as the project evolves
Design patterns
Explore the patterns below:

