How carlosfigueroapicado/stain-the-canvas works
1. Overall shape
This is a static, multi-page frontend application. The browser loads HTML/CSS/JavaScript directly, and all dynamic data comes from Supabase rather than a custom backend.
2. Public site surface
The public-facing entry points are index.html and catalogo.html. These pages present the artisanal product catalog, product details, and WhatsApp contact actions for customers.
3. Admin surface
admin.html and login.html form the management area. The login page authenticates an admin user, and the admin dashboard exposes create/read/update/delete flows for products plus image upload handling.
4. Client-side module split
The JavaScript is organized by responsibility:
• js/supabase.js centralizes the Supabase client/config
• js/auth.js handles auth state and access control
• js/login.js drives the login form
• js/admin.js orchestrates admin UI actions
• js/productos.js encapsulates product data operations
• js/catalogo.js renders the public catalog
• js/index.js likely powers the landing page
• js/dashboard.js and js/analytics.js support admin metrics/summary views
5. Primary data store
The main domain table is productos in Supabase. The documented fields are id, nombre, descripcion, precio, imagen_url, and categoria, with created_at and updated_at used as supporting metadata.
6. Data flow for the catalog
Public pages read from Supabase, transform product records into UI cards and detail views, and display the stored imagen_url. The catalog is therefore a read-only consumer of the product table and public image URLs.
7. Customer contact flow
The public product experience includes a WhatsApp button with a prefilled message. That means the browser assembles a contact intent from product context and hands the user off to an external messaging channel, rather than submitting a form to the app itself.
8. Authentication and access boundary
Admin access is protected with Supabase Auth. The login flow authenticates the user in the browser, and the protected admin pages rely on client-side auth state plus backend policies to determine whether writes are allowed.
9. Media storage
Product images are stored in Supabase Storage in a public bucket named productos. The admin flow uploads the file, retrieves a public URL, and saves that URL in productos.imagen_url so the same asset can be rendered in the catalog and detail views.
10. Security and database rules
supabase/setup.sql is the architectural control point for database permissions and row-level security. The README explicitly expects authenticated-only write access, which means the real security boundary lives in Supabase policies rather than in the frontend code.
11. Presentation layer
css/styles.css defines the shared visual system across pages. The repo is entirely frontend-rendered, so layout, typography, and responsive behavior are part of the same client bundle rather than a separate UI service.
12. Infrastructure dependency
The only external platform dependency is Supabase, which provides three roles in the architecture: authentication, database persistence, and object storage. Everything else is served as static files from the repository.
Main entry points: admin.js Admin UI · productos.js Products · catalogo.js Catalog UI · auth.js Auth
Components 19
Public site
Customer-facing pages and flows
Admin surface
Authentication and product management
Client modules
Browser-side JavaScript organization
- Styles · Shared visual system across pages
css/styles.css - Supabase · Centralized Supabase client and configuration
js/supabase.js - Auth · Session state and admin access checks
js/auth.js - Login UI · Login form behavior and authentication flow
js/login.js - Admin UI · Create, update, delete, and upload actions
js/admin.js - Products · Product data operations against Supabase
js/productos.js - Catalog UI · Public catalog rendering and product cards
js/catalogo.js - Landing UI · Landing page behavior and presentation
js/index.js - Dashboard · Admin summary and metrics view
js/dashboard.js - Analytics · Analytics support for admin summaries
js/analytics.js
Supabase platform
Hosted auth, database, and storage
- Policy SQL · RLS and permission setup for Supabase
supabase/setup.sql - Auth · Supabase authentication provider
- Database · Supabase persistence for productos and metadata
- Storage · Public image bucket for product assets
- WhatsApp · Out-of-app customer contact destination
Connections 25
- Home → Landing UI: loads · Landing page behavior is driven by the home script
- Catalog → Catalog UI: loads · Catalog page uses the catalog renderer
- Login → Login UI: loads · Login page binds the sign-in form logic
- Admin → Admin UI: loads · Admin dashboard is orchestrated by admin UI logic
- Admin → Dashboard: shows · Dashboard/summary content supports the admin surface
- Home → Styles: styles · Shared styles apply to the landing page
- Catalog → Styles: styles · Shared styles apply to the public catalog
- Login → Styles: styles · Shared styles apply to the login page
- Admin → Styles: styles · Shared styles apply to the admin dashboard
- Login UI → Auth: uses · Login flow relies on shared auth state handling
- Admin UI → Auth: guards · Admin actions are gated by auth state
- Admin UI → Products: uses · Admin CRUD is built on product data operations
- Catalog UI → Products: reads · Catalog renders product data from the domain module
- Landing UI → Products: reads · Landing page may surface featured products
- Dashboard → Analytics: uses · Dashboard pulls in analytics support
- Products → Supabase: calls · Product operations use the shared Supabase client
- Auth → Supabase: calls · Auth state and session checks use the shared client
- Login UI → Auth: authenticates · Browser login delegates to Supabase Auth
- Auth → Auth: sessions · Access control depends on Supabase Auth sessions
- Products → Database: reads/writes · Product records live in Supabase database tables
- Policy SQL → Database: configures · SQL establishes database rules and policies
- Admin UI → Storage: uploads · Admin image upload flow targets public storage
- Catalog UI → Storage: renders · Public catalog displays stored image URLs
- Catalog UI → WhatsApp: handoff · Product interactions open a prefilled WhatsApp message
- Admin UI → Database: writes · Admin CRUD persists product changes in the database