System Architecture

ScrapApp platform — 7-service microservice architecture with unified API gateway.

Mobile Apps

iOS · Android · React Web — all communicate via API Gateway

API Gateway /gateway

Auth validation · Service routing · CORS · Unified error envelope

API Docs

Service Layer

Databases + Cloud Storage

Entity DB

30+ entities, RBAC enforced

Stripe Vault

Card/bank data — never stored locally

Private Files

ID docs, signed URLs only

Public Media

Scrap photos, receipts, logos

Gateway Usage (Mobile SDK)

All mobile requests use a single endpoint with service + action routing:

// iOS / Android — single endpoint for all services
POST /api/functions/gateway
Authorization: Bearer <token>
Content-Type: application/json

{
  "service": "matching",
  "action": "nearby",
  "payload": {
    "driver_lat": 40.7128,
    "driver_lng": -74.0060,
    "radius_miles": 10,
    "vehicle_type": "pickup_truck"
  }
}

// Response envelope (consistent across all services)
{
  "ok": true,
  "service": "matching",
  "action": "nearby",
  "data": {
    "pickups": [...],
    "total": 4,
    "surge_active": true
  }
}