The build server for web apps.

Built for humans, and their AI agents.

Elements is a build server, app framework, Postgres database and deployment, engineered as one system.

curl -fsSL https://elements.dev/install | sh
View script

Read the getting started guide.

EditorsAgentsTerminals$elements build$elements test$elements install$elements deployBuild serverOne build state shared by every clientSyncConfigInstallCrawlCheckEmitTestMigrateReleaseFile watcherwatchreleaseAppyour codeapp frameworkPostgresdeployYour serversover SSH

Tools

Every command connects to the build server that is already running, so no command starts from nothing. Every command takes -json for your agent.

  • Config
  • Install
  • Build
  • Migrate
  • Test
  • Deploy

Build server

Holds one build state in memory, as one source graph, for every client. Builds in milliseconds and answers in microseconds.

Phases of a build

  1. Sync
  2. Config
  3. Install
  4. Crawl
  5. Check
  6. Emit
  7. Test
  8. Migrate
  9. Release

Infrastructure

  • File watcher
  • File tree
  • Resolver
  • Source graph
  • Type checker
  • Program analysis
  • Hot reload
  • LSP

App framework

HTML and TypeScript, type checked as one program. The browser calls a server function directly, and server code cannot reach the browser.

  • HTML
  • Routing
  • RPC
  • Sessions
  • SQL
  • Transactions
  • Live tables
  • Channels
  • Jobs
  • Cron
  • Email
  • Payments

Postgres

The database for your app, already running. A migration is a SQL file, and the build server applies it when you save it, to the test database first.

Deployment

One command deploys to servers you control. The tests pass on the server before the release goes live, and only the changed files are sent.

  • SSH
  • Clusters
  • Load balancer
  • TLS certificates
  • Domains
  • Maintenance page

Build server

The build server stays running and holds the build state in memory, as one source graph. Your terminal, your editor and your agents all connect to the same build server and read the same build. It watches your files and automatically runs a build when a file or a package changes. A build of one saved file takes milliseconds.

elements build
State: Ok
Elapsed: 0.000006s
j/k: down/up G/g: bottom/top y: copy q: quit

A second elements build -json against an unchanged project answers in microseconds.

elements build -json
{
"path": "/Users/cmather/elements/projects/myapp",
"ok": true,
"errorCount": 0,
"warningCount": 0,
"message": "The build is ok.",
"buildGen": 15,
"buildRanAt": "2026-09-21T12:08:15.74752-07:00",
"started": "2026-09-21T12:09:41.121451-07:00",
"finished": "2026-09-21T12:09:41.121457-07:00",
"elapsedSeconds": 0.000006
}

When code in the browser can reach a database call, the build is in the error state. The error names the file, the line and the fix.

elements build
State: Error
Elapsed: 0.000010s
ERRORS:
You have 1 error:
1. app/pages/home/template.ehtml:6:10
Security error: cannot call server code from the browser without going through an rpc
function.
Try:
Put the server code inside a function with an @rpc build tag. For example:
/**
* @rpc
*/
export function fn() {}
Then call fn().
5: function onSignIn(email: string) {
6: return db.query`select id from users where email = ${email}`.first();
7: }
Call stack:
2. app/pages/home/template.ehtml:6:10 sql
1. app/pages/home/template.ehtml:32:49 onSignIn
j/k: down/up G/g: bottom/top y: copy q: quit
  • One source graph. Every phase, your editor, your terminal and your agents read one source graph, in memory. Each file is read once and parsed once. The graph has four views of those files: server runtime, server types, browser runtime and browser types. The disk is one layer, and each editor has a layer for its unsaved text.
  • Tests pass before the app database changes. The Test phase migrates the test database and runs the tests. The Migrate phase changes the app database, and it runs only if the tests pass.
  • Already built when you ask. The build has run by the time you or your agent asks for the result: type check, program analysis, migrations and tests.
  • One set of diagnostics. Your editor, your terminal and your agents read the same diagnostics from the build server.
  • Server code cannot reach the browser. A database call that the browser can reach is a build error, and a build with an error is never released.
  • Tests are part of the build. A test file is rerun when its code or its imports change, and each test runs in a transaction that rolls back. A typical test takes a few milliseconds: fast enough that tests stop being the thing you write to be compliant and start being how you find out what you broke.
  • Check after every change. The build server holds the build state in memory, so checking costs microseconds instead of seconds, and you and your agent can check after every change rather than at the end. Your agent corrects the code before reporting the work finished.
  • Packages install as part of the build. The package installer is npm compatible. Install a package at version local and it resolves from your package search path, gets watched like the rest of the project, and ships on deploy. No monorepo, no file links.

App framework

