Skip to main content

Documentation Conventions & Canonical Decisions

This file is the single source of truth for names, codes, IDs and baseline decisions used across every Spyrl document: summary.md, brd.md, prd.md, project-plan.md, architecture.md, review.md, the research and the Docusaurus site in website/. If a document disagrees with this file, this file wins. Fix the document, or change this file through a decision-log entry.

1. Naming​

TermMeaning
SpyrlWorking name of our product: a multi-tenant HCM + Field-Force CRM SaaS for Indian SMEs. Rename later with a global find/replace.
SprypleThe reference product we researched (help.spryple.com). We never copy its UI, text or assets. We only learn from its documented behaviour.
Tenant / ClientA customer organisation subscribed to Spyrl. "Client" in the business documents; tenant in technical documents.
PlatformSpyrl as operated by us: the control plane, shared infrastructure and our internal staff.
CellA deployable unit of the application plane (app containers + database + cache + storage prefix). It is either pooled (many tenants) or dedicated (one tenant).
spyrl.appPlaceholder domain used in examples. It is not registered.

2. Evidence labels (mandatory in research, BRD, PRD)​

LabelUse when
[Observed]The Spryple Help Center explicitly documents it. Cite the page with a role code, e.g. (A: Leave Management).
[Inferred]It is not stated, but it follows logically from documented workflows or screens. Give the reasoning.
[Proposed]It is our own enhancement, redesign or new feature.

Role codes for citations: SA Super Admin, A Admin, M Managers, E Employee, MOB Mobile App, I LMS Instructor (see research/source-inventory.md).

3. Module codes​

Every requirement, epic, API path and table prefix uses these codes.

CodeModuleSpryple equivalentRelease
PLTPlatform & Tenant Administration (control plane)— (not exposed; Spryple "Super Admin" is a tenant role)R1 (core)
ORGOrganisation Setup & MastersEmployee Mgmt → company, department, designation, location, logo, holidaysR1
IAMIdentity, Access & SecurityUsers Login, Roles & Permissions, HR Policies (password rules), Password Reset, Device ApprovalsR1
EMPCore HR & OnboardingEmployee Mgmt → new hires, directory, documents, checklists, induction, Excel uploadR1
ATTAttendance, Shifts & TimeAttendance Mgmt (all roles), Spryple Lite, HCM attendanceR1
LVELeave & HolidaysLeave Mgmt (all roles)R1
PAYPayroll & Statutory Compliance (India)Payroll Mgmt (Finance Admin / Finance Manager / Employee)R1
NTFNotifications & Workflow (approvals engine)Implicit everywhere (emails, reminders, alerts, Messages Master)R1
RPTReporting, Dashboards & ExportsSuper Admin dashboard + per-module reportsR1 (standard) → R4 (advanced)
MOBMobile app (single app, role-based) + Kiosk modeSpryple HCM, Spryple Lite, Spryple CRM, Claims appR1 (ESS/MSS) → R2 (kiosk/face)
CLMClaims & Expense ReimbursementClaims Mgmt (web + mobile)R2
EXTExit & Full-and-Final SettlementExit MgmtR2
ENGEngagement: Announcements, RecognitionAnnouncements, Rewards & RecognitionR2
FFMField Force & Sales CRMCRM Field Force Mgmt, Sales CRM web/mobileR3
TSMTimesheets & ProjectsTime Sheet MgmtR3
LMSLearning ManagementLMS (Admin, Manager, Employee, Instructor)R4

4. Roles​

Roles are bundles of permissions plus a data scope. Tenants can clone them and create custom roles ([Proposed]). The reporting-manager relationship comes from the org hierarchy and is not a manually assigned role.

Tenant roles​

