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)
│ ├── landing/ # Landing page
│ └── ui/ # Frontend (React + Vite)
├── packages/ # Shared libraries
│ ├── api-types/ # Shared types between API and UI
│ └── payments/ # Payment logic (MercadoPago/Polar)
└── tools/ # Configuration tools and scriptsApplications
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/api. - 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 (MercadoPago, Polar), letting you swap or update billing logic without affecting the rest of the system.