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 DeliverabilityDNSOverlay(r dnscheck.Resolver) dnscheck.Resolver
- func DeliverabilityDNSZone() (*dnscheck.Zone, []string)
- func FormsDNSOverlay(r dnscheck.Resolver, urls publicurl.Builder) dnscheck.Resolver
- func ID() uuid.UUID
- func ReadinessProberOverlay(next contentcheck.Prober) contentcheck.Prober
- 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
- type Result
- 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 ( 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 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 Password = "reputecast-demo" //nolint:gosec // public demo password, documented in the README
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 TOTPSecret = "JBSWY3DPEHPK3PXP" //nolint:gosec // public demo secret, documented in the README
TOTPSecret is Linh Nguyen's authenticator secret in the demo, so the two-factor screens can be tried. Generate codes with any TOTP app.
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).
Functions ¶
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 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 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 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.
Types ¶
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
¶
- composer_content.go
- demo.go
- readiness_overlay.go
- seed_account.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_campaigns.go
- seed_composer.go
- seed_core.go
- seed_deliverability.go
- seed_forms.go
- seed_instance.go
- seed_integrations.go
- seed_notifications.go
- seed_providers.go
- seed_readiness.go
- seed_reports.go
- seed_reports_email.go
- seed_reports_fit.go
- seed_senders.go
- seed_sending.go
- seed_team.go
- seeders.go