Root Directory
Backend Structure (app/)
The Laravel backend is organized into logical namespaces that separate system and tenant concerns:
Key Directories
app/Actions/
app/Actions/
Custom action classes for specific business logic.These handle authentication flows like user registration and password resets.
app/Http/Controllers/
app/Http/Controllers/
Controllers organized by domain (System vs Tenant).
app/Models/
app/Models/
Eloquent models split by system and tenant databases.Important: System models connect to the central database, while Tenant models live in isolated tenant databases.
app/Services/
app/Services/
Business logic and complex operations.
Example: System Model
TheTenant model demonstrates the multi-tenant architecture:
app/Models/System/Tenant.php
Frontend Structure (resources/js/)
The Vue.js frontend follows a component-based architecture with Inertia.js for server-side routing:
Application Entry Point
resources/js/app.ts
Routes Structure
The application uses multiple route files to organize different domains:- web.php
- tenant.php
- settings.php
Main system routes (central domain):
routes/web.php
Database Structure
The project uses a multi-database architecture:Multi-Tenancy Pattern: Each tenant gets their own isolated database. Central database stores tenant metadata, while tenant databases store customer-specific data.
Configuration Files
Key configuration files in theconfig/ directory:
Key Files
composer.json
Defines PHP dependencies including Laravel 12, Inertia.js, Fortify, and Tenancy packages.
package.json
Frontend dependencies: Vue 3, Vite, Tailwind CSS 4, TypeScript, and UI libraries.
vite.config.ts
Vite build configuration with Vue, Tailwind, and Wayfinder plugins for type-safe routing.
tsconfig.json
TypeScript compiler configuration with path aliases and strict type checking.
Multi-Tenant Architecture
The project implements a database-per-tenant strategy:- Central Database: Stores system users, tenants, plans, and subscriptions
- Tenant Databases: Isolated databases for each customer with their own users and data
- Domain-Based Routing: Tenants access via subdomains (e.g.,
customer.yoursaas.com)
Next Steps
Frontend Development
Learn about Vue 3, Inertia.js, and component development
Backend Development
Explore Laravel architecture, services, and multi-tenancy
Testing
Understand the testing strategy and running tests