Skip to main content

Architecture Overview

GlamB is built using the Modular Monolith pattern on Rails 8.1+.
Domains are organized in /app/ by folder; in the future each can be extracted into a separate Rails Engine.


Layers

┌─────────────────────────────────────────────────────────┐
│ Presentation: REST API v1 · Hotwire · ActionCable │
├─────────────────────────────────────────────────────────┤
│ Application: Controllers · Services · Serializers │
│ Pundit Policies · Query Objects │
├─────────────────────────────────────────────────────────┤
│ Domain (11 engines — Phase 1: folders in /app/): │
│ core · catalog · scheduling · booking · payments │
│ reviews · notifications · analytics · crm · admin │
│ favorites │
├─────────────────────────────────────────────────────────┤
│ Infrastructure: PostgreSQL 16 · Redis 7 · SolidQueue │
│ MinIO (S3) · ActionCable │
├─────────────────────────────────────────────────────────┤
│ External: Stripe · Twilio · SendGrid · Google Maps │
│ Firebase FCM · Cloudflare CDN │
└─────────────────────────────────────────────────────────┘

Authorization

Pundit RBAC. Every protected endpoint calls authorize or policy_scope.

PolicyResource
SalonPolicySalon CRUD and service management
AppointmentPolicyAppointments with role-based access
ApplicationPolicyBase class, deny all by default

Error Handling

All errors are centralized in BaseController via rescue_from:

ExceptionHTTPWhen
DomainErrors::NotFound404Resource not found
DomainErrors::Unauthorized401Invalid password / token
DomainErrors::ValidationError422Model/parameter validation failed
DomainErrors::Forbidden403Insufficient permissions
ActiveRecord::RecordNotFound404AR find
Pundit::NotAuthorizedError403Pundit
JwtSignature::TokenExpiredError401Expired token
JwtSignature::TokenInvalidError401Invalid token