Shipping SaaS faster
Three battles you can stop fighting when your boilerplate already solved them — and where to spend the time you saved.
Three battles you can stop fighting when your boilerplate already solved them — and where to spend the time you saved.
Every SaaS dev hits the same three walls early. Most kill momentum. Here's how Nextmonorepo defuses each one.
Adding orgs and teams late is brutal. Every query needs a WHERE organizationId = ?, every dashboard needs a switcher, every test fixture needs a tenant. We ship withTenant() plus Postgres RLS with FORCE ROW LEVEL SECURITY from day one — the wrong query just returns nothing.
Better Auth's Stripe plugin handles subscription lifecycle, but invoice events (invoice.payment_failed, invoice.payment_action_required) are on a separate endpoint with its own secret. Idempotency is enforced via a processed_webhooks table so retries don't double-charge anything.
streamText is one line. Costs are not. We instrument every AI call with experimental_telemetry (auto-exported to Langfuse) and enforce a rolling 30-day token cap per organization. When you hit pro 5M tokens, the API responds 429 before you spend $200 by accident.
Docker Compose for staging and production, Dokploy-friendly, with backend + scheduler as separate services. Migrations run in CI. Done.