How bharathraj0643/phonoria works
Project Type and Purpose
• This is a full-stack e-commerce web application (“Ecommerce”).
• The frontend is a React SPA built with Vite and deployed on Vercel.
• The backend is a Node.js API (likely Express) deployed via Fly.io.
File Structure Analysis
Top-level:
• .github/workflows – CI/CD definitions for both frontend (Vercel) and backend (Fly.io).
• backend/ – Node.js API service.
• frontend/ – React UI client.
backend/:
• src/ – app.js, index.js, constants, utils (api-error & api-response), db module.
• backend-tech-stack.md – lists frameworks and libraries.
• fly-deploy/ – Dockerfile and fly.toml configs for dev/test/prod.
frontend/:
• src/ – main.jsx, App.jsx, Layout, components, assets, constants/env.js.
• vite.config.js, vercel.json – build and deployment config.
• frontend-tech-stack.md – tech overview.
Key Insights from README
• Minimal README with live URL: https://phonoria.vercel.app/
Main System Components
A. React Frontend (Client)
• Runs in user’s browser.
• Hosted on Vercel.
• Routes (App.jsx → Layout → pages, 404).
• Calls backend API endpoints.
B. Node.js Backend API
• Exposes RESTful endpoints (src/app.js, src/index.js).
• Business logic, error/response wrappers.
• Database adapter (src/db/index.js).
C. Database
• Likely PostgreSQL or MongoDB (check backend/env.sample).
• Managed externally or via Fly.io add-on.
D. CI/CD / Deployment
• GitHub Actions triggers on push/PR.
• Frontend jobs deploy to Vercel.
• Backend jobs build Docker image, deploy to Fly.io (dev/test/prod).
E. Environment & Config
• env.sample in both frontend and backend for secrets/config.
• fly.toml for Fly.io environments.
• vercel.json for frontend routing/build settings.
Relationships & Data Flows
• User’s Browser → (HTTPS) → Vercel-served React SPA
• React SPA → (HTTPS API calls) → Fly.io Node.js service
• Node.js service → (DB client) → Database
• GitHub Actions → (build/deploy) → Vercel & Fly.io
Architectural Patterns & Principles
• Layered Architecture in backend:
• Routing → Controllers (app.js) → Services/DB → Utils (errors/responses).
• Separation of Concerns:
• Frontend vs Backend clear boundary.
• Config & secrets externalized (env files).
• Containerization: backend runs in Docker.
• Deployment overlays: indicate “Deployed on Vercel” vs “Deployed on Fly.io”.
• Versioning: note separate dev/test/prod environments for backend.