Core Concepts
The mental models behind AMS Platform โ understand these concepts and everything else clicks into place.
Multi-Tenancy
AMS is a multi-tenant platform. This means a single installation of the software serves many independent organisations simultaneously, with complete data isolation between them. Think of it like an apartment building โ one building, many separate apartments, each with its own locks, furniture, and residents.
Each organisation on AMS is called a Tenant. When PASHA (Pakistan Association of Shipping Agents) signs up, they get their own tenant. When LCCI (Lahore Chamber of Commerce) signs up, they get their own separate tenant. Neither can see the other's data under any circumstances.
- All data is scoped by
tenant_idat the database level โ every query automatically filters by the current tenant - Tenants can be accessed via subdomain, path prefix, or custom domain
- Each tenant has its own settings, branding, modules, and team
- A Super Admin can view and manage all tenants from the platform control panel
Members as Companies
Unlike consumer platforms where a "member" is an individual person, AMS is designed for B2B associations. The primary unit of membership is typically a company or organisation, not an individual.
For example, in a shipping agents association, the member is "ABC Shipping Ltd." โ not Ahmed Khan personally. Ahmed Khan (the CEO) is the Primary Contact for that member company. His company may also have secondary contacts (COO, GM, etc.) who can log in with limited access.
- Member Company โ The registered entity (e.g. "ABC Shipping Ltd.")
- Primary Contact โ The CEO/CXO who has full access to the member portal
- Secondary Contacts โ Additional staff from the same company with view-only or limited access
- Membership dues, invoices, and certificates are issued to the company, not the individual
Role Hierarchy
AMS uses a 5-level role hierarchy. Permissions cascade downward โ higher roles have all permissions of lower roles plus additional ones. Roles are assigned per-tenant; a user's role in one tenant does not affect their access in another.
| Role | Scope | Who It's For | Key Capabilities |
|---|---|---|---|
| ๐ Super Admin | Platform-wide | Platform operator / SaaS owner | Create/manage all tenants, system settings, billing, impersonate any user |
| ๐ก๏ธ Admin | Tenant-wide | Association executive director / IT admin | Full control of one organisation: members, events, finance, team, settings |
| ๐ Manager | Module-level | Department heads, committee chairs | Manage specific modules assigned by Admin (e.g. Events Manager) |
| ๐ท Staff | Operational | Reception, data entry, event coordinators | Day-to-day ops: member support, event check-in, data entry |
| ๐ค Member | Self-service | Association members | Own profile, member directory, events, jobs, chat, documents |
Tenant Isolation
Every database query in AMS is automatically scoped to the current tenant. This is enforced at the model level via a global query scope โ developers cannot accidentally query across tenants.
// All queries automatically include WHERE tenant_id = ? $members = Member::where('status', 'active')->get(); // SQL: SELECT * FROM members WHERE tenant_id = 'ten_pasha' AND status = 'active' // The tenant_id is resolved from the request automatically: // 1. Subdomain: pasha.ams.hkus1.s4s.host โ tenant_id = ten_pasha // 2. JWT token claims contain the tenant_id // 3. API key is scoped to a single tenant at creation time
Module System
AMS is built as a collection of Modules. Each module is an independent feature area that can be enabled or disabled per tenant. This keeps the interface clean โ members only see features that are active for their association.
API Authentication Model
AMS uses Laravel Sanctum for API authentication. Sanctum provides two mechanisms:
- SPA Authentication โ Cookie-based sessions for the Next.js frontend (CSRF protected)
- API Token Authentication โ Bearer tokens for third-party integrations and mobile apps
Every API token is scoped to a single tenant at creation time. Tokens can be given granular abilities (e.g. members:read, events:write) to limit their scope.
# All API requests use Bearer token authentication curl -X GET https://pasha.ams.hkus1.s4s.host/api/v1/admin/members \ -H "Authorization: Bearer 1|abc123defghij..." \ -H "Accept: application/json"
Webhook Event System
AMS emits webhooks for all major lifecycle events. Webhooks are sent as POST requests to your configured endpoint with a JSON payload and an X-AMS-Signature HMAC header for verification.
| Event | Trigger | Payload |
|---|---|---|
| member.created | New member added | Full member object |
| member.updated | Profile changed | Changed fields + member ID |
| member.renewed | Membership renewed | Member + invoice object |
| event.registered | Member registers for event | Registration + event + member |
| invoice.paid | Payment received | Invoice + payment details |
| invoice.overdue | Invoice past due date | Invoice + member + days overdue |
Data Model Overview
The core entities in AMS and their relationships:
Tenant (1)
โโโ Users (many) โ Admin, Manager, Staff, Member accounts
โโโ Members (many) โ Member companies / individuals
โโโ Contacts (many) โ Primary + secondary contacts per member
โโโ Invoices (many) โ Dues, event tickets, ad-hoc charges
โโโ Events (many)
โโโ Registrations โ Which members registered
โโโ Tickets โ Ticket types and pricing
โโโ JobPostings (many)
โโโ ChatChannels (many)
โโโ Messages (many)
โโโ Campaigns (many) โ Email / SMS campaigns
โโโ Reports (many) โ Saved report configurations