How zamtls15/googlehelportal-v1 works
1. Overall shape
- This repository is a client-heavy member portal with a small set of backend/API entry points.
- The app is organized around static HTML pages + JavaScript modules, with serverless API functions for privileged operations.
2. Primary user-facing surfaces
- pages/login.html is the entry point for sign-in.
- pages/user.html is the authenticated member experience.
- pages/hq-control-7x9k.html is a separate admin/control surface, intentionally obscurely named.
- index.html likely serves as the root landing page or router entry, while public/404.html handles missing routes.
3. Frontend module boundaries
- js/auth.js handles login/session behavior.
- js/user.js drives the member dashboard experience.
- js/admin.js drives the admin/control panel.
- js/firebase-config.js centralizes client-side Firebase setup and is likely shared by the auth flow and page scripts.
4. Authentication and session flow
- The README describes email-based “magic code” sign-in, so the login experience is likely passwordless or code/link based.
- The flow is: user enters email → authentication provider sends code/link → user returns and is recognized → portal loads member badge/content.
- Authentication state then determines whether the user sees the user page or the admin page.
5. Backend/API responsibilities
- api/send-welcome-email/index.js is a server-side function for sending onboarding/welcome mail.
- api/manage-supabase-user/index.js is a privileged endpoint for creating/updating/managing users in a Supabase-backed system.
- api/email-template.js contains reusable email markup/content used by the email-sending flow.
- These APIs are the main boundary where sensitive operations leave the browser.
6. Data and identity model
- The README implies members have a “badge” with name, role, and medals, so the UI likely renders a profile-like record sourced from backend data.
- The naming of manage-supabase-user suggests Supabase is the backend data store or user directory for member records.
- Firebase appears to be used on the client side for authentication plumbing, while Supabase is used for member/admin data management.
7. Admin workflow
- The “Space Captains” in the README map to the admin subsystem.
- Admins likely create or update member accounts, trigger welcome emails, and assign roles/medals through the admin page.
- This is the clearest trust boundary in the repo: normal users consume data, while admins invoke privileged API operations.
8. Styling and shared presentation
- pages/shared.css is the main shared stylesheet for the page set.
- STYLES_DOCUMENTATION.md indicates the styling system is documented separately, suggesting a deliberate shared UI layer rather than per-page styling.
- The portal likely relies on consistent static-page styling instead of a component framework.
9. Deployment and routing
- vercel.json, public/_redirects, and the api/ folder indicate deployment to Vercel-style static hosting with serverless functions.
- public/404.html and redirect rules suggest route handling is done at the edge/static-host layer, not by a full custom app server.
- server.js and .replit-artifact imply local or alternative runtime support in addition to the hosted deployment.
10. Runtime/tooling boundary
- vite.config.js, package.json, and tsconfig.json indicate a modern frontend build/dev setup, even though the app pages are plain HTML/JS.
- The presence of Vite suggests local development/bundling support rather than a monolithic framework app.
- The codebase is JavaScript-first, with TypeScript configuration present for tooling compatibility.
11. External service dependencies
- Firebase is present in the client config and likely powers auth/session behavior.
- Supabase is referenced by the admin-management API and likely stores member/user records.
- Email delivery is part of the backend flow, probably used for onboarding and notifications.
12. How to diagram the architecture
- Draw three main zones: browser pages, serverless APIs, and external services.
- Show login/user/admin pages all sharing common JS/CSS and auth state.
- Show authenticated/admin actions calling the API functions, which in turn call Supabase and email services.
- Keep the admin path separate from the normal member path to reflect the intended privilege boundary.
Main entry points: server.js Local server · admin.js Admin UI · login.html Login · index.js Welcome email
Components 19
Browser app
Static pages and client-side modules
- Landing · Root entry page for the portal
index.html - Login · Email-based sign-in surface
pages/login.html - Member portal · Authenticated member experience
pages/user.html - Control room · Obscure admin/control surface
pages/hq-control-7x9k.html - Shared CSS · Common presentation layer for page surfaces
pages/shared.css - Auth flow · Sign-in and session handling
js/auth.js - Member UI · Drives the member dashboard behavior
js/user.js - Admin UI · Drives the admin/control panel
js/admin.js - Firebase config · Shared client-side Firebase setup
js/firebase-config.js
Serverless API
Privileged backend functions and shared email content
- Welcome email · Sends onboarding and welcome mail
api/send-welcome-email/index.js - User manager · Privileged member create/update operations
api/manage-supabase-user/index.js - Email template · Reusable email markup and content
api/email-template.js
External services
Third-party systems used by auth, data, and email delivery
- Firebase · External authentication provider
- Supabase · Backend store for member and admin records
- Email delivery · Outbound email infrastructure
Deployment / runtime
Hosting, routing, and local dev tooling
- Vercel · Static hosting and serverless deployment target
vercel.json - Redirect rules · Edge routing and fallback handling
public/_redirects - Vite build · Local dev and bundling setup
vite.config.js - Local server · Alternative local runtime entry
server.js
Connections 30
- Landing → Login: entry · Landing routes into sign-in
- Login → Auth flow: loads · Login page uses auth module
- Member portal → Member UI: loads · Member page uses dashboard logic
- Control room → Admin UI: loads · Admin page uses control logic
- Login → Shared CSS: styles · Shared styling across page surfaces
- Member portal → Shared CSS: styles · Shared styling across page surfaces
- Control room → Shared CSS: styles · Shared styling across page surfaces
- Auth flow → Firebase config: uses · Auth logic relies on shared Firebase setup
- Member UI → Firebase config: uses · Member UI consumes the same client config
- Admin UI → Firebase config: uses · Admin UI consumes the same client config
- Auth flow → Firebase: sign-in · Email-based authentication flow
- Member UI → Firebase: session check · Reads authenticated member state
- Admin UI → Firebase: gate access · Checks privileged access before actions
- Admin UI → User manager: admin actions · Creates or updates member records
- Admin UI → Welcome email: send mail · Triggers onboarding email delivery
- Welcome email → Email template: renders · Builds outgoing email content
- Welcome email → Email delivery: delivers · Sends welcome mail externally
- User manager → Supabase: reads/writes · Manages member records in Supabase
- User manager → Email delivery: notifies · May trigger notification mail as part of admin flows
- Vercel → Redirect rules: routes · Edge routing and fallback handling
- Vercel → Welcome email: hosts · Deploys serverless API function
- Vercel → User manager: hosts · Deploys serverless API function
- Vite build → Login: builds · Development build tooling covers static pages
- Vite build → Member portal: builds · Development build tooling covers static pages
- Vite build → Control room: builds · Development build tooling covers static pages
- Local server → Login: serves · Local runtime support for pages
- Local server → Member portal: serves · Local runtime support for pages
- Local server → Control room: serves · Local runtime support for pages
- Local server → Welcome email: runs · Local runtime can invoke API functions
- Local server → User manager: runs · Local runtime can invoke API functions