Microservices (planovi-microservices) β Business Logic & Modules
Code-Verified Blueprint: 7 modules β’ 55 documented
BR-*business rules β’ Zero-orphan file coverage.
Switch betweenLatestand frozen release snapshots using the Documentation Version dropdown at the top of the left sidebar.
Module Specifications Index
| # | Module Specification | Rule Prefix | Rules (BR-*) | Open [TEAM_WHY] |
|---|---|---|---|---|
| 1 | Public Appointment Scheduler & Google Calendar Sync | BR-SCH | 14 | 4 |
| 2 | Dealflow Interactive Offer & Live Pricing Calculator β Offer Mode | BR-OFF | 10 | 3 |
| 3 | Token-Based Onboarding & Member Declaration Forms β Token Mode | BR-DEC | 10 | 2 |
| 4 | SaaS Cooperative Onboarding Inquiry & Stripe Payment Confirmation | BR-INQ | 5 | 3 |
| 5 | eIDAS Electronic Agreement Signing Portal | BR-SIG | 7 | 2 |
| 6 | Supabase GoTrue Auth Email Templates | BR-EML | 4 | 1 |
| 7 | Shared Runtime Security, Environment Config, Brand Kit & Local Scaffold | BR-INF | 5 | 2 |
- Cross-Cutting Concerns & Shared Infrastructure β
- Open
[TEAM_WHY_NEEDED]Questions & Tech Debt Board β
Repository Snapshot & Runtime Metadata
- Repository:
PA-IDEAS/planovi-microservices - Branch & HEAD Commit:
develop@96144c89 - Primary Stack & Pinned Versions:
- Runtime (Production/VPS): Plain PHP (no framework currently active in
dealflow/,scheduler/,agreements/;README.mdnotes VPS runs PHP 8.3 FPM managed byplanovi-vps). - Runtime (Local Docker Scaffold for future Laravel migration):
php:8.2-fpm-alpine(Dockerfile.local:1) with extensionspdo_pgsql,pgsql,exif,pcntl,bcmath,gd(Dockerfile.local:3),nginx:alpine(docker-compose.yml:26),axllent/mailpit:latest(docker-compose.yml:40), andcomposer:latest(Dockerfile.local:4). - Composer Dependencies (
scheduler/composer.json&scheduler/composer.lock):google/apiclient:^2.15.0(locked:v2.19.0)google/apiclient-services: lockedv0.428.0google/auth: lockedv1.50.0guzzlehttp/guzzle: locked7.10.0monolog/monolog: locked3.10.0
- Frontend CDN Libraries (unpinned/floating in PHP views):
- Tailwind CSS Play CDN (
https://cdn.tailwindcss.com) - Font Awesome
6.4.0(dealflow/offer.php:341) - Google Fonts (
Inter,Plus Jakarta Sans) - Cloudflare Turnstile
v0(https://challenges.cloudflare.com/turnstile/v0/api.js,dealflow/offer.php:343)
- Tailwind CSS Play CDN (
- Laravel Migration Status: Only
laravel-app/.env.example,Dockerfile.local,docker-compose.yml, andnginx.local.confexist in git. Zero Laravel PHP application files (app/,routes/,composer.json,public/index.php) are committed underlaravel-app/.
- Runtime (Production/VPS): Plain PHP (no framework currently active in
What This Repo Owns (and What It Explicitly Does NOT Own)
- Owns β Public & Embeddable Tenant Widgets (
<iframe>/ standalone):- Public Appointment Scheduler UI, slot calculation engine, double-booking guard, Google Calendar OAuth & event creation (
scheduler/). - Public Dealflow interactive Offer / Live Pricing Calculator wizard and lead submission (
dealflow/offer.php?id=...,dealflow/api/save_response.php). - Token-gated Member Onboarding & Company Details Declaration multi-step forms with HTML label sanitization, preview/board-edit modes, and HTML5 canvas handwritten signature pad (
dealflow/offer.php?token=...,dealflow/api/form-writer.php). - Public SaaS Cooperative Inquiry funnel and Stripe post-checkout confirmation screens (
dealflow/inquiry.php,dealflow/inquiry-success.php,dealflow/payment-success.php). - Public eIDAS Electronic Agreement Signing UI (
agreements/sign.phpand identical copydealflow/sign.php).
- Public Appointment Scheduler UI, slot calculation engine, double-booking guard, Google Calendar OAuth & event creation (
- Owns β Flat-File JSON Configuration Endpoints & Auth Email Templates:
- Server-to-server JSON config writers/deleters for Flutter/Supabase (
save_scheduler.php,save_dealflow.php,create_offer.php,form-writer.php,delete_json.php). - All 9 Supabase GoTrue HTML auth email templates (
dealflow/email-templates/*.html). - Synced canonical Planovi brand assets (
assets/brand/*,BRANDING_GUIDE.md,scripts/sync-brand.sh).
- Server-to-server JSON config writers/deleters for Flutter/Supabase (
- Explicitly Does NOT Own:
- Database schema, PostgreSQL migrations, RLS policies, RPCs, or Supabase Edge Functions: Owned by
planovi-backend(this repo callssubmit-member-declaration,update-member-declaration,submit-company-details,submit-inquiry,signing-api, PostgREST tablesscheduler_bookings&dealflow_entries, RPConboarding_token_status, and Storage bucketcompany-media). - Admin / Tenant Configuration UI & Mobile/Web Panel: Owned by
planovi-flutter-app(creates scheduler/dealflow configs, triggerssave_scheduler.php/save_dealflow.php/create_offer.php, manages bookings, reviews declarations, initiates agreements). - VPS Nginx Reverse Proxy, TLS, Domain Routing, and GoTrue Mounts: Owned by
planovi-vps(routesdev-dealflow.*/dealflow.*,dev-scheduler.*/scheduler.*,dev-agreements.*/agreements.*, and servesdealflow/email-templates/viavps-proxy:8080/email-templates/). - Marketing Website & Documentation Hub: Owned by
planovi-webpageandplanovi-docs(canonical source forBRANDING_GUIDE.mdandassets/brand/). - Transactional Resend Emails & Stripe Webhooks / Provisioning: Owned by
planovi-backendEdge Functions (this repo only renders confirmation pages and calls Edge Functions).
- Database schema, PostgreSQL migrations, RLS policies, RPCs, or Supabase Edge Functions: Owned by
Directory Map
.βββ AGENTS.md # AI/dev repo rules (Zone 1 vs Zone 2 branding, no .env secrets)βββ CLAUDE.md -> AGENTS.md # Symlink to AGENTS.mdβββ BRANDING_GUIDE.md # Canonical ecosystem brand & design tokens guide (synced from planovi-docs)βββ README.md # Local Laravel/Docker dev setup guide + legacy microservices noteβββ config.php # Host-based ENVIRONMENT / BASE_URL / SCHEDULER_URL / DEALFLOW_URL constantsβββ Dockerfile.local # PHP 8.2-FPM Alpine image for local Laravel scaffoldβββ docker-compose.yml # Local app + nginx (port 8000) + mailpit (ports 1025/8025) stackβββ nginx.local.conf # Nginx vhost pointing to /var/www/public (laravel-app/public)βββ .gitignore # Ignores vendor/, .env, laravel-app/.envβββ .github/ # Empty directory (old GH Actions workflow removed in commit d3db7aba)βββ includes/β βββ security.php # Shared .env loader, SameSite=None session, CSRF token, Cloudflare Turnstile verifierβββ assets/brand/ # 18 official SVG, PNG, favicon, OG, and MP4 brand kit assetsβββ scripts/β βββ sync-brand.sh # Pulls BRANDING_GUIDE.md & assets/ from PA-IDEAS/planovi-docs via gh CLIβββ laravel-app/β βββ .env.example # Env template for planned Laravel 11 migration (no app code committed)βββ agreements/β βββ sign.php # eIDAS electronic agreement signing portal (identical to dealflow/sign.php)βββ dealflow/β βββ offer.php # Dual-mode app: ?id= Offer/Pricing Wizard OR ?token= Member/Company Declaration Formβ βββ inquiry.php # 4-step Energy Cooperative SaaS onboarding inquiry & Stripe checkout launcherβ βββ inquiry-success.php # Post-Stripe payment confirmation (co-op company-details flow)β βββ payment-success.php # Post-Stripe payment confirmation (account activation flow)β βββ sign.php # Exact duplicate of agreements/sign.phpβ βββ cookie-banner.php # Client-side localStorage cookie notice partial (included by offer.php)β βββ test_generator.php # Dev utility generating 3 sample JSON files in dealflow/data/β βββ api/ # Server-to-server & form submission endpoints (4 PHP files + 1 orphan data JSON)β βββ backend/ # Unauthenticated delete_json.php + tracked delete_log.txtβ βββ data/ # 71 tracked JSON files + Apache Deny-All .htaccessβ βββ email-templates/ # 9 Supabase GoTrue HTML email templates (Polish)βββ scheduler/ βββ index.php # Public 3-panel appointment booking widget UI + inline JS theming/custom fields βββ default.php # Unused Hostinger default placeholder page βββ cookie-banner.php # Client-side localStorage cookie notice partial (included by index.php) βββ .htaccess # Unsets X-Frame-Options and sets CSP frame-ancestors * βββ composer.json/.lock # Google API PHP Client (v2.19.0) + vendor/ βββ assets/script_v2.js # Calendar rendering, timezone conversion, slot filtering, booking submit βββ backend/ # Booking API, public_config, save/delete endpoints, Google OAuth, debug logs βββ data/ # 75 tracked JSON scheduler configs (NO .htaccess committed in git)Local Development & Testing Commands
No automated unit/integration test suite or static analysis config (phpunit.xml, phpstan.neon, package.json) exists in this repository. Verified commands:
# 1. Install Scheduler Google API PHP Client dependenciescd scheduler && composer install
# 2. PHP syntax check across all active source files (excluding vendor/)find . -name '*.php' -not -path '*/vendor/*' -exec php -l {} \;
# 3. Run legacy PHP microservices locally with built-in PHP server (requires root .env)php -S localhost:8080 -t .
# 4. Run local Laravel + Mailpit Docker scaffold (requires Supabase CLI running on host port 54322)cp laravel-app/.env.example laravel-app/.envdocker compose up -d --build# App: http://localhost:8000 | Mailpit UI: http://localhost:8025
# 5. Sync canonical brand kit from PA-IDEAS/planovi-docs (requires authenticated gh CLI)./scripts/sync-brand.sh assets/brand
# 6. Developer check for remaining legacy Planovi hex colors in Zone 1 (from BRANDING_GUIDE.md)grep -rnEi "(#14B8A6|#2DD4BF|#0D9488|#2563EB|#0B1120|#0F172A|logo-dot)" \ --exclude-dir=.git --exclude-dir=node_modules --exclude-dir=vendor --exclude-dir=data \ --exclude="BRANDING_GUIDE.md" --exclude="AGENTS.md" --exclude="CLAUDE.md" --exclude="*.lock" .Environment Variables & Config Keys (KEY NAMES ONLY)
All legacy PHP microservices read a shared .env file at repository root (__DIR__ . '/../.env' or __DIR__ . '/../../.env'). Keys for laravel-app/.env.example are listed separately below.
| Key Name | Where Read (file) | Required? | Purpose |
|---|---|---|---|
SUPABASE_URL | agreements/sign.php, dealflow/sign.php, dealflow/offer.php, dealflow/inquiry.php, dealflow/api/save_response.php, laravel-app/.env.example | Yes | Base URL for Supabase REST (/rest/v1/), RPC (/rest/v1/rpc/), Edge Functions (/functions/v1/), and Storage (/storage/v1/). |
SUPABASE_ANON_KEY | dealflow/offer.php, dealflow/inquiry.php, laravel-app/.env.example | Yes | Public anon JWT sent in apikey and Authorization: Bearer headers to onboarding_token_status, submit-member-declaration, update-member-declaration, submit-company-details, submit-inquiry, and company-media Storage upload. |
SUPABASE_SERVICE_KEY | dealflow/api/save_response.php | Yes (Offer Mode submit) | Service-role key used for direct server-side POST /rest/v1/dealflow_entries insert bypassing RLS. |
SUPABASE_SERVICE_ROLE_KEY | laravel-app/.env.example | Optional (Laravel only) | Service-role key name in Laravel scaffold template (note naming mismatch vs SUPABASE_SERVICE_KEY in dealflow/api/save_response.php). |
SCHEDULER_SUPABASE_URL | scheduler/backend/api.php | Yes (Scheduler API) | Base URL for Supabase PostgREST queries/inserts/patches against scheduler_bookings. Must start with http. |
SCHEDULER_SUPABASE_SERVICE_KEY | scheduler/backend/api.php | Yes (Scheduler API) | Service-role key used for GET/POST/PATCH on scheduler_bookings. |
DEALFLOW_API_SECRET | dealflow/api/create_offer.php, dealflow/api/save_dealflow.php, dealflow/api/form-writer.php | Yes | Shared secret checked via X-Secret-Key (create_offer.php, save_dealflow.php) or X-Api-Secret (form-writer.php). |
DEALFLOW_FRONTEND_URL | dealflow/api/create_offer.php, dealflow/api/save_dealflow.php | No (has fallback) | Base URL used to build returned offer.php?id=... links. Defaults to https://dev-dealflow.planovi.app in save_dealflow.php or current request scheme+host in create_offer.php. |
SCHEDULER_API_SECRET | scheduler/backend/save_scheduler.php | Yes | Shared secret checked via X-Secret-Key header when saving scheduler JSON configs. |
SCHEDULER_FRONTEND_URL | scheduler/backend/save_scheduler.php | No (has fallback) | Base URL for returned scheduler URL and <iframe> embed code. Defaults to https://dev-scheduler.planovi.app. |
TURNSTILE_SECRET_KEY | dealflow/api/save_response.php | Recommended (has hardcoded fallback!) | Secret key for Cloudflare Turnstile server-side siteverify. Security Anomaly: code contains a hardcoded fallback string at dealflow/api/save_response.php:45. |
PLANOVI_LOGO_URL | dealflow/inquiry.php, dealflow/inquiry-success.php, dealflow/payment-success.php, agreements/sign.php (unused), dealflow/sign.php (unused) | No | Optional external URL for Planovi header logo image. Falls back to inline SVG icon + text if unset. |
APP_NAME, APP_ENV, APP_DEBUG, APP_URL | laravel-app/.env.example | Laravel scaffold | Standard Laravel app settings. |
DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD | laravel-app/.env.example, docker-compose.yml | Laravel scaffold | Local PostgreSQL connection (host.docker.internal:54322 in Docker). |
CACHE_DRIVER, QUEUE_CONNECTION, SESSION_DRIVER | laravel-app/.env.example, docker-compose.yml | Laravel scaffold | Set to database in Docker (no Redis in prod). |
MAIL_MAILER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_ENCRYPTION, MAIL_FROM_ADDRESS | laravel-app/.env.example | Laravel scaffold | Mailpit SMTP capture config (mailpit:1025). |
(Note: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, and GOOGLE_REDIRECT_URI are NOT read from .env β they are hardcoded PHP constants in scheduler/backend/config_google.php:5-7.)
Complete File Coverage Matrix (Zero-Orphan Inventory)
Every file and directory in the repository (100% coverage, zero orphans) is assigned to one of 7 logical modules:
| # | Module Name | Rule Prefix | Owned Files, Endpoints & Assets |
|---|---|---|---|
| 1 | Public Appointment Scheduler & Google Calendar Sync | BR-SCH-* | scheduler/index.php, scheduler/assets/script_v2.js, scheduler/backend/api.php, scheduler/backend/public_config.php, scheduler/backend/save_scheduler.php, scheduler/backend/delete_json.php, scheduler/backend/auth_start.php, scheduler/backend/auth_callback.php, scheduler/backend/config_google.php, scheduler/.htaccess, scheduler/cookie-banner.php, scheduler/composer.json, scheduler/composer.lock, scheduler/vendor/, scheduler/default.php, scheduler/backend/api_debug.log, scheduler/backend/delete_log.txt, scheduler/backend/gcp_clientId_clientSecret(not used, just for reference).json, scheduler/data/*.json (75 files), scheduler/backend/data/*.json (2 files) |
| 2 | Dealflow Interactive Offer & Live Pricing Calculator (Offer Mode) | BR-OFF-* | dealflow/offer.php (Offer Mode branch: ?id=), dealflow/api/save_dealflow.php, dealflow/api/create_offer.php, dealflow/api/save_response.php, dealflow/backend/delete_json.php, dealflow/backend/delete_log.txt, dealflow/cookie-banner.php, dealflow/data/.htaccess, dealflow/test_generator.php, dealflow/data/*.json (offer/deal JSON files), dealflow/api/data/deal_1771006118990.json |
| 3 | Token-Based Onboarding & Member Declaration Forms (Token Mode) | BR-DEC-* | dealflow/offer.php (Token Mode branch: ?token=), dealflow/api/form-writer.php, dealflow/data/{hex-token}.json (token form snapshots protected by dealflow/data/.htaccess) |
| 4 | SaaS Cooperative Onboarding Inquiry & Stripe Payment Confirmation | BR-INQ-* | dealflow/inquiry.php, dealflow/inquiry-success.php, dealflow/payment-success.php |
| 5 | eIDAS Electronic Agreement Signing Portal | BR-SIG-* | agreements/sign.php, dealflow/sign.php (exact duplicate) |
| 6 | Supabase GoTrue Auth Email Templates | BR-EML-* | dealflow/email-templates/confirm-signup.html, dealflow/email-templates/invite-user.html, dealflow/email-templates/magic-link.html, dealflow/email-templates/reset-password.html, dealflow/email-templates/change-email.html, dealflow/email-templates/email-changed.html, dealflow/email-templates/password-changed.html, dealflow/email-templates/mfa-removed.html, dealflow/email-templates/reauthentication.html |
| 7 | Shared Runtime Security, Environment Config, Brand Kit & Local Scaffold | BR-INF-* | includes/security.php, config.php, Dockerfile.local, docker-compose.yml, nginx.local.conf, laravel-app/.env.example, scripts/sync-brand.sh, assets/brand/* (18 files), .gitignore, .github/, AGENTS.md, CLAUDE.md, BRANDING_GUIDE.md, README.md |