How faizm10/spendsmart works
Project Type and Purpose
• This is a full-stack financial tracking web application (“SpendSmart”) built with Next.js on the front end and Supabase providing the backend services (authentication, database, storage, SMTP).
• Users can sign up/sign in, reset passwords, add transactions, view charts, and manage their account via an interactive dashboard.
File Structure
• Top level “frontend” directory contains a Next.js 13+ “app” directory (React Server Components + Client Components).
• Key subdirectories:
• app/(auth-pages) – authentication flows (sign-in/up, forgot/reset-password)
• app/dashboard – protected routes (transactions, charts, account settings)
• components – reusable UI components, grouped by category (charts, forms, kokonutui, magicui, shadcn-based UI)
• hooks – custom React hooks (use-toast, use-mobile)
• lib – shared data utilities
• utils/supabase – Supabase client, middleware, server helpers
• Config files: next.config.js, tailwind.config.ts, tsconfig.json, package.json
README for Additional Insights
• Confirms frontend is Next.js + React + TailwindCSS.
• Supabase is used for Auth, database, and hosting functions.
• No separate custom backend code; backend is entirely Supabase-hosted.
Main Components and Their Interactions
a. Client Browser (User Agent)
• Sends HTTP(S) requests to Next.js server (SSR/SSG) and directly to Supabase via client SDK.
b. Next.js Frontend
• Routing and rendering of pages (React Server Components + Client Components).
• Server-side code (getServerSideProps or API routes) calls Supabase Admin client for secure operations.
• Client-side code (React hooks, use-supabase client) interacts with Supabase Auth and Database.
c. Supabase Services
• Auth: handles sign-in/sign-up, JWT issuance, password resets (SMTP).
• Postgres Database: stores user profiles, transactions, metadata.
• Storage (optional): for file uploads (not explicitly shown but common in Supabase apps).
• Edge Functions or serverless (if used).
d. External SMTP Provider
• Triggered by Supabase Auth to send reset/password emails.
Architectural Patterns & Design Principles
• Jamstack / Serverless-first: UI delivered by Next.js, data via API (Supabase).
• Component-driven design: small, focused UI components (charts, forms, UI primitives).
• Separation of concerns: authentication flows, dashboard flows, and shared utilities separated into distinct folders.
• React hooks for state & side-effect management.
• Theme and style management via Tailwind & custom provider (providers.tsx).