Skip to content
SaaS4Builders
Getting Started

Introduction

What SaaS4Builders is, what it includes, and how it accelerates SaaS development with Laravel and Nuxt 4.

SaaS4Builders is a production-ready, multi-tenant SaaS boilerplate built with Laravel 13 and Nuxt 4. It gives you authentication, billing, teams, usage tracking, and internationalization out of the box — so you can focus on your product logic instead of rebuilding infrastructure.

This is not a starter kit with a login page and a TODO list. It is a complete, opinionated foundation for subscription-based SaaS applications, with Stripe integration, single-database multi-tenancy, role-based access control, and a full Docker development environment.

You bought it to ship faster. This documentation shows you how.


The Problem

Building a SaaS from scratch is repetitive, slow, and error-prone. You spend weeks on authentication, billing integration, tenant isolation, and team management before writing a single line of product code.

Most existing boilerplates fall short:

  • Too closed — products like Laravel Spark or Paddle Billing lock you into their opinions with limited extensibility.
  • Too product-specific — tools like ShipFast or Supastarter are optimized for a single use case.
  • Incompatible stacks — few boilerplates combine a Laravel API backend with a modern Nuxt frontend.

SaaS4Builders fills this gap: a full-stack, modular boilerplate with built-in AI agent support that eliminates setup friction while staying fully extensible.


Feature Overview

Authentication and Authorization

Sanctum-based token authentication with access and refresh tokens. OAuth login via Google and GitHub through Laravel Socialite. Role-based access control powered by Spatie Laravel Permission, with a full permission hierarchy across platform admins and tenant-scoped roles (owner, admin, member). Impersonation support for platform administrators.

Multi-Tenancy

Single-database multi-tenancy with automatic tenant_id scoping via a global Eloquent scope. A BelongsToTenant trait on models enforces data isolation. Tenant resolution happens through middleware based on the authenticated user. No data leaks — and tests verify it.

Billing and Subscriptions

Full Stripe integration supporting three pricing models:

  • Flat-rate — fixed monthly or yearly price
  • Seat-based — price per team member
  • Usage-based — metered billing tied to usage events

Includes Stripe Checkout, subscription lifecycle management (trialing, active, past_due, canceled), invoice sync via webhooks, optional Stripe Tax, and multi-currency support. The boilerplate ships with EUR, USD, GBP, and CHF pre-configured, but you can add any currency supported by Stripe. The SaaS application is the seller of record — Stripe handles payment processing.

Teams

Invite team members by email with token-based invitations. Assign roles: owner, admin, or member — each with a distinct permission set. Create custom roles per tenant. Transfer ownership. Seat-based billing enforces team size limits automatically.

Usage Tracking

Record usage events against named meters (e.g., api_calls). Enforce quotas through entitlements tied to plan features. Track consumption over time for metered billing and analytics.

Internationalization

Ships with four locales out of the box: English, French, Spanish, and Italian. You can add, replace, or remove locales — the i18n system is fully extensible. Backend translations use Laravel's lang/ short-key files organized by domain. Frontend translations use Nuxt i18n with JSON locale files. Model translations (product names, plan descriptions) use astrotomic/laravel-translatable.

Developer Experience

A complete Docker development environment with nine services, a Makefile with 30+ commands, PHPStan at level 9, ESLint in strict mode, PHPUnit for backend tests, and Vitest for frontend tests. CI-ready with GitHub Actions.

Notifications

Web push notifications via VAPID keys, with a service worker for browser delivery. Real-time broadcasting through Laravel Reverb (WebSocket) for instant in-app updates. Backend dispatches notifications; the frontend handles permission requests, display, and live event listening.


Who Is It For

  • Freelance developers building SaaS products who need a reusable, professional-grade skeleton.
  • Web agencies delivering repeatable client projects on a consistent technical foundation.
  • Indie hackers who want to launch an MVP in days, not months.
  • Internal dev teams building tools and platforms on a proven stack.

The boilerplate assumes you are proficient with Laravel and Nuxt. It is not a tutorial — it is a foundation for professionals.


Tech Stack

LayerTechnologyVersion
Backend frameworkLaravel12
PHPPHP8.3+
Frontend frameworkNuxt4
LanguageTypeScriptStrict mode
State managementPiniaComposition API
ValidationZodRuntime schema validation
UI componentsNuxt UITailwindCSS v4
DatabasePostgreSQL16
Cache / Queue / SessionsRedis7
ContainerizationDocker ComposeMulti-service setup
AuthenticationLaravel Sanctumv4
AuthorizationSpatie Laravel PermissionRole + permission based
BillingStripeCheckout, webhooks, invoicing
OAuthLaravel SocialiteGoogle, GitHub
Backend analysisPHPStan (Larastan)Level 9
Backend formattingLaravel PintPSR-12
Backend testsPHPUnitv12
Frontend lintingESLintStrict
Frontend testsVitestComponent + composable tests

