Create a site
A site is the root record of everything else: its content, its templates, its theme, its domains and its search settings all belong to one site. Two things have to exist before a page can be served — an application you own, and a site record on a deployment that serves it. This page covers the first: scaffolding the application and running it locally, with no database and no deployment. Provisioning the site record is a deployment step.
Scaffold
npm install -g @snolla/cli
snolla init my-site --stack tailwind --yes
cd my-site
init ends by printing the directory it wrote and the site identifier it generated for the local
application. The same identifier is written into snolla.config.json as siteId, and snolla dev
serves the site under it. A site provisioned on a deployment has its own record with its own
identifier — that one is what the instance gets, not this local one.
Without --yes and with missing options it asks: site slug, CSS stack, theme name, build target.
| Option | Meaning |
|---|---|
--stack <css> |
Theme CSS stack: sass (Bootstrap) or tailwind. Default sass |
--theme <name> |
Active theme name. Default default |
--target <target> |
snolla — served by the platform, or static — a pre-rendered build. Default snolla |
--site-id <uuid> |
Site identifier. Default: a random UUID |
--dir <path> |
Target directory. Default ./<site> |
--force |
Scaffold into a directory that is not empty |
-y, --yes |
Accept the defaults, ask nothing |
The site slug must be lowercase letters, digits and dashes. The directory it names must be empty,
unless --force says otherwise.
What you own now
| Path | What it is |
|---|---|
package.json |
Scripts dev and start; the engine @snolla/web is a dependency |
snolla.config.json |
Site name, identifier, theme, build target, theme stack |
index.js |
The engine boot: initApp, then the middlewares this site serves (content pages, catalog, storefront, blog, forms, assets, search) |
config/default.json |
Runtime config, no secrets: dialect, storage, image handling, mail transport |
config/custom-environment-variables.json |
Which environment variable fills which config key |
.env.example |
The variables to copy into .env; never commit .env |
fixtures/templates/landing.template.json |
One template: the shape of a page |
fixtures/pages/home.json |
One page built from that template, at / |
views/landing.liquid |
The template's markup, named after its alias |
views/layouts/theme.liquid, views/partials/ |
The page shell and its parts |
assets/js/main.js, assets/css/main.css or assets/scss/main.scss |
Front-end entry points |
vite.config.js |
Build of the front-end assets |
The engine serves the site; Liquid renders it. A template declares fields, a fixture or a content record fills them, and the Liquid file prints them.
Run it
npm install
snolla dev
snolla dev runs the front end with hot reload on port 5173 and the engine on port 5000,
reading pages and templates from fixtures/ — no database is involved. Open
http://localhost:5173: that is the front end, and it reaches the engine for you. The scaffolded
home page is at /. Add --open to bring the browser there yourself; the rest of the options are
in the CLI reference.
A database connection is not needed until the site leaves your machine. config/default.json
already names the dialect and the storage; the DSN, the site URL and the port arrive from the
environment, so a password never lands in the repository.
Next
- Templates are created through the admin API — the endpoints are listed in the Admin API reference.
- Generate a typed client — typed models from those templates, as you add them.
- Registering the site on a deployment, and the credentials that go with it, is a deployment step: the site is provisioned there, not on your machine — see Sites and instances.