Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions .docs/SELF_HOSTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A step-by-step guide to running form.md on your own domain, as a private workspace for yourself, a small team or an organisation: pages, databases, boards and realtime editing, on a server you control, with the data in one encrypted folder.

This is how the form.md maintainers run their own instance. [@nodemode-ai](https://github.com/nodemode-ai) and [@gbarnai](https://github.com/gbarnai), part of the team behind FormAI, took a copy of form.md, called it formpunchlist, and put it on formai.monster as the punch list for the FormAI launch. This guide is that deployment with the names taken out, so it works for any domain.
It is written by [@nodemode-ai](https://github.com/nodemode-ai) and [@gbarnai](https://github.com/gbarnai), part of the team behind FormAI, and works for any domain.

Reference versions of the same material live in the wiki: `.docs/wiki/Self-hosting.md` and `.docs/wiki/Auth0.md`.

Expand All @@ -27,7 +27,7 @@ Reference versions of the same material live in the wiki: `.docs/wiki/Self-hosti

form.md is one binary. It serves the web app, the API and the live editing socket from one port, and keeps everything in one data folder: a SQLite database, the uploaded files and a few keys.

That shape decides the hosting. SQLite in write-ahead-log mode needs every process that touches the database to be on the same machine, and it does not work over a network filesystem ([SQLite, Write-Ahead Logging](https://www.sqlite.org/wal.html)). So form.md wants one machine with a real local disk and exactly one server process: a virtual machine, not a platform that starts and stops copies of your container. That is why formai.monster is a Compute Engine VM and not Cloud Run.
That shape decides the hosting. SQLite in write-ahead-log mode needs every process that touches the database to be on the same machine, and it does not work over a network filesystem ([SQLite, Write-Ahead Logging](https://www.sqlite.org/wal.html)). So form.md wants one machine with a real local disk and exactly one server process: a virtual machine, not a platform that starts and stops copies of your container. That is why this guide uses a Compute Engine VM and not Cloud Run.

Everything a reverse proxy would normally do, form.md does itself: it terminates TLS, gets its own certificate, redirects port 80 to HTTPS and sets the security headers.

Expand Down Expand Up @@ -195,16 +195,16 @@ Try a restore once, on a scratch machine, before you need one.

## Making it yours

This is the part where your copy starts to differ from everyone else's. What @nodemode-ai and @gbarnai changed for formai.monster is a fair picture of the range:
This is the part where your copy starts to differ from everyone else's. The range runs from settings to code:

| Change | Where it lives | Code |
|---|---|---|
| The name on the sign-in page and in mail | Instance settings, General | None |
| Themes, accent colour, fonts, page styles | Preferences and Workspace settings | None |
| Their own starting content: a launch board with a punch list, a board by owner and a dashboard | A template in `internal/templates/`, built once into the team workspace by a small package of their own | Go |
| A table kept current from the GitHub API every few minutes | A new package beside the others in `internal/`, with its settings in the admin screen | Go and TypeScript |
| An email allowlist: only two addresses may ever hold an account, be invited or be shared with | One 40-line file in `internal/auth/` and a check at each place an address enters the system | Go |
| The deploy scripts in this guide | `deploy/gcp/` | Shell, now part of form.md |
| Your own starting content, for example a project board with a task list, a board by owner and a dashboard | A page saved as a template, or a template in `internal/templates/` that a small package of your own builds once into the team workspace | None, or Go |
| A table kept current from an outside service, for example the state of your repositories read from an API every few minutes | A new package beside the others in `internal/`, with its settings in the admin screen | Go and TypeScript |
| A stricter door than invitations, for example a fixed list of email addresses that alone may hold an account, be invited or be shared with | One small file in `internal/auth/` and a check at each place an address enters the system | Go |
| Your own deploy settings | `deploy/gcp/` | Shell |

Most teams never need the code-level rows. Templates, sharing and the registration setting cover "our workspace, our people". When you do change code:

Expand All @@ -224,7 +224,7 @@ Most teams never need the code-level rows. Templates, sharing and the registrati

Out of the box, sign-in is email and password (hashed with argon2id), optional two-factor per account, a rate limit on attempts and invitation-only registration. That is sound for a small team. Putting an identity provider in front adds central control: one place to add and remove people, your company's login rules and multi-factor policy.

**Where this stands.** formai.monster does not use Auth0 yet; it is planned. form.md already signs people in through any OpenID Connect provider, and Auth0 is one, so no code is needed. But this exact pairing has not been tried against a real Auth0 tenant, so treat your first sign-in as the test, and read "Open points" in the wiki page Auth0 first.
**Where this stands.** form.md already signs people in through any OpenID Connect provider, and Auth0 is one, so no code is needed. But this exact pairing has not been tried against a real Auth0 tenant, so treat your first sign-in as the test, and read "Open points" in the wiki page Auth0 first.

In Auth0:

Expand Down Expand Up @@ -287,8 +287,7 @@ If you cannot open those ports at all, the wiki page Tunnel covers a Cloudflare

## What has and has not been run

- The deployment itself (VM, DNS, certificate, encrypted data, snapshots) is what serves formai.monster today, built from the formpunchlist copy.
- The scripts in `deploy/gcp/` here are those scripts with the names turned into variables. That edit has been syntax-checked, not run against a new project.
- The scripts in `deploy/gcp/` have been syntax-checked in this form, not run against a new project. Run `provision` on a scratch project first.
- The Auth0 section is worked out from form.md's sign-in code and Auth0's documentation, and has not been run against an Auth0 tenant.

## Sources
Expand Down
2 changes: 1 addition & 1 deletion .docs/wiki/Auth0.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

How to let people sign in to a hosted form.md through Auth0. form.md needs no Auth0-specific code for this: Auth0 is an OpenID Connect provider, and form.md already signs people in through any provider that publishes OpenID Connect discovery (Instance settings, Sign-in, **Other single sign-on (OpenID Connect)**).

**Status: not yet tried against a real Auth0 tenant.** formai.monster does not use it yet. Everything below was worked out from form.md's sign-in code and Auth0's documentation, and the one point that could not be settled from either is called out under Open points. Treat the first sign-in as the test.
**Status: not yet tried against a real Auth0 tenant.** Everything below was worked out from form.md's sign-in code and Auth0's documentation, and the one point that could not be settled from either is called out under Open points. Treat the first sign-in as the test.

## Layout

Expand Down
2 changes: 1 addition & 1 deletion .docs/wiki/Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ form.md is a self-hosted workspace where people and AI agents write documents, r
| Automatic HTTPS from Instance settings, browser backup download, update check | Working since v0.11.0 · see [[TLS-and-ACME]], [[Backup-and-restore]], [[Operations]] |
| `install.sh`, systemd unit, container image, releases through formcompiler | Written and tried locally (the image built and answered `/healthz`), **not yet exercised by a formcompiler release** · see [[Install]] |
| SAML and SCIM | Tested against a local identity provider only, not yet against Okta, Entra or Google Workspace |
| Hosting on Google Cloud with `deploy/gcp`, Auth0 through OpenID Connect | The scripts are formai.monster's with the names made into variables, syntax-checked, **not yet run** on a new project; Auth0 **not yet tried** against a tenant · see [[Self-hosting]] and [[Auth0]] |
| Hosting on Google Cloud with `deploy/gcp`, Auth0 through OpenID Connect | The scripts are syntax-checked, **not yet run** on a new project; Auth0 **not yet tried** against a tenant · see [[Self-hosting]] and [[Auth0]] |
| The first password of an account that has none (the desktop owner, accounts made by single sign-on) | Working since v0.61.1; checked against the built server, the Profile tab not yet looked at in a browser · see [[Install]] |
| AI providers | Verified against a local stand-in, not yet against live provider keys |
| Windows scripts (`*.bat`) | Written, **not yet run** on a Windows host |
Expand Down
14 changes: 2 additions & 12 deletions .docs/wiki/Self-hosting.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Self-hosting

How to put your own form.md on your own domain for a small team: one virtual machine, the server's own HTTPS certificate, an encrypted data directory, accounts by invitation. It is the set-up that runs formai.monster (the form.md maintainers' own instance, built from a fork called formpunchlist), with that fork's private additions left out. The scripts are in `deploy/gcp`; the same steps work on any Linux host with systemd.
How to put your own form.md on your own domain for a small team: one virtual machine, the server's own HTTPS certificate, an encrypted data directory, accounts by invitation. The scripts are in `deploy/gcp`; the same steps work on any Linux host with systemd.

The long, step-by-step version of this page, written for people who have never run a server, is `.docs/SELF_HOSTING.md`.

Expand Down Expand Up @@ -101,16 +101,6 @@ If you cannot open ports 80 and 443, use a tunnel instead ([[Tunnel]]).

Out of the box: passwords hashed with argon2id, two-factor sign-in per account, invitation-only registration and a sign-in rate limit, with a fail2ban filter in `deploy/fail2ban` ([[Operations]]). To put an identity provider in front, set up single sign-on in Instance settings, Sign-in: Google, Microsoft, any OpenID Connect provider, or SAML 2.0. [[Auth0]] walks through Auth0.

## What formpunchlist adds on top

formai.monster runs a fork with three additions that are not in form.md, listed here so nobody looks for them in this repository:

- An email allowlist enforced on every sign-in, account, invitation and share. The closest thing here is registration **By invitation only** or **Email domain allowed**.
- The instance name and public address seeded from the environment. Here they are set in Instance settings, General (step 6).
- A launch board template the server builds once and a table it refreshes from the GitHub API.

Everything else on that instance is form.md as documented in this wiki.

## Operations

- Logs: `sudo journalctl -u form-md -n 50` on the VM.
Expand All @@ -127,7 +117,7 @@ Everything else on that instance is form.md as documented in this wiki.
- The terminal and Claude Code panel are off on a hosted instance (`FORMMD_TERMINAL=off` in the env file): it would be a shell on the VM for the owner. Leave it off unless you want exactly that ([[Terminal-and-Claude-Code]]).
- `ship` warns, and carries on, when the start-up bundle measures over the development budget on your machine; `make build` and CI keep the hard limit.
- On another machine type or zone, pass the same `VM_NAME`, `GCP_REGION` and `GCP_ZONE` to `ship` that you passed to `provision`.
- The scripts in `deploy/gcp` are the ones that deployed formai.monster with the names made into variables. The originals ran for real; this generalised copy has been syntax-checked only.
- The scripts in `deploy/gcp` have been syntax-checked only in this form; run `provision` on a scratch project first.

## Related

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ cd form.md
> [!IMPORTANT]
> **Status:** released. form.md is built and bundled for macOS, Windows and Linux and has been tested on all three. Instance-wide settings such as mail and single sign-on live in the app's Instance settings, and the wiki in `.docs/wiki` covers install, TLS, backups and operations.

**Host it yourself:** [`.docs/SELF_HOSTING.md`](.docs/SELF_HOSTING.md) takes your own copy of form.md to your own domain for a small team, step by step: one VM, automatic HTTPS, encrypted data, accounts by invitation, with the scripts in `deploy/gcp`. It is how the maintainers' own instance runs.
**Host it yourself:** [`.docs/SELF_HOSTING.md`](.docs/SELF_HOSTING.md) takes your own copy of form.md to your own domain for a small team, step by step: one VM, automatic HTTPS, encrypted data, accounts by invitation, with the scripts in `deploy/gcp`.

**Contributing:** branch from `main`, keep changes to source here, and leave packaging and releases to FormCompiler. See [`BRANCHING.md`](BRANCHING.md) and [`AGENTS.md`](AGENTS.md).

Expand Down
14 changes: 6 additions & 8 deletions internal/HASHOUT_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,7 @@ Integration pass: Go's `ServeMux` answers a path with `..`, `.` or `//` with a 3
- kind: feature
- logged: v0.48.0 · 2026-11-03

Owner request of 2026-11-03 (first made for formpunchlist, brought back to form.md): the page header (icon, the cover, description and comment adders, title, description, tags) sits on the left by default, with a per-page choice of left, center or right. A sixth page style key, `header`, with `left` as the default, so it follows the same path as the other five: saved per page, inherited from the workspace default, kept in saved styles, and written as `data-style-header` on the root by `renderDocument` for the first frame. `left` is skipped there and in `Attrs`, like `start` and `sans`, so a default page carries no attribute. Published sites receive `data-style-header` on `.site-main` through `Attrs`, but the site stylesheet has no rule for it yet, so published pages keep their own header layout.
Owner request of 2026-11-03: the page header (icon, the cover, description and comment adders, title, description, tags) sits on the left by default, with a per-page choice of left, center or right. A sixth page style key, `header`, with `left` as the default, so it follows the same path as the other five: saved per page, inherited from the workspace default, kept in saved styles, and written as `data-style-header` on the root by `renderDocument` for the first frame. `left` is skipped there and in `Attrs`, like `start` and `sans`, so a default page carries no attribute. Published sites receive `data-style-header` on `.site-main` through `Attrs`, but the site stylesheet has no rule for it yet, so published pages keep their own header layout.

## Phase 24 · date range on database views {#p24-date-range}

Expand Down Expand Up @@ -2641,19 +2641,17 @@ Not done on purpose: no default or printed password for the desktop owner (a kno

Ran against the built server with `FORMMD_DESKTOP=1` on an empty data folder: the window enters (303), `/api/me` reads `owner@localhost`, `has_password` false; an email change with no password 403; a first password of 5 characters 400 `weak_password`; a first password with an empty current 204, then `has_password` true; a second change with an empty or a wrong current 403; the signed-out `/login` carries `data-desktop-server="true"` and the sentence; sign-in with `owner@localhost` and the new password 200; an email change with the password 200; a change with the right current 204. `go build ./...`, `gofmt -l`, `go vet` on both packages clean. `go test ./internal/server/... ./internal/config/...` pass (`internal/auth` has no test files). No test was added: the cases above are written up for TEST_PLAN.md in the planning sidecar.

### deploy/gcp · the scripts that put formai.monster up, for any domain
### deploy/gcp · one VM on Google Cloud, for any domain
- refers-to: deploy/gcp/provision, deploy/gcp/ship, deploy/gcp/install, deploy/gcp/instance.env; .docs/SELF_HOSTING.md; .docs/wiki/Self-hosting.md; .docs/wiki/Auth0.md
- kind: deploy, docs
- logged: v0.61.1 · 2026-11-22

Owner request of 2026-11-22: a guide for taking one's own copy of form.md to one's own domain the way formpunchlist went to formai.monster, to be shared on formai.studio, plus wiki pages. The three scripts are formpunchlist's `deploy/gcp` (its internal/HASHOUT_LOG.md, "deploy/gcp · one VM for formai.monster", v0.48.0, and "the bundle budget warns instead of stopping a deploy", v0.49.0) with these differences and no others:
Owner request of 2026-11-22: a guide for taking one's own copy of form.md to one's own domain, to be shared on formai.studio, plus wiki pages. The three scripts:

- `provision`: `DOMAIN` is required instead of defaulting to formai.monster; the VM name defaults to `form-md` and the network tag to `form-md-web` (`VM_TAG`); the printed DNS records name the given host, mark www and CAA as optional, and say there is no AAAA record.
- `provision`: `DOMAIN` is required; the VM name defaults to `form-md` and the network tag to `form-md-web` (`VM_TAG`); the printed DNS records name the given host, mark www and CAA as optional, and say there is no AAAA record.
- `ship`: the staging folder is `form-md-deploy`, and the env file is `instance.env`.
- `install`: stops before touching the system when no `/etc/form-md/env` exists yet and `instance.env` still names `example.com`; reads the host name for its last line from `FORMMD_ACME_DOMAINS` in the installed env file; that last line says the set-up screen answers whoever opens it first. formpunchlist closed that window with its email allowlist, which form.md does not have, so the guide says to create the owner at once.
- `instance.env`: `FORMMD_ADDR`, `FORMMD_HTTP_ADDR`, `FORMMD_ACME_DOMAINS`, `FORMMD_TERMINAL=off`, `FORMMD_FAMILY=off`. Left out because form.md does not read them: the allowlist, the punch list variables, and the instance name and public address from the environment (set in Instance settings instead). `FORMMD_UPDATE_CHECK=false` is left out because the update feed is form.md's own.

Not ported from formpunchlist, by decision of scope and not of merit: the allowlist (`internal/auth/allowlist.go`, 40 lines and seven call sites), `FORMMD_INSTANCE_NAME` and `FORMMD_PUBLIC_URL`. The wiki page names them under "What formpunchlist adds on top".
- `install`: stops before touching the system when no `/etc/form-md/env` exists yet and `instance.env` still names `example.com`; reads the host name for its last line from `FORMMD_ACME_DOMAINS` in the installed env file; that last line says the set-up screen answers whoever opens it first, so the guide says to create the owner at once.
- `instance.env`: `FORMMD_ADDR`, `FORMMD_HTTP_ADDR`, `FORMMD_ACME_DOMAINS`, `FORMMD_TERMINAL=off`, `FORMMD_FAMILY=off`. The instance name and public address are set in Instance settings.

The Auth0 page is derived from `internal/auth/oidc.go` and Auth0's documentation, with no Auth0 tenant involved. What the code settles: the issuer check uses the discovery document's own `issuer`, so Auth0's trailing slash is fine; only RS256 and ES256 verify; the client secret goes in the token request body; an existing account links only when both sides hold the email verified; a new account needs `SignupAllowed`; a provider sign-in starts a session without the form.md two-factor step. What it does not settle: `prompt=select_account` is sent to every provider, and Auth0 documents only `none` and `login` for it.

Expand Down
Loading
Loading