A page is one .ehtml file: standard HTML with TypeScript expressions. The build server type checks the page. The page is reactive: it renders on the server and updates in the browser when the data changes.

app/pages/users/template.ehtml
<html ( title: string, users: User[], )> <h1>{title}</h1> <ul> <li e:for={user of users}> {user.name} ({user.age}) </li> </ul> <p e:if={users.length === 0}>no users yet</p> <p e:else>{users.length} users</p> </html>

A function with the @rpc build tag runs on the server, and the browser calls it by name.

app/shared/services/users.ts
/** @rpc */ export function createUser(form: UserForm): User { return db.query<User>` insert into users ( name, email ) values ( ${form.name}, ${form.email} ) returning * `.firstOrThrow("insert returned no row"); }

The app framework was built for production applications, with each part there because an app needed it. Next.js and the other frameworks that accumulated their features as add-ons over the years have rendering modes, hooks and caching directives. Elements has none. The design philosophy is simple. Keep the framework's own abstractions to a minimum, so nothing gets in the way of you or your agent, and stick to the standards: HTML, TypeScript, SQL and CSS. Then give the primitives super powers. A server function is called from the browser like any function. A page is HTML that updates when its data changes. A query is SQL. A live table keeps every browser in sync.

  • Every building block an app needs. Routing that serves pages and APIs alike, rpc functions, reactive HTML, sessions, SQL and migrations, live tables, channels, jobs and email.
  • Live tables. Declare the set of rows a page needs and every browser subscribed to it stays current: insert, update or delete anywhere and the change arrives everywhere, painting locally before the server has answered.
  • A complete library of UI templates. The ui package holds the most used UI templates on the web, written in Elements HTML: dialogs, menus, command palette, forms, combobox, date and range pickers, data table, charts, kanban, and the chat templates for an AI app. Pick a theme and every template changes its look.
  • Standard HTML, made reactive. The page updates when its data changes. It renders on the server, then runs entirely in the browser: the Elements browser runtime patches only what changed, with no round trip for the interaction.
  • Jobs and email. Queue work off the request path, or schedule it. A job server starts with the project, on your machine and on every machine you deploy to. Write mail in the same Elements HTML as your pages.
  • File uploads. Bind a file input to a File or File[] and the browser reads the bytes for you. An rpc stores them in Postgres or in any object store.

Postgres

Postgres is the database for your app. A migration is a SQL file. Save the file and the build server applies it to the database.

app/migrations/20260509120000-add-comments-table.migration.sql
create table comments ( id uuid primary key default uuidGenerateV7(), createdAt timestamptz not null default now(), updatedAt timestamptz not null default now() );
elements db migrate
State: Ok
Elapsed: 0.035618s
MIGRATIONS:
node_modules/@elements/app/migrations/2026-07-11-000000-app-baseline.migration.sql [ok]
The application framework baseline migrations.
app/migrations/20260915155829-add-chat.migration.sql [ok]
add chat
j/k: down/up G/g: bottom/top y: copy q: quit
  • A migration is a .sql file. No ORM, no migration DSL, nothing to learn on top of SQL you already know, which is also why an agent writes and edits them correctly, and why you can always run one directly against a database if you need to.
  • Applied on save. The build server applies a migration to the test database before the tests run, and to the app database after.
  • Edit a migration and save again. In development, Elements restores the database to its state before that migration and applies the new version.
  • SQL in your code. Each value you put in a db.query template becomes a query parameter at build time.

Deploy

One command deploys to servers you control, peer to peer over SSH. A deploy copies only the files that changed.

elements deploy
State: Ok
Elapsed: 0.720184s
  • Tested before it goes live. On every deploy, Elements migrates the test database and runs the tests on the deploy machine. A failing test or migration stops the deploy, and the previous release keeps serving.
  • Only the files that changed. Your build server sends each machine a list of file hashes, and only the changed files are uploaded.
  • No restart. The running app hot reloads the changed modules, and every connected browser reloads with it.
  • Add a machine. Add a machine to config.jsoc and deploy. The machine joins the cluster with its own load balancer.
  • TLS certificates. Elements issues each certificate through Let's Encrypt and renews it.
  • No cold starts. Every app server is a long-running process with no cold starts, and the price per machine stays fixed. A cluster of low-cost servers serves the traffic a serverless platform meters you for.
  • Postgres, managed or on the machine. In production, point your app at a managed Postgres such as Amazon RDS by putting its connection settings in your app's config. There are no row-level security policies to write, because nothing in the browser reaches the database: queries run in server functions.
  • Your own server, with little to administer. Elements handles the provisioning and the deployment. The Elements binary, your packages, the load balancer, the certificates and every release are installed and kept current by each deploy. There is no console to configure and no pipeline to maintain.
  • Any Ubuntu server, at any provider. Elements provisions the machine, installs the load balancer and TLS certificates, builds the release, runs the migrations and hot reloads the app. Nothing to set up on the machine by hand.
  • Atomic. A deploy either succeeds completely or the release is halted. There are no partial failures: nothing reaches your users until every step has passed.
  • No queue, no container image. No queue behind a million other people's builds, and no container image to assemble and push.
  • The same fixed sequence every time. Your agent runs elements deploy -json and reads the result. It never copies files to a machine, edits a running server or restarts a service by hand, and an error in any step stops the deploy before anything changes.
  • Load balancing on every machine. Every machine runs its own load balancer and they find each other automatically. Whichever machine takes a request balances it across the cluster, with failover to the ones still answering.

