Overview
Autumn manages products, usage limits, and Stripe checkout on our behalf. The Fastify server only has to expose one proxy route and identify the current customer. Follow the official Autumn setup guide to configure products and API keys, then wire the identify handler described below to finish the integration.Autumn automatically provisions customers when it receives a new
customerId, so we simply forward the 8call user or organization identifier alongside basic profile metadata.Prerequisites
autumn-jsis installed in both the server and web workspaces.- The
.envfile containsAUTUMN_SECRET_KEYfor server-side calls and the frontend is wrapped in<AutumnProvider>. - Supabase auth is configured so
getUserFromRequestcan resolve the authenticated profile.
Register the Fastify handler
1
Import the handler
Add the
autumn-js Fastify adapter alongside the existing infrastructure imports.2
Expose `/api/autumn/*`
Mount the handler in
apps/server/index.ts so every GET or POST request under /api/autumn is forwarded to Autumn.Verify the proxy
- Fetch customer state
- Trigger checkout
Troubleshooting
Troubleshooting
- 401 Not authenticated: Ensure the browser sends an
Authorizationorx-user-tokenheader sogetUserFromRequestcan fetch the profile. - Missing customer data: Confirm the Supabase profile includes
customer_id, or allow Autumn to create one on first request. - CORS errors from Vite dev: Add
http://localhost:3000to the Fastify CORS allowlist if you are proxying from the web app.