Architecture at a Glance

Backend: DDD-Inspired Layers

The Laravel backend follows a domain-driven directory structure with four layers:

backend/app/
├── Domain/          # Pure business logic: Enums, ValueObjects, Contracts, Rules
├── Application/     # Use cases: Actions (mutations), Queries (reads), Input DTOs
├── Infrastructure/  # External integrations: Stripe provider, mappers
├── Http/            # API surface: Controllers, FormRequests, Resources
├── Models/          # Eloquent models
├── Policies/        # Authorization policies
├── Support/         # Cross-cutting helpers and traits
└── ...              # Providers, Jobs, Mail, Events, etc.

Every request follows a predictable flow:

HTTP Request → FormRequest (validate + toDto()) → Action or Query → Eloquent Model → Resource → JSON Response

Controllers are thin — they delegate to Actions (for mutations) or Queries (for reads). Business logic lives in the Domain and Application layers, never in controllers.

Frontend: Vertical Slices

The Nuxt frontend organizes code by feature, not by file type:

frontend/
├── common/        # Shared UI components and utilities
└── features/
    ├── foundation/    # Auth, tenancy, layout — framework-level features
    ├── core/          # Billing, teams, settings — business features
    └── product/       # Your custom product features go here

Each feature module contains its own types, schemas, API client, composables, components, stores, and pages. This vertical slice architecture keeps related code together and makes features independently understandable.

API Contracts

The API follows strict conventions enforced across the codebase:

  • All JSON keys use snake_case
  • Dates use ISO-8601 format
  • Money values use amount_cents (integer) + currency (string)
  • Endpoints are versioned under /api/v1/
  • Authentication uses Bearer tokens (Sanctum)
  • Error responses follow a consistent { message, code, errors } structure

Backend Resources are the source of truth for response shapes. Frontend Zod schemas provide runtime validation of API responses.

The contract system ensures that backend and frontend stay in sync. When you add a new endpoint, the flow is always: define a Laravel Resource (snake_case output) → create a Zod schema (camelCase, auto-transformed) → derive TypeScript types with z.infer → build the API client composable → consume in components.


AI-First Developer Experience

SaaS4Builders is designed to work with AI coding agents. The codebase includes structured context that helps tools like Claude Code understand and extend the project:

  • CLAUDE.md files — Always-loaded context at the project root and in backend/ that describes architecture, conventions, and commands.
  • Skills system — On-demand context files in .claude/skills/ for specific domains (billing, frontend, multi-tenancy). Skills are loaded when relevant, keeping the AI's context lean.
  • Workplans — Structured feature specifications that AI agents can follow step by step, with objectives, file lists, and acceptance criteria.
  • Convention filesCONTRACTS.md, TEMPLATES.md, and DOMAIN-GLOSSARY.md provide the rules that keep AI-generated code consistent with the project's architecture.

This means you can use Claude Code (or similar agents) to add features, fix bugs, and extend the boilerplate — and the AI will follow the same conventions a human developer would.


What's Included

Here is a summary of everything you get with SaaS4Builders:

CategoryWhat You Get
BackendLaravel 13 API with DDD-inspired architecture, PHPStan level 9, Pint formatting, PHPUnit tests
FrontendNuxt 4 app with TypeScript, Pinia stores, Zod validation, Nuxt UI components, Vitest tests
AuthenticationSanctum SPA auth, access + refresh tokens, OAuth (Google, GitHub), impersonation
AuthorizationSpatie roles and permissions, tenant-scoped and platform-level roles
BillingStripe Checkout, flat/seat/usage pricing, subscription lifecycle, invoices, webhooks, multi-currency
Multi-tenancySingle-DB isolation with global scopes, middleware resolution, tenant-aware models
TeamsInvitations, role assignment, custom roles, ownership transfer, seat quota enforcement
Usage trackingNamed meters, usage events, quota entitlements, billing reconciliation
SettingsThree-level cascade (platform → tenant → user), cached resolution
NotificationsWeb push via VAPID, service worker, backend dispatch
i18n4 locales (EN/FR/ES/IT), backend lang files, frontend JSON, model translations
ContentNuxt Content v3 integration, Nuxt Studio visual editor support
DevOpsDocker Compose (9 services), Makefile (30+ commands), GitHub Actions CI
AI DXCLAUDE.md context files, skills system, workplan templates, convention documents

What's Next

You are ready to set up SaaS4Builders on your machine:

  1. Installation — Extract the archive, install dependencies, and start the stack.
  2. Docker Setup — Understand the services, ports, and volumes.
  3. Environment Configuration — Configure database, Stripe, mail, and more.
  4. Running the Demo — Explore the seeded demo data and walk through the application.
  5. Deployment Guide — Go to production with confidence.