Documentation
¶
Overview ¶
Package demo loads the sample data from the design ("Acme Newsletter") so the app can be explored, screenshotted and compared with the prototype.
Seeding is split per domain: each domain fills its own seedX function in its own file (seed_<domain>.go). Seeders run in the order of the list in Seed and share IDs through *Seeder, so later seeders can reference users, lists and providers created earlier. Times are relative to now so "2 min ago" in the design reads the same in the demo.
Index ¶
- Constants
- Variables
- func AccessibilityTitleOverlay(next accessibility.TitleFetcher) accessibility.TitleFetcher
- func DeliverabilityDNSOverlay(r dnscheck.Resolver) dnscheck.Resolver
- func DeliverabilityDNSZone() (*dnscheck.Zone, []string)
- func DigestFeedOverlay(next http.RoundTripper) http.RoundTripper
- func FormsDNSOverlay(r dnscheck.Resolver, urls publicurl.Builder) dnscheck.Resolver
- func ID() uuid.UUID
- func PagesLinkStatus(raw string) (int, bool)
- func ReadinessLinkDNS(r dnscheck.Resolver) dnscheck.Resolver
- func ReadinessProberOverlay(next contentcheck.Prober) contentcheck.Prober
- func SMSDNSOverlay(r dnscheck.Resolver, urls publicurl.Builder) dnscheck.Resolver
- func SampleWorkspace(ctx context.Context, tx pgx.Tx, box *secrets.Box, ws store.Workspace, ...) error
- func SendersDNSOverlay(r dnscheck.Resolver, publicURL func() string) dnscheck.Resolver
- func SendersDomainService(tx store.DBTX, publicURL string) *domains.Service
- func SendersNS(next func(context.Context, string) ([]string, error)) func(context.Context, string) ([]string, error)
- func SendersTTL(next domains.TTLFunc) domains.TTLFunc
- func Split(n int64, weights []float64) []int64
- func WebsiteCertOverlay(next website.CertChecker) website.CertChecker
- func WhatsAppTemplates() []meta.Template
- type NorthwindOptions
- type Result
- func Seed(ctx context.Context, pool *pgxpool.Pool, cfg *config.Config, box *secrets.Box, ...) (*Result, error)
- func SeedAt(ctx context.Context, pool *pgxpool.Pool, cfg *config.Config, box *secrets.Box, ...) (*Result, error)
- func SeedNorthwind(ctx context.Context, pool *pgxpool.Pool, cfg *config.Config, box *secrets.Box, ...) (*Result, error)
- func SeedNorthwindWith(ctx context.Context, pool *pgxpool.Pool, cfg *config.Config, box *secrets.Box, ...) (*Result, error)
- type Seeder
Constants ¶
const ( OctoberSubjectA = "October Product Update: three launches" OctoberSubjectB = "What shipped in October, and what we're retiring" )
The October Product Update's subject test, as on the Report board: A is the campaign's subject (and the email's headline), B won.
const ( EarnLiveKey = "rk_live_51QAcmeDemoOnlyNotARealStripeKey9fQ2" //nolint:gosec // demo key for the in-process Stripe, documented in the README EarnTestKey = "rk_test_51QAcmeDemoOnlyNotARealStripeKey3mZ8" //nolint:gosec // demo key for the in-process Stripe )
The demo's restricted keys. They aren't Stripe keys: the demo's connections talk to an in-process Stripe (internal/app/wire_earn.go).
const ( EntraGroupMarketing = "3f2a9d1e-5b7c-4e21-9a8f-2d4c6e8b0c91" EntraGroupEngLeads = "8b7d44c0-1e2f-4a3b-8c9d-6e7f8a9b002e" )
Entra ID group object IDs of the sample (A5 §4: "Marketing" 3f2a…c91, "Eng Leads" 8b7d…02e).
const ( WhatsAppBusinessID = "102290129344410" WhatsAppPhoneID = "106540352242922" WhatsAppToken = "demo-system-user-token" WhatsAppAppSecret = "demo-app-secret" //nolint:gosec // the demo account's, in the open on purpose )
The demo's WhatsApp Business Account (…4410) and its credentials, which only the in-process Graph API (internal/whatsapp/meta/metatest) accepts.
const ( StoreClientID = "4f1c8e2b7d03a9e2" StoreClientSecret = "shpss_demo1c8e2b7d03a9e2b5f0c4d6e8a1b3c5" //nolint:gosec // the demo's sample app, answered by an in-process fake )
Demo store credentials: the app's client ID (shown as 4f1c…a9e2) and the sealed secret and token the in-process Shopify accepts.
const AIDemoKey = "sk-ant-demo-recorded-0000" //nolint:gosec // a placeholder, documented as demo data
AIDemoKey is the sample connection's key: a placeholder, sealed like a real one, that no provider would accept.
const AIOctoberSummary = "" /* 652-byte string literal not displayed */
AIOctoberSummary is the summary Linh kept on October Product Update.
const BlogFeedETag = `"demo-blog-feed"`
BlogFeedETag is the version of the feed the demo seeded: a read that sends it back gets 304 Not Modified, so the seeded items stay as they are.
const BlogFeedURL = "https://blog.acme.io/feed/"
BlogFeedURL is the feed the WordPress plugin reports for blog.acme.io.
const ComposerFlashSaleBloat = 38
ComposerFlashSaleBloat is the number of pasted spans per plan card; it puts the flash sale at about 98 KB as the composer compiles it (mjml-browser), inside the "approaching Gmail's clipping limit" warning of the ComposerWarnings board. The server's compile (gomjml) is a few KB lighter.
const NorthwindOwner = "nadia@northwind.studio"
NorthwindOwner signs in to the agency sample as its instance admin.
const NorthwindStaff = "tomas@northwind.studio"
NorthwindStaff is the agency manager the boards show (QA signs in as him).
const Password = "reputecast-demo" //nolint:gosec // public demo password, documented in CONTRIBUTING.md
Password is shared by every demo account that signs in with a password.
const ReadinessDemoShortener = "https://acme.io/blog/november-2026-update?utm_source=newsletter"
ReadinessDemoShortener is where the November update's shortened link leads.
const SSOGoogleKey = "sso:google"
SSOGoogleKey is the s.Extra key of the Google Workspace SSO provider, so the instance seeder can extend it instead of creating a second one.
SendersFooterAddress is Acme's postal address in email footers.
const SponsorReportToken = "Qm7vT2pXk9LbN4sW8cYd1A" //nolint:gosec // a public demo link, not a secret
SponsorReportToken is the demo's read-only link to #141's sponsor report (reputecast.acme.io/r/Qm7vT2pXk9LbN4sW8cYd1A).
const TOTPSecret = "JBSWY3DPEHPK3PXP" //nolint:gosec // public demo secret, documented in CONTRIBUTING.md
TOTPSecret is Linh Nguyen's authenticator secret in the demo, so the two-factor screens can be tried. Generate codes with any TOTP app.
const TwilioDemoWebhookSecret = "demo-twilio-shared-key-secret-acme-summit" //nolint:gosec // the demo account's, in the open on purpose
TwilioDemoWebhookSecret signs the demo Twilio account's webhooks (the shared key ReputeCast registered).
const WhatsAppConsentText = "Send me reminders about Acme Summit 2026 on WhatsApp. Up to 3 messages. Reply STOP to stop."
WhatsAppConsentText is the registration form's WhatsApp consent, v1.
Variables ¶
var DemoRecoveryCodes = []string{
"b4xk-9q2m-7hdn", "m2pq-x8c4-1zrt", "d9ws-3kfh-6yvb", "p7nj-5tgc-2qxe", "r3hd-8vmb-4wsk",
"f6cz-2nqd-9jpa", "w8tk-7xsv-3ebr", "h5gm-1dyc-8kqw", "n9rb-6pfx-4tzs", "c3vj-5hwq-2mnd",
}
DemoRecoveryCodes are Linh Nguyen's recovery codes in the demo.
Key string Share float64 }{{"gmail", 0.46}, {"outlook", 0.21}, {"yahoo", 0.09}, {"icloud", 0.08}, {"other", 0.16}}
MailboxShare is the sample split of recipients by mailbox provider.
var SendersNameservers = []string{"dana.ns.cloudflare.com", "rob.ns.cloudflare.com"}
SendersNameservers are the demo zone's nameservers (Cloudflare).
var SkipTransactional bool
SkipTransactional leaves the demo's transactional mail out: Acme Cloud's, and the paid tiers' Memberships emails (seed_earn.go). The transactional and SMTP relay tests set it in TestMain: they start from an empty Transactional tab.
Functions ¶
func AccessibilityTitleOverlay ¶
func AccessibilityTitleOverlay(next accessibility.TitleFetcher) accessibility.TitleFetcher
AccessibilityTitleOverlay answers title reads for the demo's links without going to the network: their hosts are real domains the demo has no business calling. Other pages go to next.
func DeliverabilityDNSOverlay ¶
DeliverabilityDNSOverlay answers the demo names from DeliverabilityDNSZone and everything else from r.
func DeliverabilityDNSZone ¶
DeliverabilityDNSZone answers the demo's DNS: the acme.io names, the provider names they point to, and every built-in blocklist lookup of the demo assets (not listed).
func DigestFeedOverlay ¶
func DigestFeedOverlay(next http.RoundTripper) http.RoundTripper
DigestFeedOverlay answers the sample blog's feed, pages and images offline; everything else goes to next. A conditional read of the feed the demo seeded gets 304, so the seeded items keep their dates.
func FormsDNSOverlay ¶
FormsDNSOverlay answers the demo's custom domain for the public pages (news.acme.io) with a CNAME to this instance, so its DNS check passes in development like the board's "Published · news.acme.io/subscribe".
func PagesLinkStatus ¶
PagesLinkStatus answers the page builder's link check for the demo's addresses without the network: Acme's own sites answer, except the beta terms the "Join the Beta Program" draft points at, which are gone (PageBuilderStates: "A link doesn't work"). ok is false for any other address.
func ReadinessLinkDNS ¶
ReadinessLinkDNS answers the URI blocklist lookups of link domains in the demo and in tests (SR-1): go.acme-promo.link, the flash sale's "Claim your discount" link, is on Spamhaus DBL and SURBL, as the boards draw it, and every other domain is clean. No lookup reaches the real lists, whose operators refuse lookups through public resolvers anyway.
func ReadinessProberOverlay ¶
func ReadinessProberOverlay(next contentcheck.Prober) contentcheck.Prober
ReadinessProberOverlay answers Send Readiness's link requests for the demo's links (acme.io and the sites the sample emails link to) without going to the network, so the demo reads like the boards offline; other links go to next.
func SMSDNSOverlay ¶
SMSDNSOverlay answers the demo's short-link domain (go.acme.io) from the demo zone: a CNAME to the instance, as Marcus set it up.
func SampleWorkspace ¶
func SampleWorkspace(ctx context.Context, tx pgx.Tx, box *secrets.Box, ws store.Workspace, owner store.User, now time.Time) error
SampleWorkspace fills a new workspace with a compact Acme sample for its owner: "Explore with demo data" on the first-run Overview (review PR-13). Three lists, a few hundred contacts across mailbox providers, demo connections of Amazon SES, Postmark and Postal (demo connections never send: nothing leaves the instance), the routing of the ProvidersRouting board and a draft campaign. Nothing else changes: no demo users, no shared password, no other workspace.
func SendersDNSOverlay ¶
SendersDNSOverlay answers what Settings › Senders shows differently from the deliverability demo zone (acme.io's own DMARC policy) and the tracking domain's CNAME, which points at the host of publicURL as it is now, on top of r, which is normally the deliverability demo zone (sendersDemoZone adds the senders' records there).
func SendersDomainService ¶
SendersDomainService is a domains service on the demo DNS zone, for the seeder's checks.
func SendersNS ¶
func SendersNS(next func(context.Context, string) ([]string, error)) func(context.Context, string) ([]string, error)
SendersNS answers the demo zone's nameservers (acme.io and its subdomains) and asks next for everything else.
func SendersTTL ¶
SendersTTL answers the demo zone's TTL (an hour, as the sample records say) for acme.io names and asks next for everything else.
func Split ¶
Split divides n by weights so the parts add up to exactly n (largest remainder method), keeping demo totals consistent across breakdowns.
func WebsiteCertOverlay ¶
func WebsiteCertOverlay(next website.CertChecker) website.CertChecker
WebsiteCertOverlay answers the website's certificate checks for the demo's domains (acme.io and its subdomains, news.acme.io among them): a Let's Encrypt certificate that renews on time, without going to the network. Other domains go to next (nil: unknown).
func WhatsAppTemplates ¶
WhatsAppTemplates are the account's templates as Meta lists them (synced 15 Oct 08:00 in the demo).
Types ¶
type NorthwindOptions ¶
type NorthwindOptions struct {
// ContactsDivisor loads every client with 1/n of its contacts (tests:
// the same people, lists and rules on a database that clones fast).
ContactsDivisor int
}
NorthwindOptions change how much of the sample is loaded.
type Result ¶
Result describes what was seeded.
func Seed ¶
func Seed(ctx context.Context, pool *pgxpool.Pool, cfg *config.Config, box *secrets.Box, log *slog.Logger) (*Result, error)
Seed loads the demo data in one transaction. It is idempotent: when the demo owner already exists nothing happens.
func SeedAt ¶
func SeedAt(ctx context.Context, pool *pgxpool.Pool, cfg *config.Config, box *secrets.Box, log *slog.Logger, at time.Time) (*Result, error)
SeedAt loads the demo data as seeded at a given moment: tests whose numbers depend on the calendar (this month's SMS spend) seed at a moment when the design's days fit in one month.
type Seeder ¶
type Seeder struct {
Tx pgx.Tx
Q *store.Queries
Box *secrets.Box
Cfg *config.Config
Now time.Time
Log *slog.Logger
// Instance and people
Users map[string]store.User // by email
// Workspaces by slug ("acme-newsletter", "acme-engineering-blog")
Workspaces map[string]store.Workspace
// Roles by workspace slug + key ("acme-newsletter/content-writer")
Roles map[string]store.Role
// Lists by name ("Weekly Digest")
Lists map[string]uuid.UUID
// Providers by short name ("ses", "postmark", "postal")
Providers map[string]uuid.UUID
// Campaigns by name
Campaigns map[string]uuid.UUID
// Senders by email
Senders map[string]uuid.UUID
// Domains by name
Domains map[string]uuid.UUID
// Extra is free-form storage for domain seeders.
Extra map[string]any
// contains filtered or unexported fields
}
Seeder carries shared state between domain seeders.
Source Files
¶
- accessibility_overlay.go
- composer_content.go
- demo.go
- digests_overlay.go
- pages_links.go
- readiness_dns.go
- readiness_overlay.go
- sample_workspace.go
- seed_accessibility.go
- seed_account.go
- seed_agency.go
- seed_agency_library.go
- seed_agency_sends.go
- seed_agency_sms.go
- seed_agency_usage.go
- seed_ai.go
- seed_app_languages.go
- seed_audience.go
- seed_audience_contacts.go
- seed_audience_import.go
- seed_audience_late.go
- seed_audience_names.go
- seed_audit.go
- seed_automations.go
- seed_brandkit.go
- seed_campaigns.go
- seed_composer.go
- seed_core.go
- seed_deliverability.go
- seed_digests.go
- seed_earn.go
- seed_earn_gifts.go
- seed_earn_more.go
- seed_earn_revenue.go
- seed_forms.go
- seed_grow.go
- seed_grow_recs.go
- seed_growth_sample.go
- seed_instance.go
- seed_integrations.go
- seed_integrations_hub.go
- seed_languages.go
- seed_languages_transactional.go
- seed_notifications.go
- seed_page_copy.go
- seed_page_copy_labels.go
- seed_page_languages.go
- seed_pages_content.go
- seed_pages_people.go
- seed_pages_products.go
- seed_polls.go
- seed_providers.go
- seed_push_whatsapp.go
- seed_push_whatsapp_push.go
- seed_push_whatsapp_wa.go
- seed_readiness.go
- seed_report_growth.go
- seed_reports.go
- seed_reports_email.go
- seed_reports_fit.go
- seed_scoring_compose.go
- seed_scoring_growth.go
- seed_scoring_sample.go
- seed_scoring_uses.go
- seed_senders.go
- seed_sending.go
- seed_sms.go
- seed_sms_people.go
- seed_stores.go
- seed_team.go
- seed_traffic_rules.go
- seed_transactional.go
- seed_transactional_templates.go
- seed_verification_placement.go
- seed_website.go
- seed_website_content.go
- seeders.go
- website_overlay.go