Pagebee Academy
Step 10 of 17

Part 3, Launch · Step 10

Add sign-in, email and payments

Better Auth for sign-in, kept in your own database. Resend to send the emails. Stripe Checkout to take money. Three MCP servers, so your agent sets most of it up.

Time
A day
Cost
Free to start. Stripe takes 1.5% + 20p per UK card payment, 2.9% + 30¢ in the US

Pagebee Builder, a free Mac app, hands this step to your agent: plan it, build it on a branch, or ship it.Get Pagebee Builder

Why it matters

These three are where products leak trust. A sign-in email that lands in spam, a payment that went through but didn't unlock anything, a password reset that never arrives. Each is someone who wanted to use your product and couldn't.

Better Auth is an open-source sign-in library. Your users live in your own Postgres database, not in a sign-in company's, so you never pay per user and never have to migrate them. It's now also the home of Auth.js (NextAuth), so it's the safe pick for a new project. Start with magic links (a sign-in link by email) and add Google sign-in when people ask for it.

Resend sends those emails. The free plan is 3,000 emails a month and 100 a day, which is plenty until launch day.

Stripe Checkout is a payment page Stripe hosts for you. You never touch card numbers. Your app only needs to know when someone has paid, and Stripe tells it with a webhook (a message Stripe sends to your server).

Do this

  1. 1

    Sign up at resend.com. Add a domain under Domains, using a subdomain like mail.tally.app so your sending reputation stays separate from your normal email. Click Sign in to Cloudflare and Resend adds the DNS records for you.

  2. 2

    Sign up at stripe.com. Build everything in a sandbox first (from the account picker, Sandboxes), where the card 4242 4242 4242 4242 always works and no money moves.

  3. 3

    Add both MCP servers, then type /mcp in Claude Code to sign in to each:

    Terminal
    claude mcp add --transport http resend https://mcp.resend.com/mcp
    claude mcp add --transport http stripe https://mcp.stripe.com/
  4. 4

    Paste the prompt below. It wires up sign-in, email and payments in one pass, with a test for each.

  5. 5

    Test the payment flow on your computer with the Stripe CLI, which forwards Stripe's webhooks to your local app:

    Terminal
    brew install stripe/stripe-cli/stripe
    stripe login
    stripe listen --forward-to localhost:3000/api/stripe/webhook
  6. 6

    When it all works, add your live keys to Secret Manager, create the live webhook endpoint in the Stripe dashboard pointing at your domain, and deploy.

Paste into Claude Code

Add sign-in with Better Auth using magic links, storing users and sessions in our Postgres database. Send the emails through Resend from hello@mail.tally.app, as plain, short emails. Then add payments with Stripe Checkout in our Stripe sandbox: create the product and a £6 monthly price, a checkout button for signed-in users, and a webhook at /api/stripe/webhook that verifies the signature and marks the user as paid on checkout.session.completed. Make the webhook safe to receive twice. Keep every key in .env (and list the names in .env.example). Explain how to test each part.

Adding Google sign-in later

In the Google Cloud console, open Google Auth Platform, click Get started, and fill in Branding and Audience (choose External). Under Clients, create a web client with your domain's callback URL, and give the ID and secret to Better Auth. Ask only for name and email, and publish the app out of Testing before launch, or real users will see a warning.

Using something else

Clerk and Supabase Auth are hosted sign-in services: quicker to start, but your users live in their database and you pay per user as you grow. Postmark and Amazon SES send email well too. Paddle and Lemon Squeezy act as the seller for you and handle sales tax worldwide, for a higher fee than Stripe.