Apps

You can build anything.

  • Rebuild your SaaS subscriptions. What used to cost 10 subscriptions, with different interfaces and databases, can be consolidated into a central application that you can update by talking into your phone with an AI agent.
  • Rebuild your internal tools. Your agent builds the sophisticated UI, with data tables, charts, forms and date pickers over data that stays current in every open browser. You pay per machine, not per user.
  • Products with accounts and payments. Sign-in, sessions, payments, email and background jobs are built in.
  • Stores. Stripe Checkout with one secret key. Orders, inventory and receipts live in the same database as the rest of the app.
  • AI apps. An AI assistant is a channel streaming the model's reply into the page, with the model's SDK installed from npm like any package.
  • Content and marketing sites. Content is rows in Postgres and goes live on the next request. Publishing a post is a form in your app, with no rebuild and no separate CMS. A newsletter or a CRM later is the same app.
  • Start from a demo. Every demo is a starting point. Each one has its source on GitHub, and you and your agent can create your app from it with one command.

Scale

Elements is built for one person building a business alone at a laptop, and it scales to engineering teams, enterprise applications and a team of agents on VMs.

  • Enterprise applications. Elements began at a fast growing healthcare fintech company, where a team of engineers built the company's systems on it: hundreds of millions of dollars in transactions, scaled to a multi-machine architecture with HIPAA compliant security.
  • Code any engineer can read. The code is HTML, CSS, SQL and TypeScript, so any engineer can read it, and every machine runs the same build with the same checks.
  • A person, a team, an agent, or a team of agents. An agent needs exactly the same thing as an engineer: one build server, the same build state and the same diagnostics. The same architecture serves all of them.
  • The build matters more the larger the app gets. You or your agent can change a schema in a codebase nobody remembers and find out immediately that it broke something three files away. An app you released six months ago is still one you can change with confidence.

No lock-in

You pay for Elements, and you own everything you build.

  • MIT licensed runtime packages. The tooling is the build server, the build, the test runner and deploy. @elements/app is MIT licensed, and it has the runtime your Elements HTML runs on. @elements/ui is MIT licensed too. A built app runs on plain Node.js.
  • Standard languages you and your agent already know. Elements was built with painstaking care to stay on standards. Pages are plain HTML in .ehtml files. The only new syntax is a constructor, expressions in braces and a few directive attributes, so anyone who knows HTML can read and change them: easier to maintain than a React component. Logic is TypeScript, queries and migrations are SQL on Postgres, and styles are CSS. Agents have read more of these languages than any framework's own, so they write them well. There is no ORM between you, your agent and the database: no ORM API to learn or get wrong, only SQL your agent writes fluently and you can read.
  • A modular package system. The app framework is one package and the ui package is another. You add a package to your app with the elements install command, and any package from the npm ecosystem installs the same way.
  • Any agent, any model. Elements works with any agent and any model. Use the agent you have today and switch when a better one comes out.
  • Pay for Elements, not for your success. Elements is one subscription per machine, and that is the price, however far the app grows. You keep the agent subscription you already have, with no credits per prompt. The price is not based on traffic, requests or revenue, and you deploy to servers you control.
  • Start a real app on the free trial. A real app, not a sandbox: the database, sessions, jobs, email and deploy are there from the first prompt. Everything you and your agent write is yours, in standard languages any developer or agent can keep building on.
  • Community, without gatekeepers. We value the people building on Elements. We do not value gatekeepers. In the age of AI, what matters is standard languages and concepts, not framework abstractions only insiders can read. What you learn building on Elements is HTML, TypeScript, SQL and CSS, and it goes wherever you go.

Issues

Elements has an issue tracker built for agents. When you or your agent has a question, an idea or a bug to report, your agent files an issue from the terminal, and every issue is looked at automatically.

  • Filed by your agent. elements issue new files a question, an idea or a bug from the terminal, with no browser. Every issue command takes -json. Your agent tells you in one line what it filed and continues your task.
  • Fixed in a release. The Elements Team reads every report. A fix or an improvement is released to every project in a later release, yours included.
  • The state of every issue. elements issue list shows the issues you filed and the state of each one: in progress, resolved, or released in a version. The weekly email lists your issues that changed state.
  • None of your code is sent. A report describes how Elements behaved. It includes none of your code or files unless you say so. Your agent asks you to sign in once with elements login before it files a report.
  • Trials count as much as paid accounts. A question asked in the first hour with Elements gets the same attention as one from a paid account.
  • Each project makes the next one easier to build. An agent building an app reads every diagnostic and every manual page it uses, so its ideas are specific. Each report goes into the work on the next release.

Answers

  • You pay for tooling, not for hosting. Elements gets paid for the tooling you use: the build server, the test runner and deploy. Elements does not get paid by holding your app hostage. Other frameworks, such as Next.js, are free because the company that makes the framework sells the hosting. You pay that company when your app runs on its servers, and the bill grows as your app does. The price of Elements does not change with your traffic.
  • Your agent reads the manual on your machine. The manual ships in the elements binary and matches the installed version, and elements create writes an AGENTS.md into the project that tells your agent to read the manual. When the agent writes a mistake, the build reports the file, the line and the fix, and the agent corrects the code before reporting the work finished.
  • Agents don't need framework ecosystems. Packages are great: your agent can install any npm package in Elements, from Stripe's SDK to a charting library. What an agent doesn't need is a framework ecosystem: the layer of adapters and wrapper libraries that frameworks like React and Next.js depend on for auth, data, forms and state. Each one is another API, with its own versions and conventions, for your agent to learn and get wrong. That layer mattered when humans wrote most of the code, because it meant answers to framework-specific problems and people to hire who knew the framework. What matters now is what makes the agent productive: standard languages it writes fluently, the primitives a real app needs built in, and a build that reports whether each change is correct. An Elements app has all three. Read Ecosystems in the era of AI.
  • A complete UI library, built in. The ui package is a complete library of UI templates written in Elements HTML, from a combobox and a data table to charts, chat and two editors, RichText and CodeEditor. The templates are built on the browser's own elements where the browser has one, so keyboard, touch and accessibility come from the browser vendors. The templates are installed and type checked, with nothing from a third party to connect. Any package from the npm ecosystem installs with elements install. Stay on a React framework only to keep React components you already have.
  • Any engineer can work on an Elements app. An engineer who knows HTML, TypeScript and SQL can read an Elements app and change it. The manual is on their machine, and the build server corrects a person the same way it corrects an agent.
  • Help from the terminal. elements man prints the manual for the version you have installed, and elements man -s searches it. Your agent reads the same manual, so its answers match the version in your project. You or your agent can file a question from the terminal with elements issue new -kind=question, and every question is looked at automatically. You can also ask in the community.
  • A deploy machine needs no backup. Elements provisions each machine and installs the load balancer, the TLS certificates and every release, and each deploy keeps them current. Ubuntu installs security updates on its own. A deploy machine needs no backup, because the code is in your repository and the next deploy rebuilds the release. In production your data is in a managed Postgres such as Amazon RDS, and the provider handles backups and failover.
  • You choose when to upgrade. A new version of Elements is installed when you run elements upgrade, and each release has a changelog page that lists the changes a project needs. A deploy with a failing test or a failing migration stops, and the previous release keeps serving.
  • A bug in Elements is fixed in a release. Your agent files the bug from the terminal with elements issue new, and the fix is released to every project in a later release. elements issue list shows the state of each issue you filed and the release that fixed it.
  • We will not hold your app hostage. The runtime packages are MIT licensed: @elements/app, which has the runtime your app runs on, and @elements/ui. Elements gets paid for the build tooling. An app on a free framework needs about five subscriptions to work: hosting, a database host, sign-in, background jobs and realtime. Each subscription is a vendor your app depends on, with its own bill. In Elements the database, sign-in, jobs and realtime are built in, and deploy is one command. With Elements you own everything you build: the code is HTML, TypeScript, SQL and CSS in your repository, the data is in Postgres, and the app runs on servers you control.
  • Your agent can move an app off Elements. Your agent can translate an Elements app to another framework. The pages are HTML with TypeScript expressions, the logic is TypeScript, the queries are SQL, the styles are CSS and the data is in Postgres, so translating the source code is not difficult work for an agent. Live tables and channels are part of @elements/app, which is MIT licensed, so the realtime code is yours to keep using or to port. You give up the tooling that makes building fast and safe: the build server, the type check, tests and migrations on every build, and the one command deploy.

Install

curl -fsSL https://elements.dev/install | sh
View script