Mercado Pago + Polar

The TypeScript starter for B2B SaaS
that charges in LatAm and worldwide.

Beztack is a monorepo starter with Mercado Pago and Polar billing, Better Auth organizations, a Vite + React app and a Nitro API. Plan changes, proration preview and admin retries are already built.

pnpm create beztack

Built on Modern Tools

This project wouldn't be possible without the following gems

Vite logo
Vite
React logo
React
shadcn/ui logo
shadcn/ui
Nitro logo
Nitro
better-auth logo
better-auth
Drizzle logo
Drizzle
T3 Env
nuqs logo
nuqs
Zod logo
Zod
AI SDK logo
AI SDK
Next.js logo
Next.js
Fumadocs

Project Architecture

Three apps, one monorepo. Each optimized for its purpose.

React

apps/ui

Frontend SPA

ViteViteReactReact
  • Fast HMR & instant refresh
  • shadcn/ui components
  • Client-side routing
Nitro

apps/api

Backend Server

NitroNitroh3
  • Portable Nitro build
  • File-based routing
  • Zod-validated handlers
Next.js

apps/docs

Landing & Docs

Next.jsNext.jsFumadocs
  • SSR & static generation
  • MDX documentation
  • Full-text docs search
Deployment•Nitro API for Node.js and Vercel, static SPA for the UI

Everything You Need

Ship faster with best practices and modern architecture built-in

Better Auth

Authentication Ready

Email and password sign-in with better-auth, plus two-factor, organizations with invitations and an admin role. Other sign-in methods are not set up yet.

Integrated Plugins

  • 2FA Support
  • Admin & Roles
  • Organizations

Roadmap (not implemented yet)

OAuthHave I Been PWNDMagic LinkMulti SessionPasskeyAPI Key
Drizzle

Type-Safe Database

Drizzle ORM with full TypeScript support. Write queries with confidence, autocomplete, and zero runtime overhead.

constusers=awaitdb
.select()
.from(users)
.where(...)
Payments
PaymentsPayments

Payments

Two providers behind one adapter interface, selected with the PAYMENT_PROVIDER environment variable. Charge in local currency with Mercado Pago, or sell worldwide through Polar.

Included providers

  • Mercado Pago - local-currency subscriptions in Latin America
  • Polar - merchant of record, SaaS and digital products only

Billing flows in the API

  • Upgrades, downgrades and cadence changes (Polar only for cadence)
  • Proration preview before the customer accepts
  • Pending plan change ledger, activated on renewal
  • Admin tier overrides, no charge
  • Admin retry for failed plan changes
shadcn/ui

Modern UI Components

Beautiful, accessible components with shadcn/ui. Customizable and production-ready out of the box.

shadcn/uishadcn/ui
nuqs

URL State Management

Type-safe URL search params with nuqs. Synchronize component state with the URL effortlessly with full TypeScript support and SSR compatibility.

Type-safe parsers
const[page, setPage]=
useQueryState(
"page",
parseAsInteger
)

Built-in Parsers

StringIntegerFloatBooleanEnumArrayJSONDateTime
nuqsnuqs
Vercel AI SDK

AI SDK Package

@beztack/ai re-exports the Vercel AI SDK and configures an Amazon Bedrock provider. It is a starting point: no app uses it yet and the API has no AI routes.

Streaming responses
import{streamText}
from'@beztack/ai'
constresult=await
streamText({ ... })

Provided by the AI SDK

StreamingTool CallingStructured OutputMulti-ModalEmbeddings
Vercel AI SDKAI SDK
Zod

TYPE_SAFE_ENV

Powered by T3 Env and Zod. Environment variables validated at build time with full TypeScript support.

Env
ZodZod
Vite

RAPID_DEVELOPMENT

Powered by Vite. Experience hot module replacement, instant server start, and optimized build times.

ViteVite
pnpmNX

MONOREPO_ARCHITECTURE

Powered by pnpm workspaces and NX. Efficient dependency management and task orchestration. Template Sync, which delivers template updates as pull requests, is on the roadmap and not available yet.

pnpmpnpm
NXNX
Template Sync (roadmap)

Start with billing already built

Scaffold a project, add your Mercado Pago or Polar credentials and run it locally.

pnpm create beztack