mr-moon34 / spotsup-insurance Public
Technical Spec Documentation

๐Ÿ’ก Live Demonstration: This is a live demonstration designed to build your trust. I will deliver the complete production implementation and integrate all remaining customized business logic for you following our communication/discussion. Due to limited time, I couldn't demonstrate 100% of the platform's potential, but once you approve, we will complete the entire scope to a high level according to your exact satisfaction.

๐Ÿ“– Project Overview

SpotsUp Insurance is a high-performance web platform designed to provide automated, customizable insurance quotes for breaks, gaming sessions, and items. Featuring a "Quiet Luxury" aesthetic, the layout balances clean graphics with visual responsiveness.

๐ŸŽฏ Core Features

๐Ÿ”‘ Credentials & Console Access

Security Note: The administrator console is protected by local passcode validation matching the value below.

Module Type Value / Access URL
Admin Console Panel Path Route /admin
Console Admin Passcode Authentication Value spotsup123
Stripe Integration Webhook REST Endpoint POST /api/stripe-webhook

๐Ÿ› ๏ธ System Tech Stack

Module Layer Technology Used Technical Description
Frontend Stack HTML5, Vanilla CSS, JS (ES6+) Optimized layouts, micro-animations, vanilla stylesheets, and responsive containers.
Database Persistence Supabase (PostgreSQL) Relational storage containing transaction entries, client details, logs, and coverage policies.
User Authentication Supabase GoTrue Auth Secure sign-up, password verification, active sessions, and password updating tools.
Server Backend APIs Node.js / Vercel Serverless Serverless API function architecture supporting checkout link generation and webhook verification.

๐Ÿ—„๏ธ Supabase Database Schema

The backend stores database logs across three primary tables with foreign-key referential integrity:

Table Name Primary Columns Description & Context
profiles id (uuid), full_name, email, updated_at Maintains client details linked directly to Supabase internal authorization IDs.
quotes id (uuid), product, declared_value, quoted_premium, user_id Saves user quote calculations. Quotes are automatically attached to users on creation.
policies id (uuid), quote_id, status, stripe_session_id, created_at Finalized coverage policies, verified via Stripe Webhooks and referenced in Client Dashboard.

๐Ÿ’ณ Stripe Checkout & Webhook Integration

The billing cycle is fully automated and synchronized dynamically using webhook callbacks:

  1. Session Request: Client checks out quote. The client sends a request to the backend serverless function /api/create-checkout.
  2. Parameter Passing: Stripe session is created with inline metadata referencing the quote_id, coverage parameters, and product type.
  3. Signature Verification: Upon successful checkout completion, Stripe invokes /api/stripe-webhook. The server validates the webhook signature using stripe.webhooks.constructEvent.
  4. Policy Generation: The server reads the verified quote_id from metadata, updates the quote state, and adds a record in the policies table, unlocking the dashboard instantly.

Idempotency Ready: Database transactions utilize UPSERT operations on Stripe Session ID to prevent duplicate policies in case of network retry packets.