Skip to content

Prepare the template for a public demo - #157

Merged
dadachi merged 3 commits into
mainfrom
feature/demo-deploy-destination
Oct 16, 2026
Merged

dadachi merged 3 commits into
mainfrom
feature/demo-deploy-destination

Conversation

@dadachi

@dadachi dadachi commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The template repo now runs as a public demo at api.nativeapptemplate.com, deployed with bin/kamal deploy -d demo.
  • Demo-only settings (config/deploy.demo.yml with the real server IP, .kamal/secrets.demo as a symlink to secrets) are gitignored, so the origin behind Cloudflare stays out of this public repo and out of generated apps. deploy.yml keeps the 192.168.0.1 placeholder.
  • AGENTS.md no longer says the repo is never deployed: demo data is disposable, but migrations must run on a populated database.
  • Endpoints that email an address the caller names are rate-limited: password reset and confirmation resend 5/min per IP and 3/hour per address (ThrottleMailRequests), invitation create + resend 20/hour per shopkeeper. Before, a public demo would let anyone flood a stranger's inbox through the sending domain.
  • PurgeInactiveDemoShopkeepersJob (daily) deletes shopkeepers inactive for DEMO_PURGE_INACTIVE_DAYS days with their owned accounts. The variable lives only in deploy.demo.yml (demo: 30, matching the 30-day token lifespan); unset, the job is a no-op, and a test keeps it out of the committed deploy.yml.

Test plan

  • New demo destination files stay out of git test fails before the .gitignore change, passes after
  • bin/kamal config -d demo merges the demo IP over the placeholder; Kamal::Secrets.new(destination: "demo") resolves through the symlink
  • New test/integration/mail_throttle_test.rb (5 tests) fails before the limits (mail enqueued), passes after
  • Dev server + curl: per-address limit ignores case and surrounding spaces, returns the localized 429
  • Purge job tests (no-op when unset, 29/31-day boundary, owned accounts removed, invalid values raise) fail before the job exists; the deploy.yml guard fails when the variable is added there
  • Job run in development; Kamal::Configuration with -d demo merges DEMO_PURGE_INACTIVE_DAYS while keeping the base env
  • bin/rubocop, bin/brakeman, bin/rails test (635 runs, 0 failures)

🤖 Generated with Claude Code

https://claude.ai/code/session_012yY6PzRNWo8SrwyPeja5xZ

dadachi and others added 2 commits October 16, 2026 20:38
The template now runs as a public demo. Its server IP lives in
config/deploy.demo.yml and .kamal/secrets.demo, which are gitignored so
the origin behind Cloudflare stays out of this public repo and out of
generated apps. AGENTS.md no longer says the repo is never deployed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012yY6PzRNWo8SrwyPeja5xZ
A public demo lets anyone make the app send mail. Password reset and
confirmation resend were limited only by the global 300 requests per
5 minutes per IP, and invitations not at all, so a stranger's inbox could
be flooded and the sending domain's reputation would pay for it.

Password reset and confirmation resend now allow 5 per minute per IP and
3 per hour per address; invitation create + resend allow 20 per hour per
shopkeeper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012yY6PzRNWo8SrwyPeja5xZ
@dadachi dadachi changed the title Deploy the public demo through a gitignored Kamal destination Prepare the template for a public demo Oct 16, 2026
Anyone can sign up on the public demo, so its data would only grow and
keep strangers' email addresses forever. PurgeInactiveDemoShopkeepersJob
deletes shopkeepers whose last sign-in (or sign-up, if they never signed
in) is older than DEMO_PURGE_INACTIVE_DAYS, with their owned accounts.

The variable is set only in the gitignored config/deploy.demo.yml. Unset,
the job does nothing, and a test keeps it out of the committed deploy.yml
so generated apps never delete their real users. With 30 days nobody
still using the app is deleted: tokens expire 30 days after sign-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012yY6PzRNWo8SrwyPeja5xZ
@dadachi
dadachi merged commit e206230 into main Oct 16, 2026
3 checks passed
@dadachi
dadachi deleted the feature/demo-deploy-destination branch October 16, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant