Skip to content
πŸ“¦ ARCHIVED SNAPSHOT (v1.0) You are viewing historical business logic and documentation for Microservices (PHP) v1.0 (frozen on 2026-11-23, commit 96144c89). Switch to Latest β†’

Microservices (planovi-microservices) β€” Business Logic & Modules

Code-Verified Blueprint: 7 modules β€’ 55 documented BR-* business rules β€’ Zero-orphan file coverage.
Switch between Latest and frozen release snapshots using the Documentation Version dropdown at the top of the left sidebar.

Module Specifications Index

#Module SpecificationRule PrefixRules (BR-*)Open [TEAM_WHY]
1Public Appointment Scheduler & Google Calendar SyncBR-SCH144
2Dealflow Interactive Offer & Live Pricing Calculator β€” Offer ModeBR-OFF103
3Token-Based Onboarding & Member Declaration Forms β€” Token ModeBR-DEC102
4SaaS Cooperative Onboarding Inquiry & Stripe Payment ConfirmationBR-INQ53
5eIDAS Electronic Agreement Signing PortalBR-SIG72
6Supabase GoTrue Auth Email TemplatesBR-EML41
7Shared Runtime Security, Environment Config, Brand Kit & Local ScaffoldBR-INF52

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.md notes VPS runs PHP 8.3 FPM managed by planovi-vps).
    • Runtime (Local Docker Scaffold for future Laravel migration): php:8.2-fpm-alpine (Dockerfile.local:1) with extensions pdo_pgsql, pgsql, exif, pcntl, bcmath, gd (Dockerfile.local:3), nginx:alpine (docker-compose.yml:26), axllent/mailpit:latest (docker-compose.yml:40), and composer:latest (Dockerfile.local:4).
    • Composer Dependencies (scheduler/composer.json & scheduler/composer.lock):
      • google/apiclient: ^2.15.0 (locked: v2.19.0)
      • google/apiclient-services: locked v0.428.0
      • google/auth: locked v1.50.0
      • guzzlehttp/guzzle: locked 7.10.0
      • monolog/monolog: locked 3.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)
    • Laravel Migration Status: Only laravel-app/.env.example, Dockerfile.local, docker-compose.yml, and nginx.local.conf exist in git. Zero Laravel PHP application files (app/, routes/, composer.json, public/index.php) are committed under laravel-app/.

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.php and identical copy dealflow/sign.php).
  • 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).
  • Explicitly Does NOT Own:
    • Database schema, PostgreSQL migrations, RLS policies, RPCs, or Supabase Edge Functions: Owned by planovi-backend (this repo calls submit-member-declaration, update-member-declaration, submit-company-details, submit-inquiry, signing-api, PostgREST tables scheduler_bookings & dealflow_entries, RPC onboarding_token_status, and Storage bucket company-media).
    • Admin / Tenant Configuration UI & Mobile/Web Panel: Owned by planovi-flutter-app (creates scheduler/dealflow configs, triggers save_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 (routes dev-dealflow.*/dealflow.*, dev-scheduler.*/scheduler.*, dev-agreements.*/agreements.*, and serves dealflow/email-templates/ via vps-proxy:8080/email-templates/).
    • Marketing Website & Documentation Hub: Owned by planovi-webpage and planovi-docs (canonical source for BRANDING_GUIDE.md and assets/brand/).
    • Transactional Resend Emails & Stripe Webhooks / Provisioning: Owned by planovi-backend Edge Functions (this repo only renders confirmation pages and calls Edge Functions).

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:

Terminal window
# 1. Install Scheduler Google API PHP Client dependencies
cd 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/.env
docker 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 NameWhere Read (file)Required?Purpose
SUPABASE_URLagreements/sign.php, dealflow/sign.php, dealflow/offer.php, dealflow/inquiry.php, dealflow/api/save_response.php, laravel-app/.env.exampleYesBase URL for Supabase REST (/rest/v1/), RPC (/rest/v1/rpc/), Edge Functions (/functions/v1/), and Storage (/storage/v1/).
SUPABASE_ANON_KEYdealflow/offer.php, dealflow/inquiry.php, laravel-app/.env.exampleYesPublic 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_KEYdealflow/api/save_response.phpYes (Offer Mode submit)Service-role key used for direct server-side POST /rest/v1/dealflow_entries insert bypassing RLS.
SUPABASE_SERVICE_ROLE_KEYlaravel-app/.env.exampleOptional (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_URLscheduler/backend/api.phpYes (Scheduler API)Base URL for Supabase PostgREST queries/inserts/patches against scheduler_bookings. Must start with http.
SCHEDULER_SUPABASE_SERVICE_KEYscheduler/backend/api.phpYes (Scheduler API)Service-role key used for GET/POST/PATCH on scheduler_bookings.
DEALFLOW_API_SECRETdealflow/api/create_offer.php, dealflow/api/save_dealflow.php, dealflow/api/form-writer.phpYesShared secret checked via X-Secret-Key (create_offer.php, save_dealflow.php) or X-Api-Secret (form-writer.php).
DEALFLOW_FRONTEND_URLdealflow/api/create_offer.php, dealflow/api/save_dealflow.phpNo (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_SECRETscheduler/backend/save_scheduler.phpYesShared secret checked via X-Secret-Key header when saving scheduler JSON configs.
SCHEDULER_FRONTEND_URLscheduler/backend/save_scheduler.phpNo (has fallback)Base URL for returned scheduler URL and <iframe> embed code. Defaults to https://dev-scheduler.planovi.app.
TURNSTILE_SECRET_KEYdealflow/api/save_response.phpRecommended (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_URLdealflow/inquiry.php, dealflow/inquiry-success.php, dealflow/payment-success.php, agreements/sign.php (unused), dealflow/sign.php (unused)NoOptional external URL for Planovi header logo image. Falls back to inline SVG icon + text if unset.
APP_NAME, APP_ENV, APP_DEBUG, APP_URLlaravel-app/.env.exampleLaravel scaffoldStandard Laravel app settings.
DB_CONNECTION, DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORDlaravel-app/.env.example, docker-compose.ymlLaravel scaffoldLocal PostgreSQL connection (host.docker.internal:54322 in Docker).
CACHE_DRIVER, QUEUE_CONNECTION, SESSION_DRIVERlaravel-app/.env.example, docker-compose.ymlLaravel scaffoldSet to database in Docker (no Redis in prod).
MAIL_MAILER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD, MAIL_ENCRYPTION, MAIL_FROM_ADDRESSlaravel-app/.env.exampleLaravel scaffoldMailpit 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 NameRule PrefixOwned Files, Endpoints & Assets
1Public Appointment Scheduler & Google Calendar SyncBR-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)
2Dealflow 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
3Token-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)
4SaaS Cooperative Onboarding Inquiry & Stripe Payment ConfirmationBR-INQ-*dealflow/inquiry.php, dealflow/inquiry-success.php, dealflow/payment-success.php
5eIDAS Electronic Agreement Signing PortalBR-SIG-*agreements/sign.php, dealflow/sign.php (exact duplicate)
6Supabase GoTrue Auth Email TemplatesBR-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
7Shared Runtime Security, Environment Config, Brand Kit & Local ScaffoldBR-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