Role keyNameSpryple equivalentDefault data scope
org_ownerOrganisation OwnerSuper AdminORG
hr_adminHR Administrator (configuration)AdminORG
hr_managerHR Manager (operations)HR ManagerORG or LOCATION
finance_adminFinance Administrator (payroll configuration)Finance AdminORG
payroll_managerPayroll / Finance Manager (runs payroll, finance approvals)Finance ManagerORG or LOCATION
line_managerReporting Manager (derived from reports_to)Manager / Reporting ManagerTEAM
sales_adminSales Administrator (CRM masters)Sales AdminORG
sales_managerSales ManagerSales ManagerTEAM or LOCATION
employeeEmployee (everyone has it)EmployeeSELF
field_executiveField Executive (employee + tracking/CRM)Sales Executive / Field ExecutiveSELF
kiosk_operatorFront-desk / Kiosk OperatorReceptionistLOCATION (punch-only)
instructorLMS InstructorLMS InstructorOwn courses
auditorRead-only Auditor [Proposed]—ORG (read)

Platform roles [Proposed]​

platform_admin (full control plane), support_engineer (time-boxed, consented, audited tenant access), billing_admin (plans, invoices), release_manager (cell versions and rollouts).

Data scopes​

SELF → TEAM (direct + indirect reports) → DEPARTMENT → LOCATION → ORG. A permission check is always the pair (permission, scope), e.g. att.request.approve@TEAM.

5. Identifier schemes​

ArtifactFormatExample
Business objectiveBO-NNBO-03
Business requirementBR-<MOD>-NNBR-PAY-04
Business ruleRULE-<MOD>-NNRULE-LVE-07
Functional requirementFR-<MOD>-NNNFR-ATT-012
Non-functional requirementNFR-<CAT>-NN (CAT = PERF, SEC, AVL, SCL, OBS, PRV, ACC, I18N, MNT, CMP)NFR-SEC-04
User storyUS-<MOD>-NN with acceptance criteria AC1..n (Given/When/Then)US-LVE-03
Epic (plan)E-<MOD>-NNE-PAY-02
MilestoneM<N>M3
RiskRSK-NNRSK-05
Architecture decisionADR-NNNADR-002
Research finding (Spryple)SP-<MOD>-NNSP-ATT-04

Priorities use MoSCoW: Must / Should / Could / Won't (this release).

6. Canonical baseline decisions​

Each one is detailed in architecture.md. The rationale lives in the Docusaurus decision log.

  1. Architecture style: a modular monolith in TypeScript (NestJS 11), with strict module boundaries and an in-process domain-event bus. Services are extracted only on evidence: GPS ingest and payroll compute are the first candidates.
  2. Tenancy: hybrid, "pooled by default, dedicated on demand". Pooled cells use a shared PostgreSQL database with a shared schema, tenant_id on every tenant-owned row, and PostgreSQL Row-Level Security as defence-in-depth. Dedicated cells (Enterprise plan) run the same images and migrations with their own database, and optionally their own full stack. A single release train serves both.
  3. Control plane vs application plane: tenant registry, provisioning, plans and billing, feature flags/entitlements, the cell map, version rollout and support access all live in a separate control-plane service and database.
  4. Data: PostgreSQL 16+, accessed through Prisma ORM (team familiarity) using a tenant-scoped client extension that sets the tenant ID transaction-locally (set_config('app.tenant_id', …, true)). Redis is used for cache, rate limits and BullMQ queues. Files go to S3-compatible object storage with tenant-prefixed keys and presigned URLs. GPS points go to monthly-partitioned tables.
  5. Configuration model: effective-dated, versioned, typed policies (JSON-schema-validated) assigned by applicability rules (location / department / designation / employment type / grade). This replaces numbered free-text "rules" and fixes "changes apply only to new employees" (Spryple).
  6. Frontend: a single web SPA built with Vite + React 19 + TypeScript + Tailwind 4 + shadcn/ui + TanStack Query, with role-aware navigation (matching lookin-hr). The mobile app is a single Expo (Expo Router) app with role-based navigation, an offline punch queue and a kiosk mode.
  7. Tenant addressing: https://{tenant}.spyrl.app for web, a company code for mobile login, and custom domains (CNAME + automatic TLS) on the Enterprise plan.
  8. Auth: built-in auth (argon2id passwords, short-lived JWT access + rotating refresh tokens, mobile device binding), TOTP MFA (mandatory for admin roles), and OIDC SSO (Google Workspace, Microsoft Entra ID) on paid plans. There are no default shared passwords: users activate through one-time invite links.
  9. Hosting: data stays in India (AWS ap-south-1 Mumbai primary, ap-south-2 Hyderabad for DR copies). Docker images are used everywhere. Dev/UAT run on Dokploy (existing team practice). Production starts as Stage A: Dokploy-managed containers on EC2, with managed RDS PostgreSQL (PITR) + ElastiCache + S3. It graduates to Stage B (ECS Fargate, Terraform) when the scale or SLA triggers in architecture.md are met.
  10. CI/CD: GitHub Actions → container registry → migrate (expand/contract) → canary cell → progressive rollout across cells.
  11. Observability: OpenTelemetry traces, metrics and logs with a tenant_id attribute; Sentry for errors; Grafana dashboards and alerting.
  12. Billing: a per-active-employee-per-month (PEPM) price with plan tiers Lite / Standard / Professional / Enterprise, add-ons (Field Force, LMS) and metered usage (SMS/WhatsApp, GPS-tracked users, storage). Razorpay Subscriptions is used for India.
  13. Compliance posture: DPDP Act 2023 (and its Rules) for personal data, explicit consent for biometric and location data, India labour/payroll statutes (EPF, ESI, PT, LWF, TDS, Gratuity), and the Labour Codes. Statutory rates are configurable reference data, never hard-coded.

