rastrillo / abono Public

Clone
git clone https://amadan.net/rastrillo/abono

Plain git — no account needed to clone.

Download

abono example

A small rastrillo app that sells memberships with abono. It has sign-in by emailed link, the starter pages, and the sandbox in place of Stripe, so you can click through the whole flow without a Stripe account.

Run it

cd example
go run .

Open http://localhost:8080. It listens on 127.0.0.1 only.

  1. Sign in with any address. No mail is sent: the sign-in link is written to the log, so open it from there.
  2. Buy a plan. The checkout and billing pages are the sandbox's stand-ins for Stripe's: nothing is charged.
  3. Sign in as owner@example.com to see the owner's pages under /admin: members, free memberships, subscriptions on prices no plan has, plans and prices, and the Stripe status.

The words on the pages are message keys (abono.pages.pricing_title) until abono's English catalog lands. The layout has one key of its own, example.signout; the sign-in screen is rastrillo's.

Settings are environment variables; main.go lists them. Set STRIPE_KEY and STRIPE_WEBHOOK_SECRET to use a Stripe test account instead of the sandbox.

Where things are

  • abono_pages.go and templates/abono/ were written by abono pages -pkg main -dir . and are not edited here, so they stay exactly what an app gets. abono's cmd/abono tests fail if they drift.
  • app.go wires it together: magic-link sign-in (rastrillo auth), abono.New with the sandbox, the pages, and the webhook and daily-sync endpoints, which csrf.Exempt lets through.
  • models.go has the user table, and the Holder that makes a user for someone who pays before signing in. The only way into that user is a sign-in link sent to the address it was made for.

Test it

go test ./...
RASTRILLO_CHROME=/usr/bin/chromium go test -tags browser -run TestBrowser .

The second drives the pages in Chromium from the plans to cancelling. It fails, rather than skips, when there is no browser. make ci at the repository root runs both.