How jpacoch/cartovote works
What this project is (type + purpose)
CartoVote is a lightweight, static, browser-based frontend for a municipal geo-questionnaire. The user experience is: open the web page → interact with a Leaflet map → answer questions → drop one or more pins to add geographic context → persist/submit results to a Supabase backend (DB + API).
Given the file tree, this repo is essentially a client-side web app (no server code in-repo) that likely calls Supabase directly from the browser.
What the file structure implies architecturally
From the tree:
• index.html
Entry point, page layout, and script/style inclusion. Often where Leaflet is initialized (or where the container for the map exists).
• css/style.css
• js/script.js
The entire “application layer” is likely in here:
• Initialization (Leaflet)
• survey UI logic / state
• pin placement + coordinate capture
• request(s) to Supabase (insert rows, store responses, etc.)
• package.json
What’s not present is equally important:
• No backend/, no server/, no API implementation in-repo → backend is external (Supabase).
README-derived architecture signals
The README explicitly states:
• Leaflet.js is the mapping engine (external library used in-browser).
• Supabase is the database (and implicitly, the API/auth layer if used).
• Pure HTML/CSS/Vanilla JS.
• Client-side app
• Map tile/provider dependencies (Leaflet typically requires a tile server such as OpenStreetMap or another provider—Leaflet itself is just the rendering/interaction library)
• Supabase as the persistence and (potentially) auth layer
Browser / Frontend Web App
• index.html (UI shell)
• css/style.css (presentation)
• js/script.js (app logic)
• Leaflet.js (client library dependency)
Map Tile Service (external)
• e.g., OpenStreetMap tiles or another provider (even if not named in README, it’s a real runtime dependency in most Leaflet setups)
Supabase (external backend)
• Supabase REST/GraphQL (PostgREST) and/or JS client calls (whatever the JS uses)
• Database (Postgres) storing survey responses, pin coordinates, timestamps, question answers, etc.
• (Optional if used) Supabase Auth / Storage
Page load
• User → Browser: navigate to URL
• Browser → Static Hosting: GET index.html, style.css, script.js
Map rendering
• Browser (Leaflet) → Tile Service: GET map tiles (XYZ tile requests)
Survey + pin capture
• User → Browser: clicks map / drops pin / answers questions
• Browser: stores state locally (in-memory; optionally localStorage—only show if code does it)
Persist submission
• Browser → Supabase API: insert/update survey response + geometry (lat/lng)
• Supabase API → Postgres: write rows
• Supabase API → Browser: success/failure response
If authentication exists (not in README), only add it if script.js demonstrates it. Otherwise, keep it out to avoid inaccuracy.
Architectural patterns/design principles that fit this repo
• Client-heavy architecture (logic runs in-browser)
• Backend-as-a-Service (BaaS) via Supabase
• Externalized mapping infrastructure (tile provider + Leaflet)
Relevant technologies prominently
• “Vanilla JS (ES6) + Leaflet.js”
• “Supabase (Postgres + API)”
• “Map Tile Provider (e.g., OSM)”
• “Static Hosting (serves HTML/CSS/JS)”
• User
• Static Hosting (serves the site)
• Browser App (CartoVote)
• Tile Provider
• Supabase (API + DB)
• User → Hosting (load app)
• Browser ↔ Tile Provider (tiles)
• Browser ↔ Supabase (submit/retrieve)
• UI Layer (survey form, buttons)
• Module (Leaflet initialization, pin drop, geometry capture)
• State Model (responses in memory)
• Data Access Layer (Supabase client / fetch calls)
• UI ↔ State
• Module ↔ State
• Data Access ↔ Supabase
• Developer machine (npm install, static assets)
• CI/CD (if any—only add if README/package.json indicates)
• Hosting/CDN
• Supabase project (env vars/keys)
Where configuration lives (e.g., Supabase URL/key in JS—if true in code).
What “very detailed” means here (without overthinking)
For this project, “detailed” is mainly about:
• separating static hosting vs in-browser runtime
• separating Leaflet library vs tile provider
• separating Supabase API vs Supabase DB
• explicitly showing data flows for: load → interact → submit