How niteshdass/billing-laravel works
1. System shape
Liberu Billing is a Laravel 12 monolith for billing, invoicing, subscriptions, and hosting service automation. The core architecture is layered: HTTP/UI entry points at the top, a service/domain layer in the middle, and Eloquent models, queues, and scheduled commands at the bottom.
2. User-facing surfaces
The app exposes three major UI surfaces through Filament 5 panel providers: an Admin panel, an App panel for operational users, and a Client panel for customers. In addition, there are classic Blade pages, Livewire screens, and a small Vue layer for richer dashboard and search widgets.
3. HTTP and API boundary
Web traffic enters through routes/web.php, while machine-oriented access is concentrated in routes/api.php. Controllers under app/Http/Controllers handle authentication, invoices, customers, subscriptions, payments, tickets, reports, and webhooks. The API also includes an invoice resource and auth endpoints, suggesting first-class programmatic access rather than a thin internal API.
4. Domain and persistence layer
The business data is modeled with many Eloquent entities: users, teams, customers, invoices, invoice items, payments, subscriptions, products/services, hosting accounts, payment gateways, knowledge base articles, tickets, quotes, webhooks, and audit logs. The database schema shows a long-lived billing domain with multi-team support, recurring billing, and operational history tracking.
5. Service layer as the main business boundary
Most business logic is pushed into app/Services, not controllers. Key service groups include billing, payment gateway orchestration, reconciliation, subscription automation, refund/dispute handling, invoicing, reporting, knowledge base, menus, site settings, webhook dispatching, and service provisioning. This is the main place where domain workflows are coordinated.
6. Automation and asynchronous processing
Background work is a major subsystem. app/Jobs, app/Console/Commands, events, listeners, and mail classes together handle recurring billing, invoice reminders, overdue service suspension, webhook processing, audit pruning, and domain synchronization. This means the system is not purely request-driven; many billing outcomes are produced by scheduled and queued processes.
7. External integrations
The repo contains explicit adapters for payment gateways, domain registrars, and hosting control panels. Control panel clients cover cPanel, Plesk, DirectAdmin, Virtualmin, Softaculous, and a Liberu-specific control panel client. Registrar clients include Enom and ResellerClub. These adapters isolate vendor-specific APIs from the rest of the billing logic.
8. Authentication, teams, and access control
Identity and account management are built on Jetstream, Fortify, Sanctum, and Socialstream. The app supports two-factor auth, API tokens, social login, and team-based access. Middleware and policies enforce team scoping and role-based access, which is important because many resources are shared across teams rather than being globally visible.
9. Admin and support tooling
Filament resources cover administrative CRUD for users, settings, payment plans, payment gateways, subscriptions, recurring billing, audit logs, menus, and more. Client-facing Filament pages and widgets expose profile, dashboard, invoices, and social links. This admin tooling is a separate concern from the customer portal and is where most internal operations happen.
10. Modular extension system
The repo includes a module framework under app/Modules with a ModuleManager, module contracts, and at least one sample BlogModule. This is a clear architectural boundary: core billing logic remains in the main app, while optional features can be packaged as modules without changing the base product.
11. Notifications, email, and document generation
Invoice generation and payment workflows produce emails and PDFs through dedicated mail classes, Blade email templates, and PDF views. Notifications such as new tickets also live in their own subsystem. Output channels are therefore centralized and reusable across the billing workflows.
12. Runtime and deployment topology
The repository is container-first. Docker assets support a standard PHP/Nginx/FPM setup as well as Laravel Octane variants using FrankenPHP, RoadRunner, and Swoole. Supervisor configurations run the app, queue workers, Horizon-like processes, and the scheduler, so the deployment model assumes multiple cooperating processes rather than a single web server.
13. Data import/export, reporting, and auditability
There is a strong reporting and compliance layer: audit logs, saved searches, reports, bulk operations, and export services. These features indicate the system is designed not just to bill, but also to provide operational visibility and traceability over customer and financial events.
Main entry points: Controllers Controllers · BillingService.php Billing services · Models Domain models · ServiceProvisioningService.php Provisioning
Components 19
UI surfaces
User-facing panels and request entry points
- Filament panels · Admin, app, and client panel providers
app/Providers/Filament - Blade/Livewire/Vue · Classic pages plus interactive dashboard widgets
resources - HTTP routes · Web and API routing entry points
routes - Controllers · Controllers for billing, support, customers, and API access
app/Http/Controllers
Core domain
Billing workflows, services, models, and persistence
- Billing services · Core billing, invoicing, subscriptions, and reconciliation logic
app/Services/BillingService.php - Provisioning · Hosting, service automation, and installation workflows
app/Services/ServiceProvisioningService.php - Reporting · Reporting, exports, audit logs, and saved searches
app/Services/ReportService.php - Support tools · Knowledge base, canned responses, tickets, and client contacts
app/Services/KnowledgeBaseService.php - Domain models · Eloquent entities for customers, invoices, subscriptions, payments, teams, and support
app/Models - Schema/seeders · Database schema evolution and bootstrap data
database/migrations
Automation
Queued, scheduled, and event-driven background work
- Jobs & commands · Queued and scheduled processes for reminders, suspension, webhooks, and sync
app/Jobs - Events/mail · Domain events, listeners, notifications, and email generation
app/Events
Integrations
External vendor adapters and API boundaries
- Payment gateways · Gateway orchestration and payment processing adapters
app/Services/PaymentGatewayService.php - Control panels · Hosting panel adapters for cPanel, Plesk, DirectAdmin, Virtualmin, Softaculous, and Liberu
app/Services/ControlPanels - Registrars · Domain registrar adapters
app/Services/Registrars - Webhooks/API · Webhook endpoints and API resources for programmatic access
app/Http/Controllers/Api
Platform
Auth, teams, modules, and deployment/runtime
- Auth & teams · Jetstream, Fortify, Sanctum, Socialstream, policies, and team scoping
app/Providers/JetstreamServiceProvider.php - Modules · Optional extension system and module manager
app/Modules - Runtime/deploy · Docker, Octane variants, supervisor processes, and container runtime
Dockerfile
Connections 22
- HTTP routes → Controllers: dispatches to · Web and API routes route requests into controller layer
- Controllers → Filament panels: renders · Controllers and panel providers shape the main UI surfaces
- Controllers → Blade/Livewire/Vue: serves · Classic pages and interactive client-side views
- Controllers → Billing services: orchestrates · Controllers delegate billing workflows to services
- Controllers → Support tools: orchestrates · Support and knowledge endpoints delegate to services
- Billing services → Domain models: reads/writes · Billing logic persists invoices, subscriptions, payments, and related records
- Provisioning → Domain models: updates · Provisioning and automation mutate hosting and service state
- Reporting → Domain models: aggregates · Reporting builds operational and financial views from persisted data
- Support tools → Domain models: manages · Support services manage tickets, KB, contacts, and responses
- Schema/seeders → Domain models: defines · Schema and seed data underpin the domain model
- Billing services → Payment gateways: uses · Billing hands off payments and reconciliation to gateway adapters
- Provisioning → Control panels: uses · Service provisioning talks to hosting control panels
- Provisioning → Registrars: uses · Domain and hosting automation uses registrar adapters
- Billing services → Jobs & commands: triggers · Recurring billing, reminders, and billing lifecycle jobs are scheduled or queued
- Jobs & commands → Events/mail: emits/consumes · Background workflows publish events and send mail/notifications
- Webhooks/API → Events/mail: notifies · Webhook and API activity feeds into asynchronous notifications
- Auth & teams → Controllers: protects · Middleware, policies, and auth services guard controller actions
- Auth & teams → Filament panels: secures · Panels are scoped by teams and roles
- Modules → Billing services: extends · Optional modules add features around the core billing app
- Modules → Controllers: registers · Module system can contribute routes and application behavior
- Runtime/deploy → Jobs & commands: runs · Containers and supervisors run workers, scheduler, Horizon-like processes
- Runtime/deploy → HTTP routes: serves · Deployment runtime serves the web/API entry points