How mehul-anand/vinylstore works
Project type and purpose
• This is a full-stack e-commerce single-page application (“Vinyl Store”) built with React on the front end and a Node/Express server on the back end.
• It provides product browsing, filtering, cart and wishlist management, user authentication, and payment integration via Razorpay.
File structure
• Top-level split:
– public/ – static assets and HTML shell
– src/ – client and server code
– src/backend/ – Express controllers, in-memory JSON “db” and auth utilities
– src/Components, Pages, Context, Reducer, Utils – React UI modules, state management, API helpers
– server.js – Express app bootstrap, routes wired to controllers
• Patterns:
– Front-end uses React Context + Reducer (flux-style) for global state
– Back-end follows MVC-style controllers accessing JSON data files
– No external database; JSON files simulate persistence
• Build & deployment: single monorepo, likely two processes (webpack dev server or create-react-app and Node server)
README for additional insights
• Features: login/signup/logout, product filters, cart/wishlist flows, Razorpay payment
• Technical stack: React, Context API, Node, Express, Razorpay API
a. Main components
• User’s Web Browser / SPA (React App)
• Front-End Modules:
– UI Components (Pages, Components folder)
– State Management (Context + Reducers)
– API Utility Layer (Utils files calling REST endpoints)
• API Layer: Express Server (server.js + routes)
• Business Logic: Controllers (AuthController, ProductController, CartController, etc.)
• Data Layer: JSON “db” files under src/backend/db
• External Services: Razorpay payment gateway
b. Relationships & data flow
1. User interacts with UI → triggers React event handler
2. React dispatches to Context/Reducer → updates in-memory client state
3. For data fetch/mutation → front end HTTP calls to Express routes
4. Express route → calls appropriate Controller → reads/writes JSON db → returns JSON response
5. Payment checkout flow → front end initializes Razorpay widget → server calls Razorpay API via authUtils → confirm transaction
c. Architectural patterns / design principles
• SPA architecture: clear separation between view, client state, and API calls
• MVC in back end: thin routing layer, controller per resource
• Layered approach: UI → state → API → business logic → data
• Monolithic repo but logically decoupled front end and back end
d. Key technologies/frameworks
• React with Context API + CSS modules
• Node.js + Express.js
• Razorpay SDK (payment integration)
• JSON files as pseudo-database
Detailed guidance
• React sub-components at a high level (UI vs state vs API helpers)
• JSON files directory as a logical database layer