7. MVP & release scope (canonical)​

ReleaseThemeModules
R0FoundationsPLT (provisioning, plans, flags), IAM, ORG, NTF core, audit, CI/CD, observability
R1 — MVPAttend-to-Pay coreEMP, ATT (web/mobile punch with selfie + geo-fence, shifts, rotations, week-offs, regularization, permissions, OT, biometric CSV/API import), LVE, PAY (India statutory: EPF, ESI, PT, LWF, TDS with IT declarations, ECR/ESI/PT files, bank files), RPT (standard), MOB (ESS + MSS)
R2Complete HR lifecycleCLM, EXT (+ F&F), ENG, MOB kiosk + face verification, biometric device gateway, Form 16 / 24Q outputs, public API & webhooks
R3Field & projectsFFM (tracking, CRM pipeline, travel), TSM
R4Learning & scaleLMS, advanced analytics, dedicated-cell automation, accounting/ERP API integrations (Zoho Books, ERPs). Tally XML/CSV journal export ships in R2

8. Writing style​

  • Write in plain English and keep it practical. Use tables for structured facts and Mermaid for diagrams.
  • Use .md files (CommonMark). Docusaurus is configured with markdown.format: 'detect', so .md files are not parsed as MDX. Do not use JSX in .md files.
  • Root canonical documents link only to each other, to research/, and to CONVENTIONS.md using relative links. The sync script mirrors them into website/docs/reference/, so those links keep working.
  • Never state a Spryple capability without an [Observed]/[Inferred] label and a citation.
  • Treat statutory rates and thresholds as examples to verify, and label them that way.

9. Documentation site layout (Docusaurus, website/docs/)​

FolderContentOwner
intro.md, product/Welcome, product overview, personas & roles, glossaryProduct
reference/Generated. It is synced from the root canonical files by website/scripts/sync-docs.mjs. Never edit it by hand.—
modules/One design spec per module (PLT, ORG, IAM, EMP, ATT, LVE, PAY, NTF, RPT, MOB, CLM, EXT, ENG, FFM, TSM, LMS)Product + Eng
features/Feature catalogue (every feature with label, release, MoSCoW)Product
workflows/End-to-end cross-module journeysProduct
architecture/System design, tech stack, decision logEng
data/Data-model conventions, ERDs, data dictionaryEng
api/API conventions, endpoint catalogue, events & webhooksEng
integrations/External integrationsEng
operations/Deployment, client onboarding, administration, backup/DR, observability, upgradesOps
security/Security overview, RBAC permission matrix, privacy (DPDP)Security
quality/Testing strategy, maintenance & supportQA
roadmap/Roadmap and MVPProduct

Docs pages link to canonical documents with relative paths such as ../reference/prd.md. Every page starts with front matter that contains title, sidebar_position and a one-line description.


Synced from /CONVENTIONS.md in the repository root. Edit the root file, not this page.