On the multi-tenant edition anyone can set up a team: their account, the
company and its website, whose registered domain the team works on (the
profile keeps to it). A person can belong to several teams and switch
between them from the sidebar, or set up another. Inviting someone who has
an account adds them to the team.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A team's connections take a Postgres role that owns its schema and may
use the shared tables, nothing else: even SQL naming another team's
schema is refused. The second guard behind the search_path.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On the multi-tenant edition each team's data is in its own schema; the
tables every team shares (people, sessions, memberships, keys, locks, and
a new teams table) stay in the main one. A team's connection pool searches
its own schema first, so the app's SQL runs unchanged and can't reach
another team's tables. Each request is served by a copy of the Server for
the viewer's team, with that team's database, secrets and caches; agents
work on their own team's. The local and server editions are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
/api/v1 offers the MCP tools as plain HTTP for scripts: GET /api/v1/tools
lists what a key may call, POST /api/v1/<tool> calls one with JSON. Each
call goes through /mcp internally, so keys, scopes, limits, logging and
approvals are the same. /api/v1/docs documents every tool.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each agent has calls a minute and things it may ask to send out a day,
checked on every tool call and every request to send; every call is
recorded (tool, outcome, time) and the agent's page lists the last 50 and
what it's waiting on. Pause refuses all its calls at once. Also fixes each
agent's MCP server being shared with others that had the same scopes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agents can now ask to publish or schedule a post, send an email, add
someone to a mailing list, or apply an SEO change. Each waits on the
Approvals page (with a count in the sidebar) for an admin or a member with
edit on its module, who can edit it first, approve or refuse it, and let
the agent take that class of action on its own with a cap per day. A
rotation after a leak revokes the old keys and withdraws everything
allowed. All of it is in the audit log.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agents get each module's tools by their scopes: reading tools with read,
the others with read and act. Content (drafts and items; writing, editing
and discarding drafts), Prospects (signals, review, outreach, suppression;
outreach drafts and edits), SEO (the morning check, What to write next,
links, changes; editing a proposal), Sites and Metrics (reading) and the
Market (list, get, save). They call what the pages call, and what an agent
changes is in the audit log as the agent. Nothing that leaves Supermarket
is offered yet: that waits for approvals.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agents are users of kind agent, each given modules to read, or to read
and act on, and the CRM scope. Admins make them under Settings → Agents,
on every edition; keys (sm_…) are shown once and kept as hashes, can
expire, be rotated (the old one works a day) or revoked, and record their
last use. /mcp takes agent keys and offers each agent only the tools its
scopes allow. On the local edition, mcp-token is the key of a built-in
Hermes agent with the CRM and the Market.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
compose.server.yaml runs Supermarket behind Caddy (HTTPS from Let's
Encrypt, Caddy's own CA or the team's), with Postgres on an internal
network and a nightly pg_dump kept two weeks. install-server.sh asks for
the domain, certificate and mail server, makes the secret key and database
password, starts it all and prints the setup link. Settings → Backups lists
the dumps on a server, and how the operator restores one. Checked end to
end in Docker.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign-ins and failed ones, everything admins do to users, connections,
posting accounts, each post published and email sent, pull requests and
deletions go in an audit log (schema 36), kept two years; admins read it
under Settings → Activity. Drafts, published posts and outreach emails
show who made them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Social accounts become posting accounts: several per network, the
company's and each person's own, with their tokens kept per account. The
old sign-ins are adopted as the company's. Admins say who may post to which
(Settings → Posting accounts); a draft can go out from one account or a
copy to several, each recording who posted it and as what. Signing an
account out, or removing its owner, holds the posts scheduled to it and
tells whoever scheduled them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Admins see every service Supermarket uses, whether it's connected,
failing or not set up, when it was last tested (every Test button now
records its result), and who connected or removed it and when. Keys and
sign-ins saved from the settings pages record the person; refreshed
tokens don't.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One table maps every address to an area (a module, Settings, anything
signed in, or public); each route is checked against it, and the app won't
start with a route missing from it. Changing needs edit on the module. For
members who may only view, forms that would change something are shown
disabled and htmx buttons hidden. The menu, the Overview, Search and the
SEO emails follow each person's modules; Settings is for admins.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings → Users lists everyone with their access and status. Admins
invite people by email (a link for 7 days), as admins or as members with
modules each to view or edit; the invitation's page sets the password,
profile and emails wanted. Admins can resend or withdraw invitations,
change access, turn accounts off and on, unlock, reset two-factor, sign
someone out, and remove them; never the owner, nor themselves. Your
account gets the emails wanted and a photo.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server edition now starts. Sign-in by email and password, limited per
address and per IP; ten failures in a row lock the account and email its
owner, and a reset by email (or an admin) unlocks it. Settings → Your
account has the profile, the password, where you're signed in, and
two-factor sign-in with an authenticator app (TOTP, from a QR code) and
ten recovery codes. The app's own mail goes through SUPERMARKET_MAIL_URL.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new server prints a link to create its owner (supermarket setup-link
makes another); until it's used, every page says the setup isn't
finished. One-time links (schema 33) are kept as hashes and used up in
one statement; resets and invitations will use them too. The server
edition opens Postgres.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Schema 32 adds users, memberships and sessions, on both databases.
internal/users keeps accounts (Argon2id passwords), roles and modules,
and sessions whose rows hold only a hash of the cookie's value; they end
after a week unused or 30 days. On the server edition, every page but the
public ones needs a session and sends others to /signin. Every edition's
forms now carry a CSRF token (a cookie repeated in each form, added as
pages render; htmx sends it as a header), besides the same-origin check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
supermarket export [--with-secrets] writes a whole Supermarket as a
.tar.gz (a manifest, each table as JSON lines, secrets if asked for) to
the file storage. supermarket import loads one into an empty database at
the same schema, SQLite or Postgres, in one transaction, parents first,
checking row counts and moving Postgres' identity counters past the
imported ids.
Checked on Federated's 112,543 rows: imported into Postgres and SQLite,
every table and total matches, and TestPagesOnRealData renders all 57
pages the same from both. That found unsettled ordering (case-alike
campaigns, customers with the same name, metrics' float sums), now fixed
with ORDER BY and tie-breakers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/jobs keeps named locks as leases in the database (schema 31:
locks, instances), taken with one conditional UPDATE on SQLite or Postgres,
renewed while the work runs and lapsing if its copy stops. Each background
loop's turn, sending an email, audits, discovery runs and imports run
under a lock; OAuth sign-ins under way are kept in the database. Copies
check in, and work marked running is recovered at start only when no
other copy is alive. Settings -> About lists the copies and work under
way.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/storage keeps files that must outlast the app's disk (exports,
uploads) behind one interface: a folder (<data>/files) or an S3-compatible
bucket (minio-go, path-style, for Garage). Names that would reach outside
the store are refused. An S3 store is checked at start; supermarket config
checks the storage and Postgres for real. The same tests run on a folder
and on Garage (SUPERMARKET_TEST_S3).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server and multi-tenant editions keep keys and tokens in a secrets
table (schema 30, the first migration for both databases), each sealed
with AES-256-GCM under a key derived from SUPERMARKET_SECRET_KEY and bound
to its name. A wrong key stops the start with a clear message;
SUPERMARKET_SECRET_KEY_OLD reseals everything under a new key. Values are
read when asked for, so several copies of the app agree on a refreshed
token. The local edition keeps secrets.json.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Migrations from schema 30 on are one list (internal/db/migrations.go),
written in SQLite's SQL and translated for Postgres (db.PostgresSQL)
unless one gives its own. On Postgres the whole migration is one
transaction under an advisory lock, and each step is recorded in
schema_migrations. TestSchemasMatch compares the two schemas (tables,
columns, types, NOT NULL, nocase, indexes), with and without a new
migration.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
db.DB wraps database/sql for either database. The SQL stays SQLite's: on
Postgres each statement's ? become $n and LIKE ignores case as SQLite's
does, and the Postgres schema (postgres.sql, schema 29 as a whole) adds
SQLite's instr, json_extract and two-argument max/min, and a nocase ICU
collation. Needs Postgres 18.
LastInsertId became db.Insert (RETURNING id), INSERT OR IGNORE became ON
CONFLICT DO NOTHING, upserts qualify their columns, and three queries
group by every column they use. SUPERMARKET_TEST_POSTGRES runs the test
suite on Postgres, a new schema per test; all tests pass on both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SUPERMARKET_MODE picks local (the default), server or multi. internal/config
reads and checks every setting the editions need (database, secret key,
storage, the app's own mail, an https address), reporting all problems at
once. supermarket config prints them without passwords; supermarket
secret-key makes a key. Settings -> About shows the edition. Server and
multi-tenant are checked but refuse to start until they're built.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings → Website & sales says which clicked links count as a sign-up:
Supermarket suggests the sign-up, trial and checkout links visitors
clicked, and the user ticks, unticks or adds their own. The Plausible
import reads, per page a visit began on, the visitors, sign-ups and form
leads (a new page_days table); What ranks, the audit and Sites show
visits and sign-ups next to each page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The theme carries a MANIFEST of its files' SHA-256s. A site's Theme card
shows its copy's version against Supermarket's and any files changed by
hand; Update the theme opens a pull request that writes new and changed
files, removes retired ones, rebuilds, and lists what it replaces.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sites → New site fills an empty Gitea repository with the theme, a
hugo.toml in the site's brand and a starter home page: checked that the
repository is empty and builds with Hugo, then the first commit is pushed
to its default branch. The site joins the profile, and a First pages card
builds its Home, About, Contact and product pages with the page builder;
About and Contact join the top menu.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/theme embeds a Hugo theme from federated-website's look and the
13 section types both sites share, with the header, footer, colors, font
and logo set per site in hugo.toml, and a README of each type's fields.
The catalogue reader reads themes' sections and READMEs after the site's
own; lead forms know a theme site needs only the Lead Capture address.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A second LinkedIn app (Community Management API) with its own sign-in on
Settings → Social accounts: the pages the member may post for are listed
and one chosen, new LinkedIn drafts default to the page or to you, and
each draft can switch before it's published. Schema 25.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sites → Lead forms sets up the site's forms to create EspoCRM Leads
through its Lead Capture: the address saved and tested with a CORS
preflight, and a pull request adding a script that maps the form's fields
onto a Lead (campaign, page and form in the description). Plausible's
Lead goal is imported per signal as interested.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A restore is staged (checked, the current database backed up) and swapped
in when the app next starts. Settings → Backups restores with a
self-restart, cancels a waiting restore, and takes uploads; supermarket
restore takes a backup name or a file; supermarket backup --with-secrets
makes an archive with the keys, for moving machines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Backups with SQLite's VACUUM INTO into <data>/backups: on request
(Settings → Backups, supermarket backup [note]), before every schema
migration, and daily, keeping 7 dailies and 4 weeklies. Listed with size
and schema; downloadable and deletable. The old app.db.pre-* copies are
moved in, with their -wal files folded in first.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged Sites pages are checked on the live site until they answer with
their own words and title; removed ones until they're gone. The SEO loop,
the page, the signal's page and Sites → Publishing check (or Check now);
two hours without the page points at the deploy hook. Pages going live or
away go to IndexNow. Sites → Publishing lists what's waiting, open pull
requests and recent merges. Schema 24.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each signal's page lists its landing pages with their Gitea status, live
address and 30-day visitors from Plausible, and builds a new one. Pages
can be duplicated as variants (B, C…, with their own utm_content), taken
off the site through a pull request that deletes the file, or have their
pull request closed. The scorecard counts live pages. Schema 23.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sites → New pages: the AI composes a landing, product, alternative,
comparison or blog page as the site's own sections, from the profile and
optionally a product, competitor, buying signal or SEO brief. Code checks
every section type, warns on unknown fields and missing pages, tags a
signal's links with its campaign and finds experience claims. Pages are
edited here, pushed to their own branch with a preview, and opened as pull
requests after the claims are confirmed. Schema 22.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sites → Previews builds a branch with Hugo (drafts included) and serves it
under /preview/<site>/<branch>/, links rewritten to stay inside, behind a
sandboxing CSP so a branch's scripts can't act on the app or phone home.
The image now builds Hugo v0.170.1 from source; Alpine's 0.147.2 couldn't
build the site. Hugo's errors show their innermost cause.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sites → Sections and pages reads the website's Hugo repository: each
section type with the README's description, the fields in use and the
layout's, the pages using it and a real example; the pages and their
sections; the latest commits. Working copies are now held by one job at a
time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MRR page adds churn, CLV, CAC and CLV:CAC. Eight tables download as
CSV (MRR, NRR and revenue cohorts, CAC by month and channel, spend,
products, customers). Metrics → Publish builds an open metrics page from
chosen totals only (never a customer) and opens a pull request that adds
or updates it on the site, checked with a Hugo build.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>