How mihir-28/kittypay works
Project Type and Purpose
• KittyPay is a client-heavy, full-stack Progressive Web App (PWA) for splitting group expenses.
• The entire frontend is a React single-page application (SPA) built with Vite, styled with Tailwind CSS, and deployed on Netlify.
• The “backend” is a serverless Firebase suite: Authentication, Firestore, Cloud Functions, Storage, and Analytics.
File Structure Analysis
• Top-level files: configuration (.env.example, vite.config.js), Firebase setup (firestore.rules, FIREBASE_SETUP.md), public assets, and index.html.
• src/ directory:
• App entry (main.jsx, App.jsx)
• Components (feature folders: common, dashboard, pages, ui, layouts, contexts)
• Firebase integration helpers (src/firebase/*)
• Service worker tests (src/sw-test.js)
• Third-party service adapters (src/services/github.js)
• This structure signals a client-only codebase orchestrating service calls against Firebase.
README Insights
• Tech stack: React 18+, Vite, Tailwind, Framer Motion, Recharts, React Router, Context API.
• Firebase roles: Auth, Firestore DB, Storage, Functions, Security Rules, Analytics.
• PWA support: service worker, offline caching, install prompts.
• Deployment: Netlify CI/CD.
a. Main Components
• Client/browser layer
• React SPA (App.jsx → Routes → Page Components)
• UI components (Navbar, Footer, DashboardTabs, etc.)
• Service Worker (offline caching, sync)
• Application logic
• React Contexts (AuthContext)
• Data fetching modules (src/firebase/*.js)
• Business-logic services (expense settlement algos in kitties.js)
• External Services
• Firebase Auth (email/password + Google)
• Firebase Firestore (realtime DB for kitties, expenses, members)
• Firebase Cloud Functions (member management, settlements)
• Firebase Cloud Storage (receipt images, profile pics)
• Firebase Google Analytics
• GitHub API (optional: src/services/github.js)
• Hosting & CI/CD
• Netlify (build & deploy)
• CDN for static assets (Netlify or public folder)
b. Relationships & Data Flows
• User interactions in the browser trigger React Router navigations and component renders.
• Components call Firebase helper modules over HTTPS / WebSocket (Firestore SDK) to read/write data.
• Auth flows communicate with Firebase Auth endpoints, sending tokens that guard Firestore rules.
• Service Worker intercepts network requests to cache assets and data, enabling offline mode and sync.
• Analytics events are emitted to Google Analytics via Firebase SDK.
• Build pipeline: Vite compiles React code → Netlify deploys optimized bundle → users fetch index.html + JS/CSS.
c. Architectural Patterns & Principles
• SPA Pattern (React Router for client-side routing)
• Serverless Backend (Firebase as BaaS)
• Context-driven state management (AuthContext, Theme toggle)
• PWA design (Service Worker, manifest.json, offline first)
• Modular component architecture (feature folders, common vs. dashboard vs. pages)
d. Key Technologies
• Frontend: React, Tailwind CSS, Framer Motion, Recharts
• Build & Bundling: Vite
• Routing: React Router v6
• State: React Context API & Hooks
• Backend as a Service: Firebase (Auth, Firestore, Storage, Functions, Analytics)
• Hosting: Netlify