How kaishoya/drink-counter works
Project Type and Purpose
• This is a full-stack web application built with Nuxt 3 (Vue) on the front end and Supabase on the back end.
• Key features: user authentication (Supabase Auth), drink counter pages, charting, and CRUD operations on drinks and labels via Supabase.
File-Structure Analysis
• Top-Level:
• nuxt.config.ts, package.json, pnpm-lock.yaml: Nuxt & dependency config.
• compose.yaml: likely Docker Compose setup for local Supabase.
• supabase/: database migrations, seed data, config.toml.
• app/: Nuxt application folder containing pages, components, layouts, plugins, middleware, assets, utils.
• store/: Pinia state management, split into data (models mirroring Supabase tables), pages (composed view models), supabase client store, and user store.
• i18n/: internationalization config and locale files.
• public/: static files (e.g., verification HTML).
• GitHub workflows: CI, linting, release, staging/production deploy, migration.
• Patterns:
• Atomic design for components (atoms, molecules, domain-based grouping).
• Pinia layered stores: data stores → page stores → component view usage.
• Supabase CLI and migrations for schema management.
• Environment configuration (.env.template).
Insights from README
• Confirms atomic/component structure, Pinia usage, and supabase folder roles.
• Development flow: supabase start → pnpm dev.
• Release and branching conventions.
• Clarifies responsibilities for each top-level folder.
Main Components
a. Frontend Application
• Nuxt 3 Server and Client
• Vue Pages (pages/), Components (atoms→molecules→domain), Layouts, Plugins, Middleware.
• Pinia Store Modules: data models, page stores, supabase store, user store.
• i18n.
b. API Layer
• Supabase-JS client initiated in a Pinia supabase store.
• REST/RPC calls to Supabase PostgREST, Auth, and Functions (if any).
c. Backend Services
• Supabase Postgres Database with tables (drinks, drink_counters, drink_labels, user_settings) and RLS policies.
• Supabase Auth for user management.
• Supabase Functions (serverless) if used for custom logic (not present in file tree but reserved).
• Migration service (CLI applying SQL in supabase/migrations).
d. External Services and Infrastructure
• CI/CD: GitHub Actions (lint, tests, migrate, release).
• Hosting: Vercel (Nuxt deployed), Supabase hosted DB.
• supabase CLI & local Docker compose for local dev.
• GitHub (repo, versioning).
Interactions and Data Flows
• User opens Nuxt app in browser → requests page from Nuxt server or static host.
• Nuxt page triggers Pinia actions → calls Supabase-JS client with user’s access token.
• Supabase Auth endpoint verifies user → returns session.
• Pinia data store performs CRUD via Supabase REST/RPC → database tables.
• Query results flow back through Pinia into Vue components → rendered charts/tables/UI.
• CI pipeline triggers on push → runs lint, tests, supabase migration (production/staging), deploys to Vercel.
Architectural Patterns and Principles
• Component-based UI with atomic/molecular design.
• Layered state management: data models abstract raw DB, page stores compose multiple data models.
• Clear separation between presentation (Vue), state (Pinia), and persistence (Supabase).
• Use of environment configurations for API keys and endpoints.
• Infrastructure as code for migrations (SQL files) and CI workflows.
Elements
• Frontend (Vue/Nuxt)
• State Management (Pinia)
• Backend Services (Supabase)
• CI/CD & Hosting
• Environment artifacts (.env, compose.yaml) near Supabase components to show local dev setup.
• Migration flow: SQL files → applied to DB.
Summary
– Capture the atomic component hierarchy, Pinia store layering, Supabase roles, and CI/CD pipeline.
– This will give a comprehensive, accurate representation of the drink-counter system architecture.