Webpage (planovi-webpage) β Business Logic & Modules
Code-Verified Blueprint: 9 modules β’ 69 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 | Routing, Configuration & Environment Bootstrap | BR-CFG | 6 | 2 |
| 2 | Internationalization (i18n) & Security Hardening Layer | BR-SEC | 9 | 2 |
| 3 | Marketing Landing Page, Shared Layout & UI System | BR-MKT | 11 | 2 |
| 4 | Two-Step Waitlist & Lead Qualification Engine | BR-WLT | 10 | 1 |
| 5 | Contact Form & Lead Alerting Pipeline | BR-CNT | 7 | 2 |
| 6 | Native PHP + HTMX Blog, SEO & Media Layer | BR-BLG | 10 | 2 |
| 7 | Live System Status Dashboard | BR-STS | 6 | 2 |
| 8 | Legal Document Viewer | BR-DOC | 6 | 2 |
| 9 | Internal Docs-as-Code Portal & Deployment Tooling | BR-OPS | 5 | 2 |
- Cross-Cutting Concerns & Shared Infrastructure β
- Open
[TEAM_WHY_NEEDED]Questions & Tech Debt Board β
Repository Snapshot & Runtime Metadata
- Repository:
PA-IDEAS/planovi-webpage - Branch & HEAD Commit:
develop@69f9463 - Primary Stack & Pinned Versions:
- Runtime (Web Application): Native PHP 8.x (target runtime PHP 8.3 per
AGENTS.md; zero Composer packages, nocomposer.json, relies on built-incurl,dom/libxml,mbstring,json,sessionextensions). - Frontend Interactivity & Styling: Vanilla ES2020+ JavaScript (
js/script.js,js/waitlist.js), Vanilla CSS (css/style.css), HTMX1.9.12(loaded viahttps://unpkg.com/htmx.org@1.9.12inblog.php), Phosphor Icons (https://unpkg.com/@phosphor-icons/web), Cloudflare Turnstile v0 (https://challenges.cloudflare.com/turnstile/v0/api.js), Google FontsPoppins(400;500;600;700;900,latin-ext). - Database & Storage Client: Direct cURL calls to Supabase PostgREST (
/rest/v1/*, PostgreSQL schemaswebsiteandpublic) and Supabase Storage bucketblog-media(supabase/website_schema.sql). - Web Server / Routing Layers: Apache/LiteSpeed
.htaccess, Nginx front-controller insideindex.php, PHP built-in CLI serverrouter.php. - Embedded Docs Sub-Project (
docs/): Node.js + Astro4.16.19(package.json:^4.16.1),@astrojs/starlight0.28.6(^0.28.2),sharp0.33.5(^0.33.5),typescript5.9.3(^5.5.4), Mermaid10.9.0(CDN indocs/astro.config.mjs). - No Dockerfile,
docker-compose.yml,composer.json, or GitHub Actions workflows exist in this repository (.github/is an empty directory after commitd40fc6b).
- Runtime (Web Application): Native PHP 8.x (target runtime PHP 8.3 per
What This Repo Owns (and What It Explicitly Does NOT Own)
- Owns:
- Public marketing website (
planovi.app/dev-webpage.planovi.app) with bilingual Polish (pl) and English (en) SSR pages, dark/light theme system, and Zone 1 PLANOVI brand assets (assets/brand/,BRANDING_GUIDE.md). - Two-step waitlist acquisition and lead qualification flow (
#waitliston homepage and/login/gate), including Cloudflare Turnstile verification, one-time SHA-256 update tokens, persistence inwebsite.waitlist, and optional post-response Resend contact/welcome-email dispatch. - Contact form submission pipeline (
contact-handler.php) writing towebsite.website_form_messagesand dispatching Google Chat webhook alerts. - Public SSR + HTMX blog (
/blog,/blog/{slug}), dynamic XML sitemap (/sitemap.xml),llms.txt, andwebsitePostgreSQL schema DDL (supabase/website_schema.sql). - Live public system status page (
/status), static PDF legal document viewer (/documentation), and an embedded repo-local Astro Starlight docs site (docs/).
- Public marketing website (
- Explicitly Does NOT Own:
- Authenticated user sessions, user accounts, tenant workspaces, RBAC, energy telemetry, billing, or e-voting (
panel.planovi.appβ owned byplanovi-flutter-appandplanovi-backend). - White-label / Zone 2 customer-embeddable widgets (Scheduler, Dealflow, Agreements) and Supabase GoTrue auth email templates (owned by
planovi-microservices). - Blog CMS admin UI or media upload UI (content and media are pushed directly to Supabase REST API and
blog-mediaStorage bucket via external automation such as n8n, documented insupabase/API_EXAMPLES.md). app_modules/app_modules_maintenanceschema definitions and maintenance toggle controls (this repo only reads them from Supabasepublicschema instatus.php).- Canonical brand kit master files (synced downstream from
PA-IDEAS/planovi-docs/brand-kit/viascripts/sync-brand.sh).
- Authenticated user sessions, user accounts, tenant workspaces, RBAC, energy telemetry, billing, or e-voting (
Directory Map
planovi-webpage/βββ .htaccess # Apache/LiteSpeed URL rewrites & static file deny rulesβββ .gitignore # Ignores docs/node_modules, docs/.astro, docs/dist, .env*βββ .github/ # Empty directory (CI workflow removed in commit d40fc6b)βββ AGENTS.md / CLAUDE.md # AI coding rules (CLAUDE.md is a symlink to AGENTS.md)βββ BRANDING_GUIDE.md # Synced ecosystem Zone 1 / Zone 2 branding guideβββ README.md # Repo overview (non-authoritative)βββ index.php # Nginx front-controller + Marketing landing page SSRβββ router.php # Local PHP built-in server routerβββ config.example.php # Template for out-of-webroot dev.php / prod.php overridesβββ config.php # Runtime config loader & site_config()/site_url() helpers (never read/committed secrets)βββ db.php # Dormant MySQL PDO stub (included by index.php, all PDO lines commented)βββ i18n.php # Session bootstrap, security headers emit, PL/EN switcher, __() translatorβββ blog.php # Blog index (SSR + HTMX partial handler)βββ blog-post.php # Single blog article view (SSR, JSON-LD, 404 handler)βββ sitemap.php # Dynamic XML sitemap generator (/sitemap.xml)βββ llms.txt # Static AI/LLM discovery text fileβββ status.php # Live public module status dashboardβββ documentation.php # Canonical legal PDF viewer (/documentation)βββ docs.php # Near-duplicate legacy legal PDF viewerβββ contact-handler.php # POST JSON/form contact intake -> Turnstile -> Supabase -> Google Chatβββ waitlist-handler.php # POST JSON waitlist step 1 -> Turnstile -> Supabase -> Resendβββ waitlist-qualify-handler.php # POST JSON waitlist step 2 -> token CAS -> Supabase -> Resendβββ cookie-banner.php # Cookie notice UI + localStorage state scriptβββ deploy.sh # Legacy manual curl FTP upload script (contains hardcoded credentials)βββ login/β βββ index.php # Public /login/ waitlist gate page (noindex)βββ components/ # Reusable PHP view partials (navbar, footer, logo, icons, waitlist form, blog grid)βββ includes/ # PHP domain/security libraries (blog-repository, security, waitlist)βββ css/style.css # Full Vanilla CSS design system (994 lines, Dark/Light tokens)βββ js/ # Client scripts (script.js, waitlist.js)βββ lang/ # Translation JSON dictionaries (pl.json, en.json)βββ assets/ # Images, favicons, OG image, and synced brand kit (assets/brand/)βββ documents/ # Static PDF legal documents (pl/, en/)βββ supabase/ # PostgreSQL website schema migration & n8n REST API guideβββ scripts/sync-brand.sh # Brand kit sync script pulling from PA-IDEAS/planovi-docsβββ docs/ # Embedded Astro Starlight documentation projectLocal Development & Testing Commands
- Prerequisites: PHP
>= 8.3withcurl,dom,mbstring,jsonextensions; Node.js + npm (only if buildingdocs/);ghCLI (only forscripts/sync-brand.sh). - Configure Local Out-of-Webroot Secrets (optional for static pages; mandatory for waitlist endpoints):
Terminal window mkdir -p ../configcp config.example.php ../config/dev.php# Edit ../config/dev.php to populate waitlist.*, resend.*, and optional overrides - Run PHP Web App Locally (with clean URL routing):
Terminal window php -S localhost:8080 router.php - PHP Syntax Lint (all PHP files excluding
config.php):Terminal window find . -name '*.php' -not -name 'config.php' -not -path './docs/*' -exec php -l {} + - Run/Build Embedded Astro Starlight Docs (
docs/):Terminal window cd docsnpm installnpm run dev # Astro dev servernpm run build # Static build to docs/dist/npm run preview # Preview built docs - Sync Brand Kit from
planovi-docs:Terminal window ./scripts/sync-brand.sh assets/brand - Automated Test Suite: None exists in this repository (no PHPUnit, Playwright, Vitest, or CI checks).
Environment Variables & Config Keys (KEY NAMES ONLY)
The PHP runtime reads zero OS environment variables (getenv() / $_ENV are not used in active source files outside config.php). All configuration is loaded via config.php merging out-of-webroot <web root>/../config/dev.php or <web root>/../config/prod.php (array_replace_recursive) and read via site_config('<dot.key>', $default) or site_url('<link_key>').
| Config Key / Server Var | Where Read (file) | Required? | Purpose |
|---|---|---|---|
contact.email | index.php, components/footer.php | Yes | Public contact email displayed in contact section, footer mailto:, and Organization JSON-LD |
contact.phone | index.php | Yes | Public phone number displayed in contact section and Organization JSON-LD |
contact.address | index.php | Yes | Physical address displayed in contact section |
links.panel_login | components/navbar.php | Yes (default per env) | Navbar Login button URL (defaults per config.example.php: prod /login/, dev https://dev-panel.planovi.app) |
links.demo_booking | index.php | Yes | Hero primary CTA button (Book Demo / UmΓ³w Demo) target URL |
links.pricing_basic | index.php | Conditional | Basic tier subscribe button URL (rendered when features.show_pricing_buttons is truthy) |
links.pricing_pro | index.php | Conditional | Pro tier subscribe button URL (rendered when features.show_pricing_buttons is truthy) |
links.pricing_ent | index.php | Conditional | Enterprise tier CTA button URL (rendered when features.show_pricing_buttons is truthy) |
links.docs | cookie-banner.php, components/footer.php | Yes | Link to legal document viewer / privacy policy |
links.privacy | components/waitlist-form.php | Yes | Privacy policy link embedded inside waitlist consent checkbox label |
links.status | components/footer.php | Yes | Link to live system status page |
links.linkedin, links.twitter, links.facebook, links.instagram | components/footer.php | Yes | Footer social profile links |
links.google_play, links.app_store | components/footer.php | Yes | Footer mobile app store download links |
features.show_pricing_buttons | index.php | Optional (default per env) | Feature flag showing/hiding pricing CTA buttons (defaults per config.example.php: prod false, dev true) |
supabase.url | contact-handler.php, includes/blog-repository.php, status.php | Required for live data | Base Supabase project URL (placeholder containing YOUR_PROJECT_ID disables live queries and triggers fallback in blog/status) |
supabase.key | contact-handler.php, includes/blog-repository.php, status.php | Required for live data | Supabase API key (sent as both apikey and Authorization: Bearer) for contact insert, blog read, and status read |
supabase.table | contact-handler.php | Optional (default website_form_messages) | Target table name for contact form inserts |
supabase.schema | contact-handler.php | Optional (default website) | PostgREST Accept-Profile / Content-Profile schema for contact form inserts |
turnstile.site_key | index.php | Required for contact form | Public Cloudflare Turnstile site key for #contact-form widget |
turnstile.secret_key | contact-handler.php | Required for contact form | Secret Cloudflare Turnstile key for contact form verification (fail-closed) |
google_chat.webhook_url | contact-handler.php | Optional | Google Chat incoming webhook URL (skipped if empty or contains YOUR_GOOGLE_CHAT) |
waitlist.supabase_url | includes/waitlist.php | Required (external config only) | Supabase URL for waitlist endpoints; missing triggers HTTP 503 |
waitlist.supabase_service_key | includes/waitlist.php | Required (external config only) | Supabase service_role key bypassing RLS on website.waitlist; missing triggers HTTP 503 |
waitlist.supabase_schema | includes/waitlist.php | Optional (default website) | PostgREST profile header for waitlist requests |
waitlist.turnstile_site_key | components/waitlist-form.php, includes/waitlist.php | Required (external config only) | Dedicated Turnstile site key for waitlist explicit widget |
waitlist.turnstile_secret_key | includes/waitlist.php | Required (external config only) | Dedicated Turnstile secret key for waitlist verification (fail-closed) |
waitlist.turnstile_hostnames | includes/waitlist.php | Optional (default [HTTP_HOST]) | Array of allowed Turnstile response hostnames (e.g., ['example.com'] for Cloudflare test keys) |
resend.api_key | includes/waitlist.php | Optional | Resend API bearer token; Resend is disabled unless both resend.api_key and resend.from are non-empty |
resend.from | includes/waitlist.php | Optional | Verified sender string (e.g. PLANOVI <hello@planovi.app>) |
resend.segment_id | includes/waitlist.php | Optional | Resend contact segment ID attached on contact creation |
resend.reply_to | includes/waitlist.php | Optional | Optional reply_to address on waitlist welcome email |
$_SERVER['HTTP_CF_CONNECTING_IP'], REMOTE_ADDR | includes/waitlist.php, contact-handler.php | Server-provided | Client IP forwarded to Turnstile siteverify and logged in website_form_messages.ip_address |
$_SERVER['HTTP_CF_IPCOUNTRY'] | waitlist-handler.php, contact-handler.php | Server-provided | Cloudflare 2-letter ISO country code stored on waitlist/contact rows |
$_SERVER['HTTP_HX_REQUEST'] | blog.php | Client header | Triggers HTMX HTML partial response instead of full page layout |
$_SERVER['HTTPS'], HTTP_HOST, REQUEST_URI, REQUEST_METHOD, HTTP_USER_AGENT | i18n.php, index.php, router.php, blog-post.php, includes/waitlist.php, contact-handler.php | Server-provided | Routing, protocol-aware cookie Secure flag, Turnstile hostname check, method enforcement, and UA capture |
HOST, USER, PASS, TARGET_DIR (shell vars) | deploy.sh | Hardcoded in script | Legacy FTP upload script variables (critical security debt: credentials hardcoded in git) |
Complete File Coverage Matrix (Zero-Orphan Inventory)
Every non-.git, non-.DS_Store file in PA-IDEAS/planovi-webpage is assigned to exactly one module below.
| Module | Rule Prefix | Assigned Files / Endpoints / Assets (100% Coverage) |
|---|---|---|
| 2.1 Routing, Configuration & Environment Bootstrap | BR-CFG-* | .htaccess, router.php, index.php (lines 1β42 front-controller), config.example.php, config.php (contract only; secrets not read), db.php |
| 2.2 Internationalization (i18n) & Security Hardening Layer | BR-SEC-* | i18n.php, includes/security.php, lang/pl.json, lang/en.json |
| 2.3 Marketing Landing Page, Shared Layout & UI System | BR-MKT-* | index.php (lines 43β600), components/navbar.php, components/footer.php, components/brand-logo.php, components/head-icons.php, cookie-banner.php, css/style.css, js/script.js (lines 1β230, 315β319), assets/dashboard.jpg, assets/hero-bg.jpg, assets/favicon.svg, assets/favicon-32x32.png, assets/apple-touch-icon.png, assets/logo-black.png, assets/logo-white.png, assets/logo-dark.svg, assets/logo-light.svg, assets/og-image.png, assets/brand/* (18 files), BRANDING_GUIDE.md, scripts/sync-brand.sh |
| 2.4 Two-Step Waitlist & Lead Qualification Engine | BR-WLT-* | waitlist-handler.php, waitlist-qualify-handler.php, includes/waitlist.php, components/waitlist-form.php, js/waitlist.js, login/index.php, supabase/website_schema.sql (website.waitlist table, triggers, RLS, migration) |
| 2.5 Contact Form & Lead Alerting Pipeline | BR-CNT-* | contact-handler.php, index.php (lines 560β590 contact form), js/script.js (lines 231β314 AJAX handler), supabase/website_schema.sql (website.website_form_messages table, triggers, RLS, migration) |
| 2.6 Native PHP + HTMX Blog, SEO & Media Layer | BR-BLG-* | blog.php, blog-post.php, components/blog-grid-partial.php, includes/blog-repository.php, sitemap.php, llms.txt, supabase/website_schema.sql (website.blog_posts table, storage.buckets 'blog-media', RLS, seed data), supabase/API_EXAMPLES.md |
| 2.7 Live System Status Dashboard | BR-STS-* | status.php |
| 2.8 Legal Document Viewer | BR-DOC-* | documentation.php, docs.php, documents/pl/polityka_prywatnosci.pdf, documents/pl/regulamin.pdf, documents/en/privacy_policy.pdf, documents/en/terms_and_conditions.pdf |
| 2.9 Internal Docs-as-Code Portal & Deployment Tooling | BR-OPS-* | docs/astro.config.mjs, docs/package.json, docs/package-lock.json, docs/tsconfig.json, docs/src/env.d.ts, docs/src/content/config.ts, docs/src/components/SiteTitle.astro, docs/src/styles/brand.css, docs/src/assets/logo-dark.svg, docs/src/assets/logo-light.svg, docs/public/favicon.svg, docs/public/brand/* (18 files), docs/src/content/docs/index.mdx, docs/src/content/docs/architecture/{overview,i18n-and-routing,security-and-compliance}.md, docs/src/content/docs/features/{landing-and-components,contact-and-leads,status-page,document-viewer}.md, docs/src/content/docs/developer-guide/{onboarding,brand-guidelines,styling-and-assets,deployment}.md, docs/src/content/docs/support/troubleshooting.md, deploy.sh, README.md, AGENTS.md, CLAUDE.md, .gitignore, .github/ |