Back to Portal

🛠️ Nexus CRM: Technical Architecture

GCP + React + Stripe Infrastructure Specification

1. Cloud Infrastructure (Google Cloud)

Compute

Cloud Run (Node.js API). Scales to zero.

Database

Cloud SQL (PostgreSQL 15).

AI

Vertex AI (Gemini 1.5 Flash) for Vision/Text.

Storage

Cloud Storage (Buckets: waivers-secure, public-profiles).

Auth

Firebase Authentication (Identity Platform).

2. Database Schema (Critical Tables)

organizations (The Shop)

id (UUID)
subscription_status (active, past_due, lifetime_enterprise)
stripe_connect_id (For payouts)
settings_deposit_enabled (Boolean)

appointments (The Money)

id (UUID)
client_id, provider_id
is_priority (Boolean) - Did they pay the "Skip Line" fee?
deposit_amount (Integer) - Amount held in cents (e.g., 5000)
stripe_intent_id (String) - Key to capture funds on No-Show

waivers (The Legal Lock)

id (UUID)
pdf_gcs_path (String) - Immutable path in Cloud Storage
signed_ip (Inet) - Audit trail
device_fingerprint (String)

3. Stripe Logic (The "Revenue Engine")

Booking Flow:

  1. 1

    Create PaymentIntent (Capture Method: Manual).

  2. 2

    Auth $50.00 on card.

  3. 3

    Save intent_id to DB.

No-Show Flow (The Button):

  1. 1

    Provider clicks "No Show" in Dashboard.

  2. 2

    Backend calls stripe.paymentIntents.capture(id, {amount: 5000}).

  3. 3

    Client charged $50. Shop gets $49. Nexus gets $1.

4. API Endpoints (MVP)

POST /api/v1/booking/create

Handles Availability + Stripe Auth

POST /api/v1/booking/noshow

Triggers Deposit Capture

POST /api/v1/ai/consult

Sends Image to Vertex AI → Returns Hairstyle JSON

GET /api/v1/shop/:slug

Public Profile for QR Codes

Tech Stack Summary

Google Cloud

Node.js

Stripe

PostgreSQL