How areait-dev/madrem works
Project type and purpose
• This is a single-page application (SPA) built with React, TypeScript, Vite, Tailwind CSS.
• It uses Supabase as a backend-as-a-service for authentication, database (deadlines, user settings), and real-time notifications.
• Purpose: Manage “deadlines” (contracts, domains, services, etc.) via a dashboard, with notification sounds and user settings.
File structure
• Top-level:
• public/ → static assets (audio files)
• src/ → application source
• package.json, vite.config.ts → build/configuration
• eslint.config.js, tsconfig*.json → linting/TypeScript config
• Under src/:
• pages/ → high-level routes (Dashboard, Login)
• components/ → reusable UI pieces (Navbar, Footer, Modals, Cards, Filters, ProtectedRoute, ThemeToggle)
• components/deadline-modals/ → domain-specific modal forms
• hooks/ → custom React hooks wrapping Supabase client, auth, deadlines, notifications, theme, user settings
• App.tsx, main.tsx → root React app and router setup
• Pattern: Component-based architecture, React Router (ProtectedRoute), custom hooks for side-effects/data fetching, Vite for dev/build.
README for additional insights
• Confirms Vite + React + TypeScript template.
• No explicit backend code—uses external plugins/BaaS.
• Encourages ESLint and type-aware linting (but doesn’t affect runtime architecture).
a. Main components:
• Client (Browser)
• Vite-served React SPA
• UI Components & Pages
• Build/CI (Vite / npm scripts / ESLint)
• Static Asset Store (public/ folder → served over CDN or web server)
• External Services (Supabase)
• Supabase Auth
• Supabase Database (deadlines, user settings tables)
• Supabase Realtime / Notifications
• Developer Machine (npm, IDE, Git)
b. Relationships & interactions:
1. Developer writes code → commits to Git → CI runs lint/build → deploys static bundle.
2. Browser requests index.html → loads bundled JS/CSS.
3. React App initializes, React Router routes to Login or Dashboard.
4. On Login: useAuth hook → Supabase Auth API.
5. After auth: useDeadlines hook → Supabase DB queries (CRUD).
6. useNotifications → Supabase Realtime (listen to deadlines changes).
7. UI components render data; ThemeToggle and user settings stored via useUserSettings → Supabase or localStorage.
8. Audio assets played from client/public on events.
c. Architectural patterns/design principles:
• Component-based UI decomposition
• Custom hooks encapsulate data layer and side-effects (Dependency Inversion)
• ProtectedRoute for access control (Route Guard)
• Separation of concerns: UI vs. data layer vs. build/config
• Externalizing state to BaaS (Supabase) for zero-backend maintenance
d. Key technologies/frameworks:
• Vite (dev server, bundler)
• React + React Router
• TypeScript
• Tailwind CSS
• Supabase SDK (auth, database, realtime)
• ESLint, Prettier, commitlint for code quality
Details to capture (don’t overthink—split into granular pieces)
• Public assets (audio) served as static files
• Root App → Router → Pages → Components
• Hooks as the interface to Supabase services
• Environment/config (dotenv or VITE_ env vars for Supabase URL/keys)
• User flows: login/auth, fetch deadlines, create/update/delete, realtime updates, theme toggles