System Architecture

Fairlx System Architecture

Comprehensive interactive architecture diagrams for the Fairlx project management platform — covering every API route, database collection, service integration, and data flow across 200+ endpoints and 60+ collections.

200+
API Endpoints
60+
DB Collections
35
Route Groups
45
Feature Modules
7
External Services
4
RBAC Layers
5
Auth Methods
5
Cron Jobs
Explore Diagrams

Architecture Diagrams

Cloud Architecture

Interactive infrastructure topology — 7-tier layout from Client through Edge, Compute, Middleware, Backend Services, and External Services. Click any node for detailed endpoint lists and architecture specs.

Next.jsHonoAppwriteRazorpaySocket.IOGemini

Sequence Diagrams

Step-by-step message flows between all system actors — covering auth (registration → 2FA → session), file uploads, Razorpay payments, task CRUD, real-time notifications, and org member onboarding.

6 FlowsAuthPaymentNotificationsTasks

Entity-Relationship Diagram

All 60+ Appwrite collections organized by domain — Core PM, Spaces & Workflows, RBAC, Billing/Wallet, Notifications, Custom Fields, GitHub Integration, Usage Metering, Organizations, and Programs. Every foreign key and relationship shown.

60+ Collections10 Domains3 BucketsRelations

System Flowcharts

Detailed decision flows with branching logic — Authentication Lifecycle (7 states, 5 methods), Task Creation (workflow validation + RBAC), Billing State Machine (ACTIVE→DUE→SUSPENDED), 4-layer RBAC resolution, Notification dispatch, File upload pipeline.

6 FlowchartsAuthBillingRBACUploads

BPMN Process Diagrams

Business process swimlane diagrams showing cross-actor responsibilities — Task Lifecycle (5 lanes), Billing & Invoice Cycle (4 lanes with cron triggers), Sprint Management, and Organization Member Onboarding (5 lanes).

4 ProcessesSwimlanesGatewaysTimer Events

User Flow Diagram

Interactive end-to-end system flow — from user browser through Cloudflare edge, Next.js application server, 35+ API route modules, Appwrite backend, notification dispatch, cron jobs, RBAC layers, and 7 external service integrations. Click any node for details.

10 LayersLogosInteractiveFull SystemEdge→Backend

Deep Dive Analysis (MD)

1142-line exhaustive Markdown document covering every API route (35 groups, ~200 endpoints), all 60+ collections with purposes, middleware pipeline, auth system, billing, RBAC, usage metering, cron jobs, and data flow diagrams.

1142 LinesMarkdownComplete API MapReference
Tech Stack

Technology Stack

Next.js 14+
Next.js 14+
Frontend + SSR

React 18, TailwindCSS, shadcn/ui components. Server-side rendering with App Router. Custom server.ts wrapping for Socket.IO WebSocket support.

Hono
Hono
API Framework

All 200+ API routes registered at /api/[[...route]]. Zod validation via @hono/zod-validator. Session + billing + traffic metering middleware stack.

Appwrite
Appwrite
BaaS (Auth, DB, Storage)

Primary backend: 60+ collections, 3 storage buckets, email/password + OAuth + 2FA auth, SMTP messaging, Realtime subscriptions. Session + Admin client patterns.

Razorpay
Razorpay
Payment Gateway

Wallet-only prepaid model (no subscriptions). USD→INR conversion. HMAC-SHA256 signature verification. Webhook handler with idempotency. Daily ₹5L limit.

Socket.IO
Socket.IO
Real-time WebSocket

Custom HTTP server wrapping Next.js. User-scoped rooms (user:{userId}). Internal /socket-push endpoint with secret auth. notification:new events.

Google Gemini
Google Gemini
AI Features

Workflow AI (suggest statuses, transitions, generate, analyze). GitHub code documentation generation (max 50 files). Codebase Q&A. Project doc AI summarization.

Supabase
Supabase
Landing Page DB

PostgreSQL for GitHub Star rewards coupon system. Service role key (server-only). Tables: coupons, audit_logs, user_suspensions. Rate-limited redemption.

GitHub API
GitHub API
Repository Integration

Repository linking to projects. File tree fetching, commit history. Code documentation generation pipeline. GitHubAPI class with optional personal access token.

Highlights

Architecture Highlights

4-Layer RBAC
4-Layer RBAC
Permission System

Workspace (6 built-in + custom roles) → Organization (department-based + per-user grants) → Project (project roles + team permissions) → Space (public/private + member roles).

3-Type Usage Metering
3-Type Usage Metering
Billing Infrastructure

Traffic (batched 60s, API request bytes/duration), Storage (per-file +/- bytes), Compute (50+ weighted job types). Monthly invoice generation with wallet deduction.

Multi-Channel Notifications
Multi-Channel Notifications
Event-Driven Dispatch

23 event types dispatched in parallel to 3 channels: Socket.IO WebSocket push, Appwrite SMTP email, Database notification records. Plus project webhooks with HMAC signing.

Billing State Machine
Billing State Machine
ACTIVE → DUE → SUSPENDED

Wallet-based prepaid billing. Monthly cron invoice generation. 14-day grace period with day 1/7/13 reminders. CAS-based deduction. Automatic reactivation on payment.