C&C Docs
Log in

C&C Docs

C&C is a server-first toolkit: you write plain HTML blocks with a small set of x- attributes, they render on the server and come alive in the browser, with no build step. Every page here runs against the stack serving it.

Templates

A block is an HTML file with a few x- attributes. This is what those attributes do.

The directives

Put data on the page: text, conditions, lists, attributes, form fields, raw HTML and icons.

Blocks inside blocks

Embed one block in another and re-fetch it when its inputs change; render trees that contain themselves.

Pages

How a file on disk becomes a URL, how pages share a layout, and how a page gets its data.

Routes & layouts

blocks/*.html are the routes, the server sends each page complete, and a page wraps into a shared layout.

Links & regions

A link or a line of code swaps one named region of the page, and the address remembers it.

Data & modules

A block that answers JSON, and a module that brings widgets and code with it.

Code

A block has one controller. It runs on the server for the render, then again in the browser. Services are the code you call by name.

The block controller

The default export is the page state. $update runs before every render; a $-method runs on the server when the page calls it.

In the browser

Click handlers, event modifiers, transitions, tooltips and the init() that runs once the page is alive.

Services

Server code an app calls by name. Each call is a fresh start, runs as the caller, and reaches only the hosts it declares.

Platform services

The $-bindings every controller can call. Each is a store the platform keeps for you, with its rules built in.

$data

Rows in schemas you declare: ask for them, write them, search them.

$auth

Who is signed in. A person is a row of your own User schema.

$can and the policy

Who may read or change which rows, written as rules the app ships.

$file

Keep files people upload, show them, and let them go.

$t

Show the app in the reader’s language, dates and numbers included.

$email

Send mail, and keep a record of every message and whether it went.

$toast and $notify

Tell the person on the page now, or somebody who will read it later.

$meter

Count what your app charges for, and read it back for a bill.

$ai

Give your app an agent that works with the reader’s own data.

$device

Render the right markup for the viewer’s device on the first paint.

Widgets

Reusable components: how to write one, and the library that ships with the platform.

Writing a widget

A template, props, slots, a controller and scoped styles, built up on two small widgets.

The widget library

The widgets the platform ships, each with a live page, a spec and a playground.

Theming

A theme manifest becomes CSS variables and utilities; colour mode and the design system are one cookie each.

Theme and look

cnc.json declares the colours; the visitor picks light or dark and a design system.

Tooling

The cnc command line: scaffold, serve, test and ship.

The cnc command line

None of it runs inside an app, so this page shows the terminal: new, dev, test, deploy.