- server.js uses pg (pinned 8.23.1), reads DATABASE_URL, creates the leads table on start, fails fast if Postgres is unreachable - tests run against a real Postgres in a throwaway schema - CI runs the test image against a throwaway Postgres on DinD - k8s: Postgres 18 StatefulSet (Longhorn, 2Gi), init container wait, password secret, network policy app-to-postgres; app no longer needs a volume or Recreate - README: DBeaver via port-forward, CSV export via docs/export-leads.sql Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
66 lines
4.5 KiB
Markdown
66 lines
4.5 KiB
Markdown
# INS Landing Page — Design
|
|
|
|
Approved 2026-12-01.
|
|
|
|
## Intent
|
|
|
|
A single landing page for Infinity Networks Security Sdn Bhd (INS), covering the company overall, that captures leads through a form. Leads are stored in a database and extracted manually. No admin portal.
|
|
|
|
## Goals
|
|
|
|
- One page with INS's real content, sourced from https://www.infinitynetworks.com.my/.
|
|
- Lead form whose submissions persist in a database.
|
|
- Deployable to our Kubernetes cluster.
|
|
|
|
## Non-goals
|
|
|
|
Admin portal, email notifications, CAPTCHA, analytics, CMS.
|
|
|
|
## Anti-goals
|
|
|
|
- Publishing unverified claims. The live site's counters render "0" and the footer says ©2022; use only confirmed facts (founded 2012, 200+ hotels, clients in 5+ countries, 100+ F&B clients).
|
|
- Losing leads silently. A failed save must show an error to the visitor.
|
|
|
|
## Approaches
|
|
|
|
- **A. Node + SQLite (chosen).** Node 22 built-ins only (`node:http`, `node:sqlite`). One file DB on a PersistentVolume. Constraint: 1 replica. Upgrade path: swap to cluster Postgres if replicas > 1 are ever needed.
|
|
- B. PHP + MySQL. Fits shared hosting, poor fit for k8s.
|
|
- C. Static page + hosted DB (Supabase). Adds an external service and a public key with RLS risk.
|
|
|
|
## Design
|
|
|
|
- `public/index.html` — inline CSS, INS logo and copy: hero, four industries (Hospitality, Healthcare, Education, F&B), Guest Wi-Fi, OneBox gateway, IT services, track record, contact details, lead form.
|
|
- Form fields: name, email, phone, company (required); industry select, message (optional); hidden honeypot `website`. Submits with `fetch`, shows inline success/error.
|
|
- `server.js` — `GET /` serves the page; `POST /api/leads` validates and inserts into `leads` with `created_at`, `referrer`, and UTM params (`utm_source`, `utm_medium`, `utm_campaign`).
|
|
- DB path from `DB_PATH` env, default `./data/leads.db`; Docker uses `/data/leads.db`.
|
|
- `server.test.js` — `node:test`: valid lead saved, missing required fields rejected, honeypot dropped.
|
|
- `Dockerfile` + README with export instructions. No k8s manifests yet (depends on cluster conventions).
|
|
|
|
## Left to the builder
|
|
|
|
Visual styling, exact section copy wording (from source site), field length limits.
|
|
|
|
## Revision 2026-12-01: hotel technology brief from the page owner
|
|
|
|
The page owner supplied a new brief. It replaces the page content and form; storage and deployment are unchanged.
|
|
|
|
- Audience: hotel, resort, serviced-apartment and co-living decision-makers. Positioning: "One partner for the connected hotel."
|
|
- Five services: WiFi Managed Services (Infinity OneBox), Cloud IP PABX (CloudExt), GRE IPTV, Digital Signage, QR Door Locks. Process: Design, Supply, Install, Manage.
|
|
- Sections: sticky header, hero with form, trust strip, services, how we work, why Infinity, FAQ, final CTA with a second form, footer. Optional "Meet us at" badge, disabled by default.
|
|
- Form fields, exactly: full name, work email, phone/WhatsApp, company (all required); service interested in (optional select). Free email providers (gmail, yahoo, hotmail, etc.) are rejected with a friendly message, on the page and on the server.
|
|
- No statistics or client claims; unknown facts use `[PLACEHOLDER]` with a code comment.
|
|
- Contact: +6019 365 6987, John.goh@infinitynetworks.com.my.
|
|
- Google Fonts allowed (owner request). Floating WhatsApp/call button on mobile.
|
|
- Decision (user, 2026-12-01): keep the existing database endpoint instead of the brief's `action="#"` placeholder.
|
|
- Schema: `industry` and `message` columns replaced by `service`. The local database held only throwaway test data and is recreated.
|
|
|
|
## Revision 2026-12-01: Postgres instead of SQLite
|
|
|
|
Decision (user, 2026-12-01): move lead storage to Postgres so the team can open the live data in DBeaver.
|
|
|
|
- Option chosen: a dedicated Postgres 18 StatefulSet in namespace `ins-landing-page`, copied from dynamic-qr (Longhorn PVC, password Secret, init container waiting for `pg_isready`, network policy allowing only the app). Rejected: a database on a shared Postgres (cross-namespace coupling, leads sharing a server with other apps).
|
|
- New dependency: `pg` (node-postgres), pinned exactly. Node has no built-in Postgres client. This ends "zero npm dependencies".
|
|
- The app reads `DATABASE_URL`, creates the `leads` table on start if missing, and closes the pool on SIGTERM.
|
|
- Tests run against a real Postgres, each run in its own throwaway schema, so they never touch existing tables. CI starts a Postgres container on the DinD daemon and runs the test image against it.
|
|
- DBeaver: `kubectl port-forward` to the Postgres service. CSV export via `psql \copy`.
|