Developers · Setup
Codebase Introduction
Last updated 2 November 2026
The Insites codebase is the collection of files that make up your application. It includes backend logic, frontend templates, database schemas, configuration, and static assets. You write code locally and sync or deploy it to an Insites instance using the CLI.
This guide covers the required directory structure and explains what each directory and file type does. Getting this structure right is essential because the Insites engine reads specific directories to know how to build your application.
Required Directory Structure
Put the site itself in the
| Directory/File | File Type | Description |
|---|---|---|
| JSON | The CLI configuration file. Stores your environments (such as staging and production) and how you sign in to each. It holds your Insites Console sign-in, not the instance key. Created when you add an environment with |
|
| YAML | Optional settings for the linter, |
|
| assets | Asset | Static files like fonts, images, stylesheets, and scripts. |
| authorization_policies | Liquid | Access control rules. Authorization policies define who can access a page or submit a form. |
| schema | YAML | Database table definitions. Each |
| emails | Liquid | Email notification templates. |
| api_calls | Liquid | API call notification definitions for integrating with third-party services. |
| smses | Liquid | SMS notification templates. |
| graphql | GraphQL | Query and mutation files. Each |
| views/pages | Liquid | Page files. Each page maps to a URL and defines what happens when that URL is requested. |
| views/layouts | Liquid | Layout wrappers. Layouts provide consistent outer structure (header, footer) shared across pages. |
| views/partials | Liquid | Reusable template snippets. Partials contain HTML, UI components, and presentation logic. |
| translations | YAML | Translation files for multilingual sites. Also used for date formats, flash messages, and default error messages. |
| user_profile_types | YAML | User profile definitions. Each instance includes a default user role. Additional profile types can be defined here for different user roles. |
| user.yml | YAML | Properties shared across all users on the instance. |
| config.yml | YAML | Application configuration flags. See config.yml for the full reference. |
| forms | Liquid | Form definitions that control data persistence, validation, authorization, and notifications on submission. |
| migrations | Liquid | One-time scripts that run during deployment. Used for data migrations and seed data. |
Views: Pages, Layouts, and Partials
The
Pages are the entry points for every URL in your application. Each page file maps to a route and handles an HTTP method (GET, POST, PUT, DELETE). Pages fetch data via GraphQL and delegate rendering to partials.
Insites supports multiple content types beyond HTML. You can create JSON endpoints, JavaScript endpoints, PDF generators, RSS feeds, and more by using the appropriate file extension:
| Extension | Content Type | URL |
|---|---|---|
| text/html | /path | |
| application/json | /path.json | |
| application/javascript | /path.js |
Layouts are wrappers around page content. They hold the outer HTML structure that stays consistent across pages, like headers, footers, and navigation. Without layouts, you would duplicate this code on every page. You can create multiple layouts and assign each page to the layout it needs.
Partials are reusable code snippets. They contain your HTML templates, UI components, and presentation logic. Use the
app
|-- views
|-- layouts
| |-- 1col.html.liquid
|-- pages
| |-- index.html.liquid
| |-- unauthorized.html.liquid
|-- partials
|-- layout
|-- constants.liquid
|-- foot.liquid
|-- footer.liquid
|-- head.liquid
|-- header.liquidAssets
The
While only the top-level
app
|-- assets
|-- fonts
|-- images
| |-- favicon.ico
|-- scripts
| |-- app.js
| |-- vendor.js
|-- styles
|-- app.css
|-- vendor.cssMigrations
Migrations are Liquid files that run once per environment during a deployment. They are useful for modifying existing data when you change a schema, setting initial values, or seeding data.
Migration filenames must follow the pattern
app
|-- migrations
|-- 20200811133711_set_superadmins.liquid
|-- 20210114080833_set_defaults_for_country.liquidForms
Forms are the primary tool for persisting data, running validation, enforcing authorization, and triggering notifications. They give you control over which fields can be saved, who can submit the form, what happens on successful submission (redirect, send email, call an API), and what validation rules apply.
You can also define synchronous or asynchronous callbacks using GraphQL mutations for additional processing after a form is submitted.
app
|-- forms
|-- create_contact_request_form.liquid
|-- feedback_form.liquidUsers
Users are identified by their unique email address. You can define properties that apply to all users in the
app
|-- user.yml
|-- user_profile_types
|-- default.ymlDatabase Schema
Tables define the structure of your application's data. Each
app
|-- schema
|-- blog_post.ymlNotifications
Notifications are messages sent when specific events occur. They can be emails, SMS messages, or programmatic API calls to third-party services. Each notification type has its own directory:
app
|-- api_calls
| |-- ping_example_com_on_user_sign_up.liquid
|-- emails
| |-- welcome_user.liquid
|-- smses
|-- welcome_user.liquidAuthorization Policies
Authorization policies control who can access pages and submit forms. Each policy is a Liquid file that evaluates to true or false. You can attach multiple policies to a single page or form, and they are checked in the order they appear in the configuration.
When a policy check fails, the system either redirects the user to a URL you specify or returns an error status (such as 403 Forbidden).
app
|-- authorization_policies
|-- example_policy.liquidTranslations
Translation files support multilingual sites and also define date formats, flash messages, and system-wide default error messages. Each YAML file contains a map of translation keys that you reference in your templates using the
app
|-- translations
|-- en.yml
|-- pl.ymlModules
Modules allow code reuse and sharing across projects while protecting the intellectual property of creators. The
Module code is split into
modules
|-- my_admin
|-- private
| |-- graphql
| |-- get_records.graphql
| |-- get_pages.graphql
|-- public
|-- views
|-- pages
|-- admin.liquid