Beztack

Architecture

System structure and components

Beztack is structured as a monorepo using Nx, which lets us efficiently share code between the frontend and backend.

Directory Structure

/
├── apps/               # Deployable applications
│   ├── api/            # Backend (Nitro server)
│   ├── docs/           # Documentation (Fumadocs)
│   └── ui/             # Frontend (React + Vite)
├── packages/           # Shared libraries
│   ├── api-types/      # Shared types between API and UI
│   ├── cli/            # Project scaffolding + Template Sync CLI
│   └── payments/       # Payment logic (Mercado Pago + Polar)
└── tools/              # Configuration tools and scripts

Applications

UI (apps/ui)

A React app built with Vite.

  • Styling: TailwindCSS.
  • State: React Query / Context API.
  • Auth: Better Auth client.

API (apps/api)

A Nitro server (the engine behind Nuxt) that provides a fast and lightweight REST API.

  • Routes: File-based routing in server/routes.
  • Database: Drizzle ORM (if applicable) or direct connection.
  • Auth: Better Auth Server.

Shared Packages

Reusable code lives in packages/ to keep apps clean and DRY (Don't Repeat Yourself).

  • packages/api-types: Contains TypeScript definitions for the API. This gives the frontend autocomplete and type safety when consuming the backend.
  • packages/payments: Abstraction over payment providers (Mercado Pago and Polar), letting you swap or update billing logic without affecting the rest of the system.
  • packages/cli: Project scaffolding plus Template Sync commands (status, plan, apply, rollback, inspect) for controlled template evolution.