docs: landing page design and plan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfmHGGiYUjNcvJoyzdf
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-01 10:33:34 +08:00
commit 4c727bc3f7
3 files changed
+118

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
node_modules/
data/
*.db
.worktrees/
.superpowers/
@@ -0,0 +1,72 @@
# INS Landing Page Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** One INS landing page with a lead form that stores submissions in SQLite.
**Architecture:** A single `server.js` (Node 22 built-ins only) serves `public/index.html` and handles `POST /api/leads`, inserting into a SQLite file. Shipped as a Docker image for k8s with the DB on a volume, 1 replica.
**Tech Stack:** Node 22 (`node:http`, `node:sqlite`, `node:test`), plain HTML/CSS/JS, Docker.
**Spec:** `docs/superpowers/specs/2026-12-01-ins-landing-page-design.md`
## Global Constraints
- Zero npm dependencies.
- Node >= 22.13 (`node:sqlite` without a flag).
- DB path from env `DB_PATH`, default `./data/leads.db`; port from `PORT`, default `3000`.
- Copy only facts confirmed on infinitynetworks.com.my; no "0" counters.
## Review Focus
- Non-JSON or oversized body: respond 400 / 413, never crash the process. (Task 1 test)
- Invalid email format: 400 with an error message. (Task 1 test)
- Over-long fields: reject anything above 200 chars (message 2000). (Task 1 test)
- Server error on save: the page shows a visible error, not a fake success. (Task 2 manual browser check)
- HTML in fields is stored as text and never rendered (no admin UI, so no XSS surface now).
---
### Task 1: Lead API + storage
**Files:**
- Create: `server.js`, `server.test.js`, `package.json` (scripts only: `start`, `test`)
**Interfaces:**
- Produces: `createServer(dbPath: string) => http.Server` exported from `server.js`; module runs `listen(PORT)` only when executed directly.
- `POST /api/leads` JSON `{name, email, phone, company, industry?, message?, website?, utm_source?, utm_medium?, utm_campaign?}` → `201 {ok:true}` | `400 {error}` | `413 {error}`. Honeypot `website` non-empty → `200 {ok:true}`, nothing stored.
- Table `leads(id INTEGER PK, created_at TEXT DEFAULT CURRENT_TIMESTAMP, name, email, phone, company, industry, message, referrer, utm_source, utm_medium, utm_campaign)`.
- [ ] **Step 1: Write failing tests** in `server.test.js` using a temp DB path and port 0:
- valid lead → 201, row count 1, stored fields match
- missing `phone` → 400, row count 0
- invalid email `"abc"` → 400
- `name` of 201 chars → 400
- body `"not json"` → 400; body > 10 KB → 413
- honeypot `website: "x"` → 200, row count 0
- [ ] **Step 2:** `node --test` — expect FAIL (module missing).
- [ ] **Step 3:** Implement `server.js`. `GET /` serves `public/index.html`; other paths 404.
- [ ] **Step 4:** `node --test` — expect all PASS.
- [ ] **Step 5:** Commit `feat: lead capture API with SQLite storage`.
### Task 2: Landing page
**Files:**
- Create: `public/index.html`, `public/logo.png` (downloaded from the source site)
**Interfaces:**
- Consumes: `POST /api/leads` from Task 1. Sends UTM params from `location.search`.
- [ ] **Step 1:** Build the page: hero, about/track record, solutions by industry, Guest Wi-Fi, OneBox, IT services, lead form, contact footer. Responsive, accessible labels.
- [ ] **Step 2:** Verify in a browser with playwright-cli against `npm start`: empty submit shows required-field errors; valid submit shows success and a row appears in the DB; stop server mid-session and submit → visible error. Screenshot desktop + mobile.
- [ ] **Step 3:** Commit `feat: INS landing page with lead form`.
### Task 3: Docker + README
**Files:**
- Create: `Dockerfile`, `.dockerignore`, `README.md`
- [ ] **Step 1:** `Dockerfile` from `node:22-alpine`, `ENV DB_PATH=/data/leads.db`, `VOLUME /data`, non-root user, `EXPOSE 3000`.
- [ ] **Step 2:** README: run, test, deploy notes (1 replica + PVC at `/data`), CSV export command.
- [ ] **Step 3:** `docker build` then run with a volume, `curl` a lead, confirm it persists after container restart.
- [ ] **Step 4:** Commit `chore: Dockerfile and README`.
@@ -0,0 +1,41 @@
# 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.