Codebase Introduction

Last updated on April 04, 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

The root of your project must contain the directory. This is where the Insites engine looks for your application code. A directory sits alongside it if your project uses modules.

Directory/File File Type Description
JSON The CLI configuration file. Stores your environment endpoints (staging, production) and authentication tokens. Created when you run .
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 file defines a table with its fields, types, and associations.
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 file defines one GraphQL operation for reading from or writing to the database.
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 directory contains three subdirectories, each with a distinct role:

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 tag to include a partial for HTML output, or the tag to invoke a partial that returns data.

Assets

The directory holds static files that the web server serves directly without any backend processing. This includes JavaScript files, CSS stylesheets, images, fonts, documents, and media files.

While only the top-level directory is required, we recommend organizing files into subdirectories:

Migrations

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 . The timestamp ensures uniqueness and controls execution order. Generate a new migration with:

Forms

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.

Users

Users are identified by their unique email address. You can define properties that apply to all users in the file, and create different user profile types in the directory for role-based access and custom fields.

Database Schema

Tables define the structure of your application's data. Each file in the directory creates a table with its fields and types. Think of tables as custom database tables that you define through YAML configuration.

Notifications

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:

Authorization 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).

Translations

Translation files support multilingual sites and are also used to 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 filter.

Modules

Modules allow code reuse and sharing across projects while protecting the intellectual property of creators. The directory sits at the same level as .

Module code is split into and directories. Both have the same structure as the directory. When developers pull a module from an instance, they only receive the public files. Private files remain on the server.

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.