pauliemarket.com API

Internal reference

For pauliemarket.com engineers building the platform, client dashboard, and mobile apps. Not for external distribution.

This page describes internal repo layout and ops. Share API Documentation and API Howto with partners instead.

Architecture

client_dashboard_v1 (React SPA) │ OAuth password grant + Bearer token ▼ dashboard_v2 (Laravel) ──► /api/v1/pauliemarket/* │ Passport, permissions, org context ├── pauliemarket_platform DB (orgs, pools, tickets, payouts) ├── pauliemarket_club_* tenant DBs (optional per-org GDPR) └── v2_baguette_positions (trading session / PnL reads) api/flask_api.py + pauliemarket_console.py ──► /api/pauliemarket/* (dev JSON mirror, NO AUTH) api/flask_api.py ──► /api/* (operator trading analytics — separate product)

Repositories & key paths

PathRole
dashboard_v2/routes/api.phpCanonical route list — update external docs when this changes
dashboard_v2/app/Http/Controllers/Api/V1/PaulieMarketConsoleController.phpPool/ticket/payment logic
dashboard_v2/app/Http/Controllers/Api/V1/AuthController.phpLogin, client credentials, profile
dashboard_v2/app/Services/PaulieMarketOrganizationContext.phpOrg resolution (subdomain, header, query)
client_dashboard_v1/src/api/client.jsReference API consumer
pauliemarket.com/docs/PLATFORM_REFERENCE.mdProduct/business model (not API)
pauliemarket.com/external/This documentation site
dashboard_v2/docs/TENANT_ROLLOUT.mdPer-club DB provisioning

Local setup

Laravel API

dashboard_v2
cd dashboard_v2
composer install
cp .env.example .env
php artisan key:generate
php artisan migrate
php artisan db:seed
php artisan passport:install
php artisan serve

.env highlights:

  • PaulieMarket_CORS_ORIGINS=http://localhost:5173
  • PaulieMarket_TENANT_BASE_DOMAIN= — set for subdomain tenant routing
  • PaulieMarket_PASSWORD_CLIENT_SECRET / PaulieMarket_SERVICE_CLIENT_SECRET — optional fixed OAuth secrets

Client dashboard

client_dashboard_v1
VITE_API_URL=http://127.0.0.1:8000/api
VITE_OAUTH_CLIENT_ID=1   # from oauth_clients table

Demo data

Artisan
php artisan pauliemarket:fresh-demo

Permission matrix

Permission / gateEffect
pauliemarket_accessAll authenticated /v1/pauliemarket/* read routes
pauliemarket_managePlatform-wide write (assign, fund, settle) + bypass org admin check
pauliemarket.org.manage middlewareOrg membership role admin or owner, OR pauliemarket_manage
user_management_accessBots list, trade history, late90s analytics
trading:read/v1/trading/* operator API (separate from pauliemarket product)

Seeded roles: admin and operator have pauliemarket_access + pauliemarket_manage; viewer is read-only.

Regression script: dashboard_v2/scripts/test_pauliemarket_authorization.php

Multi-tenant rollout

Organizations can use a dedicated MySQL database (pauliemarket_club_{slug}) for member PII while the platform registry stays on pauliemarket_platform. See dashboard_v2/docs/TENANT_ROLLOUT.md for:

  • php artisan pauliemarket:provision-tenant {slug}
  • Subdomain routing via PaulieMarket_TENANT_BASE_DOMAIN
  • Demo tenant credentials

Flask mirror (dev only)

api/pauliemarket_console.py serves /api/pauliemarket/* from pauliemarket_data/platform.json with no authentication. Path prefix differs from Laravel (/api/pauliemarket/ vs /api/v1/pauliemarket/).

Do not point production partners at the Flask mirror. External documentation describes Laravel /api/v1/* only.

Testing

  • php dashboard_v2/scripts/test_pauliemarket_authorization.php — 19 auth/permission checks
  • Manual: login as admin@pauliemarket.com and client@pauliemarket.com via client dashboard
  • Partner contract: diff routes/api.php against pauliemarket.com/external/v1/index.html when shipping API changes

Future: OpenAPI

Generate pauliemarket.com/external/openapi/pauliemarket-v1.yaml from Laravel routes for Postman import (aligned with Future Ticketing partner workflow).

Maintaining external docs

  1. Route added/changed → update pauliemarket.com/external/v1/index.html
  2. Auth or org behavior changed → update howto.html and mobile.html
  3. Product model changed → update pauliemarket.com/docs/PLATFORM_REFERENCE.md (separate from API docs)
  4. Deploy static pauliemarket.com/external/ to CDN (e.g. external.pauliemarket.com)