-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture and Database
Koneko edited this page Jul 28, 2026
·
2 revisions
This document provides a technical review of the Tamed application architecture, Zustand state store, Supabase database schema, and security policies.
Tamed uses a Hybrid Architecture that seamlessly supports both full real-time cloud sync via Supabase and an offline-first demo mode.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REACT 19 FRONTEND (VITE 6) β
β β’ Home, Rewards, Schedule, Settings, Auth & Onboarding β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β ZUSTAND 5 STATE STORE β
β (useAppStore.js Dispatch) β
βββββββββββββββββ¬ββββββββββββββββ
β
βββββββββββββββββββββββ΄ββββββββββββββββββββββ
β β
ββββββββββΌβββββββββ ββββββββββΌβββββββββ
β SUPABASE BACKENDβ β MOCK BACKEND β
β PostgreSQL + RLSβ β In-Memory Demo β
βββββββββββββββββββ βββββββββββββββββββ
-
profiles: Stores user metadata (id,uid,pair_code,role,username,points_balance,xp,level,pet_species,custom_theme_primary). -
pairings: Encapsulates pair linkages (id,owner_id,pet_id,custom_currency_name,created_at). -
calendar_entries: Daily status records (id,pairing_id,entry_date,status,notes). -
daily_tasks: Behavior Codex routines (id,pairing_id,title,xp_reward,is_completed,task_date). -
reward_items: Active store catalog items (id,pairing_id,title,cost,description,icon). -
redemptions: Store purchases (id,pairing_id,reward_id,status,created_at). -
praise_notes: Praise cards & head pats (id,pairing_id,sender_id,message,note_type). -
reminders: Scheduled check-ins and instant nudges (id,pairing_id,title,message,is_instant,reminder_time).
- All table queries are scoped to active pairings using helper function
is_user_in_pairing(pairing_id). - Profiles: Users can read and edit their own profiles or their paired partner's profile.
-
Daily Tasks: Only Owners can insert or delete daily tasks; Pets can update task completion (
is_completed). -
Redemptions: Pets can insert redemption requests; Owners can update status (
fulfilled).
- All user UIDs (
username#1234) and 6-digit pair codes (100000β999999) are generated using the Web Crypto API (window.crypto.getRandomValues) with rejection sampling to prevent predictability and modulo bias.
Wiki Aided w/ AI cuz I can't be fkd