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>
Supermarket
A marketing suite for companies that run a Federated Core, installed as a CoreDesktop sibling project. It runs as a web app in Docker on your computer, at http://localhost:8470, and only your computer can reach it.
Everything starts from your company profile (what you sell, to whom, in what voice) and your inventory of partners and competitors. On top of those, Supermarket will:
| Module | What it does | Status |
|---|---|---|
| Content | Drafts posts from partner and competitor news and your own products; you review them and publish to X, LinkedIn and Reddit | Phase 1: done |
| Prospects | Finds companies and people who fit your targets; the ones you approve go into your Core's EspoCRM through Hermes | Phase 2 |
| SEO | Audits your websites for Google, Bing/DuckDuckGo and Brave, and opens fixes as pull requests on your Hugo repositories | Phase 3 |
| Metrics | Pipeline influence, CAC, CLV and NRR, from Stripe, EspoCRM and Plausible | Phase 4 |
| Sites | Builds pages and sites from a component library and publishes them through Gitea | Phase 5 |
This version has the foundation (Phase 0): the web app, the company profile, the inventory, the AI provider, credentials, and the bridge to your Core through Hermes. It also has the Content module (Phase 1): posts about partners, competitors and your own products, a Posts page for approval, scheduled publishing to X, LinkedIn and Reddit, and UTM tags. See PLAN.md for the whole plan.
Install
On a CoreDesktop machine:
sibling add <this repository's git URL>
This runs install.sh, which:
- builds and starts Supermarket's container (Docker and Docker Compose come with CoreDesktop),
- adds Supermarket to GNOME's app grid with CoreDesktop's
webapp, - imports the old terminal app's settings, credentials and queued posts, if it finds them in
~/.local/state/coremarketing(copied, not moved), - connects Hermes to your Core's MCP hub and to Supermarket (see Hermes), and
- offers to let Claude Code use Supermarket's tools.
After that, CoreDesktop's update keeps it current: it pulls this repository and runs update.sh, which rebuilds the container when the code has changed.
Then open Supermarket and:
- Settings → AI: Anthropic, with Hermes' key (shared by
supermarket hermes) or your own, or an LLM server on your network, such as Ollama. Servers found by CoreDesktop'sconfigure ai-serversare offered. - Settings → Profile: enter your website and press Draft. Correct the draft and save it.
- Inventory: add your partners and competitors, or import a list. On an entry, Fill in the empty boxes reads their website: links, accounts and feeds come straight from the pages, and the AI drafts a description, talking points set against your profile, keywords, hashtags and subreddits. Suggested subreddits are checked with Reddit first (with the Reddit client ID and secret saved), and ones that don't exist, are private or are restricted are left out. What you typed stays; nothing is saved until you press Save.
- Settings → Social accounts: connect X, LinkedIn and Reddit.
The menu on the left has a search box at the top (press / to jump to it), then the Overview with a card per module, the Inventory, and the modules: Content (Posts, Sources, Scheduled, Published), and the ones still to come. Settings, at the bottom, holds the Profile, Social accounts, Core & Hermes, and AI. Search finds posts, fetched items, inventory entries, your products and settings pages. The look follows brain (Federated's superbrain), including a dark theme that follows your system's setting.
The supermarket command
supermarket open it in the browser (starting it if needed)
supermarket status running? which version?
supermarket logs follow its log
supermarket restart restart it
supermarket stop stop it, until you start it again
supermarket hermes set up Hermes' connection again (--reconfigure to change the MCP hub)
supermarket token the token agents use for its MCP endpoint
Where things are
| What | Where |
|---|---|
| Data: database, imported files | ~/.local/share/supermarket/ (app.db, import/) |
| API keys and tokens | ~/.local/share/supermarket/secrets.json, readable only by you. Never in the repository or the image |
| MCP token | ~/.local/share/supermarket/mcp-token |
| The Core's settings | A copy of CoreDesktop's ~/.config/coredesktop/core.conf, refreshed by every update |
Back up ~/.local/share/supermarket to keep everything.
Hermes and your Core
Supermarket never talks to your Core's MCP hub itself. CoreDesktop's Hermes agent does: it holds your own token for the hub, and carries out the CRM work Supermarket queues. The two meet through Supermarket's own MCP server. Hermes runs in CoreDesktop's sandbox, which has its own network (127.0.0.1:8470 there isn't your computer's), so Hermes reaches Supermarket through a Unix socket in the data folder, ~/.local/share/supermarket/mcp.sock, using socat. Other agents, such as Claude Code, use http://localhost:8470/mcp with the bearer token from supermarket token.
install.sh (or supermarket hermes) adds both MCP servers to ~/.hermes/config.yaml:
mcp_servers:
mcphub:
url: "https://mcphub.<your Core's domain>/sse?as_user=<your user name>"
transport: sse
headers:
Authorization: "Basic ${MCPHUB_AUTH}"
supermarket:
command: socat
args: ["STDIO", "UNIX-CONNECT:/home/<you>/.local/share/supermarket/mcp.sock"]
Hermes fills in ${MCPHUB_AUTH} from ~/.hermes/.env when it connects, so config.yaml holds no secret:
MCPHUB_AUTH=<your own hub token from your Core: the part after "Basic ">
Hermes' sandbox can only reach the hub once it's in network.allowedDomains in ~/.config/coredesktop/sandbox/hermes.json. The script asks before adding it, then restarts Hermes' gateway. To enter a different hub token: supermarket hermes --reconfigure.
AI for Supermarket itself. If Hermes uses an Anthropic key, supermarket hermes offers to let Supermarket use the same key and model, so AI is set up once. Only the key and model are copied, to hermes-ai.json in the data folder (readable only by you), and update.sh keeps them in step. Supermarket still calls the model directly, not through Hermes: writing posts means reading text from the web, and that text shouldn't reach an agent that has tools and your CRM. A key saved under Settings → AI takes the place of Hermes'.
To check the connection, open Core & Hermes in Supermarket and ask Hermes the question shown there. Hermes lists the hub's tools and reports them back to Supermarket, which shows when it last heard from Hermes.
Buying signals (Prospects → Signals). A signal is a guess about why a company buys now ("teams complaining about the Microsoft 365 price rise switch within a quarter"), with how to spot it, the angle for messages and content, a status (idea, testing, proven, retired) and a campaign tag used as utm_campaign. Every step through the funnel is recorded against a signal and a channel: found, contacted, replied, interested, booked, visited, signed up, paid. The scorecard counts each signal's funnel (people once per stage), with revenue and the outside tools' spend, by period and channel. Until Supermarket sends its own outreach, outcomes are recorded by hand on each prospect in Review.
Discovery (on each signal's page). Search the web now asks Claude, with Anthropic's web search tool, for organizations that show the signal, starting from its "How to spot it" lines and your profile's targets: up to 8 searches and 10 companies a run. Every company must come with the page that shows the signal and a quote from it; a company whose page wasn't among the search results is left out, as are your own sites, your inventory, existing prospects and Accounts, and suppressed domains. Search explee.com now runs explee.com's company search for the signal's description, in your target sizes, scored against its hypothesis; only strong matches are added. New companies land in Review, tagged with the signal; nothing is contacted. Each run is listed with what it added, what it left out and why, and how many searches it used; a signal can also search on its own every 7, 14 or 30 days. Web search needs Claude as the AI provider, and each search is billed by Anthropic.
Lead sources (Settings → Lead sources). With an API key, Supermarket reads your campaigns in origami.chat and explee.com every 6 hours (or on Import now): their numbers and spend, who was contacted, who replied, who was interested, and who unsubscribed. It only reads; it never starts or changes anything there. On Signals, give each campaign the signal it tests. Interested people and repliers come into Review as prospects, and unsubscribes go on the suppression list. origami.chat doesn't document its responses, so its Test button shows what the API actually sends.
Finding people and emails (Hunter.io). With a Hunter.io API key (Settings → Lead sources → Enrichment), Review gets three buttons. Find people at on a company looks for people in the departments and seniority you chose (up to 3, 5 or 10 a company) and adds them under it, with their title, address and Hunter.io's confidence. Find their email on a person with a name but no address (origami.chat often has none) looks it up at their company's domain. Verify the address checks whether an address receives mail, and Verify with Hunter.io does all the unchecked ones in New at once (50 at a time). Each person then shows verified, risky (the server accepts anything, or it's personal webmail), bounces, or couldn't be verified. Nothing runs on its own: a search costs a Hunter.io credit when it finds someone and a verification half a credit, and each card shows what its last search found and used. The Test button shows what's left of your plan.
Outreach (Prospects → Outreach, and Settings → Email). On Review, Write an email or Write a LinkedIn message on a person has the AI draft one from their buying signal's hypothesis and angle, what's known about them and their company, and anything that happened before (an earlier reply, or a message you sent). Draft on the Outreach page does the same for up to 5 accepted people nobody has written to yet. Read and edit every draft. An email you queue goes out through your Core's mail server (mail., set up under Settings → Email): one at a time, at least a few minutes apart, within your sending hours and daily limit (20 by default), with your signature and an opt-out line under it, links to your sites tagged with the signal's campaign, and a copy in your Sent folder. Nothing goes to a suppressed address, an address that bounces, or someone emailed in the last two weeks. LinkedIn can't be automated: copy the message, open their profile, send it there and Mark as sent. Every 10 minutes Supermarket reads the inbox, read-only, for replies (matched to the email they answer, or by sender), bounces (the address is marked as bouncing) and requests to stop (the address goes on the suppression list); out-of-office replies are ignored. Sent messages count as Contacted and replies as Replied on the signal's scorecard. Check the settings signs in to both servers and looks up your domain's SPF, DKIM and DMARC records.
SEO: what already ranks (SEO → What ranks, and Settings → Search engines). Connect Google Search Console (an OAuth client from your own Google Cloud project, read-only) and choose each website's property. Supermarket reads 16 months of Search Console data, then syncs twice a day. The page shows the last 90 days of final data: clicks, impressions, click rate and average position; how much of the traffic comes from searches Google doesn't name; your best pages; the searches you're shown for most and hardly clicked; the pages to protect (they carry the clicks) and the pages to push (on page one, shown a lot, rarely clicked), each with the number that justifies it and the search it's mostly shown for. Every number is Google's; nothing is estimated.
SEO: the morning check and the Monday report. Morning check compares the last 7 days of final Search Console data with the 7 before, by page and by search, and lists only real moves. A move means more than 5 clicks, or more than 3 positions on at least 300 impressions; the thresholds are editable under Settings → Search engines. Otherwise it says "Nothing real moved". For each move it shows the numbers before and after, and what the data shows about the cause: which search's clicks changed, and whether a position change is real or only Google showing the page for a different mix of searches. A search with no row this week is "no data", not a drop to zero. The Monday report is one page, the same every week: clicks, impressions and position against the week before, with a sentence on where the change came from; the 3 pages that moved most; and "Waiting for your yes", at most 3 pages to act on. It's written every Monday, kept for comparison, and can be emailed to you through the outreach mailbox.
SEO: the audit (SEO → Audit). Once a week, or with Audit now, Supermarket reads your website politely. It takes the busiest pages from Search Console first, then the sitemap's, then the pages they link to: up to 300, honoring robots.txt. On every page it checks:
- the title and meta description, with their length in characters and in pixels as Google shows them;
- the H1 and heading order;
- the canonical and noindex tags;
- errors and redirects, and broken links, outside ones included;
- images without alt text;
- Open Graph and structured data;
- whether the text is there without JavaScript;
- whether the title says what people actually search for, from the page's main Search Console query.
Issues are ranked by severity, then by the page's clicks and impressions, so the pages that bring traffic come first. An AI visibility section checks whether robots.txt lets AI assistants' crawlers in, whether you have an llms.txt, and whether your pages carry structured data and say who you are. Optionally it checks the speed (Core Web Vitals) of the 5 busiest pages with PageSpeed Insights; an API key for that is optional, under Settings → Search engines.
SEO: changes, approved one at a time (SEO → Changes). Propose changes writes up to 3 changes. Each is a new title, a new description, or both, for a page Google shows on page one without clicks, or for a title or description the audit flagged. Each comes with the number that pays for it and its length in characters and pixels; Propose a fix does the same for a single audit issue or page. Edit the wording if you like, then say yes or no. A yes pushes a branch to the website's Hugo repository on Gitea (set the repository in the profile, and Gitea's address and an access token under Settings → Search engines), edits the page's front matter, builds the site with Hugo to check that the page's title and description come out exactly as proposed, and opens a pull request. Supermarket never merges: you do. Once merged, it checks the live page, then shows the page's clicks, impressions, click rate and position before and after, over equal periods.
SEO: the next keywords (SEO → Next keywords). Look for keywords gathers searches your site has no page for yet, from four sources:
- searches Google already shows you for, but below page two;
- your profile's keywords and your customers' problems;
- your signals' search lines;
- the topics your competitors' sites cover, read from their sitemaps (add competitors with their websites in the Inventory).
Each candidate is checked against your own pages, and buyer searches (price, best, vs, alternative, hosting…) come first. Search volume and difficulty aren't available. What matters is who you'd have to beat, so Read the live top 3 uses up to 3 web searches to show who ranks today and what kind of site each one is (big brand, marketplace, forum, small site), and keywords you can win rise to the top. Pick one at a time; the next part turns a pick into a brief and a page.
SEO: briefs and pages (SEO → Briefs and pages). Write a brief for a search you picked (a new page) or for one of your pages (a rewrite). The brief:
- starts from what Google really shows the page for (when that isn't what its title says, it says so first);
- reads the live top 5 with web search (up to 5 searches), says what each promises and lacks, and marks "couldn't be read" rather than guessing;
- gives the title, description, H1, the angle none of them takes, the sections in order, the questions the page must answer, links to your existing pages, and the questions only you can answer.
Edit the brief and answer those questions ("not tested" is a fine answer), then Write the page: the AI drafts it around your answers and invents no test, price or customer. Every sentence that claims an experience is listed for you to confirm or remove. Open a pull request adds the page (or rewrites the existing one) in the site's repository, checks it with a Hugo build, and opens a pull request for you to read and merge.
SEO: search engines (SEO → Search engines).
- Set the site up: Open the pull request adds what search engines need and the site lacks: an IndexNow key file, a
robots.txtthat names the sitemap, and the sitemap itself if the Hugo config turns it off. A Hugo build checks all three. - IndexNow: once the key file is live, every page that goes live through Changes or Briefs is submitted to IndexNow, so Bing and the other engines that use it hear about it at once. Google doesn't use IndexNow.
- Google: the sitemaps Search Console has, with their errors.
- Bing: with a Bing Webmaster API key (Settings → Search engines), Bing's weekly clicks and impressions, its top searches, and its crawl issues.
Metrics (Metrics). With the Stripe key from Settings → Website & sales (give it read access to Customers, Invoices, Credit notes, Charges and Refunds, and Events too), Supermarket reads your whole Stripe history once, then the changes every hour. Under Gross margin by product, each product shows what it billed over the last 12 months; give each its margin (what you keep after the cost of delivering it), or leave it at the default, 60%. CLV uses them. Metrics shows:
- MRR today, ARR, the number of paying customers, the average per customer, and NRR for the month and over 12 months;
- a 24-month chart;
- each month's movements (new, expansion, contraction, churn, reactivation), with a page per month listing each customer's move;
- cohorts by the month customers first paid, with the share of their starting MRR they still pay.
MRR is built from the invoice lines (each recurring line's amount after discounts, spread over its billing period), so past months are exact. Spend and CAC (under Metrics): log what marketing and sales cost each month, by channel, by hand or by pasting a CSV (month,channel,amount,note). origami.chat and explee.com campaign spend comes in on its own. CAC is the month's spend over the customers who first paid that month, with a steadier three-month figure. Over the last 12 months it's also shown per channel, using each new customer's first step in the funnel (a reply, a visit, an outreach email), matched by email.
CLV and cohorts (under Metrics): customer lifetime value, as gross profit per customer. That's the average MRR per customer × the gross margin (weighted by product) ÷ the monthly churn rate averaged over 12 months. It's shown beside CAC as CLV:CAC (3:1 or better is healthy). Below it, each signup cohort's actual cumulative revenue per customer, month by month: what came in, less refunds and credits, with a gross profit view.
Every Metrics table has a Download as CSV link. Publish (under Metrics) builds an "open metrics" page for your website from the numbers you choose: MRR and ARR, customers, growth, NRR, churn, a monthly table. It shows totals only, never anything about any one customer. Open a pull request adds or updates the page on the site's Gitea repository; merging publishes it.
Customers and the CRM (under Metrics) matches each Stripe customer to its EspoCRM Account, in this order:
- a stored ID, either side;
- the email, on the Account or one of its Contacts;
- the email's domain (free mail doesn't count).
Where several Accounts fit, you choose; you can fix any match, mark a customer as not in the CRM, or queue a paying customer to be added as an Account through Hermes. It needs Hermes to have copied the CRM's Accounts.
If your billing moved to Stripe partway through, set the month to count from, so the customers already paying then aren't counted as new; Metrics suggests one when it sees the jump. CAC and CLV come in the next parts.
The end of the funnel (Settings → Website & sales). When writing posts on Content, choose For a buying signal: the posts speak to that situation, and their links carry the signal's campaign tag. Each signal's page lists its posts and gives your websites' addresses tagged with it, for landing pages, the shopping cart or links you share. With a Plausible Stats API key (Plausible on your Core by default), Supermarket reads yesterday's visitors on tagged links once a day and counts them as Visited for the signal, by channel; visits are counted per signal, never per person. With a restricted, read-only Stripe key, it reads new checkouts and paid invoices every hour: a checkout with nothing to pay (a trial or a free plan) counts as Signed up, and money paid as Paid, with the amount. A customer is tied to a signal by the utm_campaign your shopping cart saves in the Checkout Session's metadata, or else by their email (a prospect's, or one at a prospect company's domain). Your Core's Cal.com has no API, so bookings are read from Cal.com's booking emails in the outreach mailbox: give Cal.com's sending address under Settings → Email, and each new booking counts as Booked for the person who booked.
Prospects (Prospects → Review). Companies and people who may fit your targets wait here for review; for now you add them by hand, and finding them for you comes next. Each keeps where and when it was found. Accepting a company queues an EspoCRM Account, accepting a person queues a Lead at their company, with the source, date and why they fit in the record's description. Before you decide, the page warns about records already in your CRM (as of the last sync). Set aside keeps a prospect out of the way; the suppression list (Prospects → Suppression list) holds emails and domains that must never be added, and is checked when a prospect is added and again before anything is queued.
The CRM queue (Prospects → CRM queue). What Supermarket wants in EspoCRM waits in a queue, with the exact fields and how to recognise a record that's already there. supermarket hermes adds a Hermes scheduled job, supermarket-crm, that runs every 15 minutes: it calls Supermarket's crm_pending_actions tool, creates each record through the hub's EspoCRM tools unless a matching one exists, and reports each result with crm_report_result. Every 6 hours (or when you press Sync on the next run) it also copies your Leads, Accounts and Contacts to Supermarket with crm_ingest, so Supermarket can spot people and companies you already have. Before each run, the job runs ~/.hermes/scripts/supermarket-crm-check.sh, which prints crm-state from the data folder; while that hasn't changed, Hermes skips the run and uses no AI. The page shows the command to run the job now, and Send a test Lead checks the whole path. Failed actions can be retried or cancelled; nothing is written to your CRM that isn't in the queue.
Writing and publishing posts
- Fill in the Profile (posts are written in its voice) and choose an AI provider under Settings.
- Add partners and competitors to the Inventory, with the places to watch: an X handle, hashtags, a YouTube channel, RSS feeds.
- Under Content, open an entry and press Fetch new. Supermarket reads every source that has credentials, starting where the last fetch ended (or a week back).
- Select items, choose the channels, and press Write drafts: one post from all of them, or one per item. Each channel gets its own draft.
- Under Posts, edit each draft, then Publish now or Schedule it. The source link is added when publishing (on X it counts toward the 280 characters, and the counter includes it). A failed draft comes back to Posts with its error; the other channel's draft is unaffected.
- Scheduled posts are listed under Content → Scheduled, and go out on time while the container runs (it starts with your computer). One more than 12 hours late, because the computer was off, goes back to Posts instead of going out stale.
Links to your own websites and product pages (from the profile) get UTM tags when published: utm_source is the channel, utm_medium is social, utm_campaign is the kind of post (partner, competitor, watch) and utm_content is the entry and draft. Links elsewhere are left as they are. Times are shown and read in your computer's time zone.
Your own products. The first row under Content is your company. It lists the products from your profile, ready to write about, and fetches your own feeds (blog, news, and releases: a GitHub or Gitea repository's releases.atom works) and new or updated pages from your websites' sitemap.xml. Add the feeds under Profile → Websites. Posts from it promote your work, under utm_campaign=product.
Reading X needs a bearer token from an X API plan with read access; YouTube needs a free API key; RSS needs nothing. Posting needs the sign-ins below.
A Reddit draft is a title and a text for one subreddit, which you choose when writing (suggestions come from the entry's and the profile's subreddits). The subreddit's rules and posting guidelines are read, given to the model, and shown with the draft in Posts. Reddit drafts are written as a community member who says where they work, without hashtags or marketing language. The source link goes at the end of the text; a subreddit that only takes links gets the title and the link.
Before you publish, Posts warns, without blocking, when:
- the subreddit has a rule about self-promotion, is restricted, or doesn't take that kind of post,
- you posted in that subreddit in the past week,
- more than 1 in 10 of your posts in the past 30 days would link to your own sites (Reddit's guideline),
- the account has no posts yet.
Reddit's Data API terms need Reddit's approval for commercial use. Supermarket is meant for a few hand-approved posts, never volume or automation: every post needs you to press Publish or Schedule.
Signing in to X, LinkedIn and Reddit
Sign-ins come back to Supermarket at http://localhost:8470/auth/<provider>/callback (X: 127.0.0.1 instead of localhost). Register these callback URLs in your apps:
- X developer portal, your app's User authentication settings:
http://127.0.0.1:8470/auth/x/callback. X refuseslocalhostin callback URLs;127.0.0.1is the same machine, and Supermarket sends X this address. - LinkedIn developer portal, your app's Auth tab:
http://localhost:8470/auth/linkedin/callback - Reddit, reddit.com/prefs/apps: create a web app with the redirect URI
http://localhost:8470/auth/reddit/callback, and put its client ID and secret under Settings → Social accounts
The old terminal app used http://localhost:8080/callback; you can remove that one.
Security
- The port is published on
127.0.0.1only, so other machines can't reach it, whatever the firewall says. - The app has no login, so it protects itself from web pages open in the same browser: it only answers requests addressed to
localhost(against DNS rebinding), and refuses form posts that don't come from its own pages: each form carries a random token that another site can't know, and the browser'sOriginmust be the app's own. - The container runs as you, with a read-only filesystem, no Linux capabilities and
no-new-privileges. It can write only its data folder. /mcprequires the bearer token inmcp-token.
Development
Requires Go (see go.mod).
go test ./...
SUPERMARKET_DATA=/tmp/cm SUPERMARKET_ADDR=127.0.0.1:8470 go run ./cmd/supermarket
The tests also run on Postgres (the server and multi-tenant editions' database), each test in a new schema that's dropped afterwards. Postgres 18 or later is needed:
docker run -d --name sm-pgtest --rm -e POSTGRES_PASSWORD=test -e POSTGRES_DB=sm \
-p 127.0.0.1:55432:5432 --tmpfs /var/lib/postgresql postgres:18-alpine
SUPERMARKET_TEST_POSTGRES='postgres://postgres:test@127.0.0.1:55432/sm?sslmode=disable' go test ./...
The SQL is written for SQLite, with ? parameters. On Postgres, internal/db
numbers the parameters and makes LIKE ignore case as SQLite's does, and
the Postgres schema (internal/db/postgres.sql) adds SQLite's instr,
json_extract and two-argument max/min, plus a case-insensitive nocase
collation. New SQL should run on both: use db.Insert (not LastInsertId),
ON CONFLICT … DO NOTHING (not INSERT OR IGNORE), table-qualified columns
in an upsert's DO UPDATE, and every selected column in GROUP BY.
File storage (internal/storage) is tested on a folder, and on an
S3-compatible bucket when SUPERMARKET_TEST_S3 names one, such as a Garage in
Docker: SUPERMARKET_TEST_S3='http://ACCESS_KEY:SECRET_KEY@127.0.0.1:3900/bucket'.
To check every page renders the same from real data on both databases:
supermarket export, import the file into a new Postgres database and a new
SQLite one (supermarket import, with each edition's settings), then
SUPERMARKET_TEST_PAGES_DB=postgres://… SUPERMARKET_TEST_PAGES_SQLITE=…/app.db go test -run TestPagesOnRealData ./internal/web. Queries whose rows are
summed or shown in order need an ORDER BY that settles every tie: the two
databases break ties differently.
Changing the schema. Add a db.Migration to both in
internal/db/migrations.go, written in SQLite's SQL. Postgres gets the same
statements translated (INTEGER → BIGINT, INTEGER PRIMARY KEY → an identity
column, REAL → DOUBLE PRECISION, COLLATE NOCASE → the nocase collation,
strftime(… 'now') defaults → now()). A migration that changes data with
SQL only SQLite has gives its Postgres SQL too. Never edit one that has
shipped. Run the tests on Postgres: TestSchemasMatch fails if the two
schemas differ in a table, column, type, NOT NULL, case-insensitivity or
index. On SQLite, a backup is made before migrating; on Postgres, the
migrations run in one transaction (several copies of the app can start
together), and each is recorded in schema_migrations.
| Path | What |
|---|---|
cmd/supermarket |
The server |
internal/config |
The edition (local, server, multi-tenant) and its settings |
internal/db |
The database: SQLite or Postgres, the schema and its migrations |
internal/transfer |
Export and import: a whole Supermarket as a .tar.gz, between SQLite and Postgres |
internal/jobs |
Locks shared by copies of the app, so only one does each job |
internal/storage |
Files that must last (exports, uploads): a folder, or an S3 bucket (Garage) |
internal/web |
Pages (Go templates + htmx, no JavaScript build) |
internal/profile, internal/inventory |
The company profile and the inventory |
internal/ai |
AI providers: Anthropic (official Go SDK) and OpenAI-compatible servers |
internal/mcpserver, internal/bridge |
The /mcp endpoint and Hermes' check-ins |
internal/legacy |
One-time import from the old terminal app |
internal/content |
The Content module: fetched items, per-channel drafts, prompts, scheduling, publishing |
internal/utm |
UTM tags for links to the company's own sites |
internal/api, internal/fetcher |
X, LinkedIn, Reddit, YouTube and RSS clients, and fetching for an inventory entry |
hermes/setup.sh |
Connects Hermes |
Database changes go in internal/db/db.go as a new migration; never edit one that has shipped.