How bhanuvarma17/eva-project- works
1. Overall shape
This is a classic MERN split into two deployable parts: a React single-page frontend in frontend/ and an Express/Node API in backend/, with MongoDB as the persistence layer. The root package.json appears to act mainly as a convenience layer for running/installing both halves together.
2. Frontend boundary
The frontend is responsible for all user-facing pages: Home, Contact, and Testimonials. It is organized as component-driven React code under frontend/src/components/, with shared styling in CSS files and a central theme palette in frontend/src/theme/colors.js.
3. Frontend data access
All API communication is funneled through frontend/src/utils/api.js, which is the main client-side boundary to the backend. This keeps the page components focused on rendering and form handling rather than direct network logic.
4. Frontend page composition
App.js likely routes or conditionally renders the main sections, while Navigation.js provides navigation across the site and Footer.js closes the layout. Home.js, Contact.js, Plans.js, and Testimonials.js are the main content modules that together form the brochure-style site.
5. Backend entrypoint
backend/server.js is the API host and the top-level backend composition point. It would typically configure Express middleware, connect to MongoDB using environment variables, mount the route modules, and listen on the configured port.
6. Backend API layer
The backend is split into route modules and controller modules. backend/routes/contactRoutes.js and backend/routes/testimonialRoutes.js define the HTTP endpoints, while the corresponding controllers implement the request handling and business logic.
7. Persistence model
MongoDB is accessed through two document models: Contact.js and Testimonial.js. These represent the two core data domains of the app: inbound customer inquiries and customer testimonials.
8. Primary data flows
There are two main flows:
• A visitor submits the contact form from the frontend; the request goes to POST /api/contact, is handled by the contact controller, and is stored in MongoDB as a contact submission.
• A visitor views or submits testimonials; the frontend reads approved testimonials from GET /api/testimonials, while testimonial submissions are stored in MongoDB and can later be reviewed via the admin-style GET /api/testimonials/all.
9. Public vs. admin-style access
The API distinguishes between public listing endpoints and “all records” endpoints. /api/testimonials returns only approved items for the public site, while /api/testimonials/all and /api/contact/all expose full collections for administrative use. There is no visible auth layer in the repository, so these endpoints are structurally separated but not protected in the code layout shown.
10. Content seeding
backend/scripts/seedTestimonials.js is an offline utility that preloads testimonial data into MongoDB. This supports the Testimonials page by ensuring there is initial content without manual entry.
11. Configuration and runtime
The backend expects environment-based configuration, with backend/env.example indicating at least MONGODB_URI and PORT. The project runs in Node.js on the backend and in the browser on the frontend, with development scripts supporting concurrent startup.
12. Styling and design system
The UI uses a fixed color palette defined in frontend/src/theme/colors.js and repeated across component-specific CSS files. This is important architecturally because visual consistency is centralized as a small theme module rather than embedded ad hoc in each component.
13. External dependencies and infrastructure
The only materially important external service is MongoDB, either local or Atlas, since it is the shared system of record for both contacts and testimonials. Express serves as the backend HTTP interface, and React serves as the client-side rendering/runtime layer.
14. What to draw in a diagram
A useful architecture diagram would show: browser user → React SPA → API utility layer → Express routes/controllers → MongoDB models/database, plus a separate arrow from seedTestimonials.js into MongoDB. The frontend should be shown as a presentation layer, the backend as an API/application layer, and MongoDB as the persistence layer.
Main entry points: App.js App · server.js Server · api.js API client · Testimonial.js Testimonial model
Components 20
Workspace
Root-level convenience and repo orchestration
- Root pkg · Top-level package for running both halves together
package.json
Frontend
React presentation layer
- App · Top-level client composition and page switching
frontend/src/App.js - Navigation · Site-wide navigation bar
frontend/src/components/Navigation.js - Footer · Shared page footer
frontend/src/components/Footer.js - Home · Main landing content
frontend/src/components/Home.js - Contact · Contact page and submission form
frontend/src/components/Contact.js - Plans · Service or pricing content section
frontend/src/components/Plans.js - Testimonials · Customer testimonial display and submission UI
frontend/src/components/Testimonials.js - API client · Single client-side boundary for backend calls
frontend/src/utils/api.js - Colors · Shared color constants for the UI
frontend/src/theme/colors.js - Client entry · Browser entrypoint and render bootstrap
frontend/src/index.js
Backend
Express API layer
- Server · API entrypoint and application composition
backend/server.js - Contact routes · Endpoints for contact submissions
backend/routes/contactRoutes.js - Testimonial routes · Endpoints for testimonial reads and writes
backend/routes/testimonialRoutes.js - Contact ctrl · Contact request processing and persistence logic
backend/controllers/contactController.js - Testimonial ctrl · Testimonial request processing and persistence logic
backend/controllers/testimonialController.js - Seed data · Preloads testimonial content into MongoDB
backend/scripts/seedTestimonials.js
Data
MongoDB persistence and seed data
- Contact model · Document model for contact submissions
backend/models/Contact.js - Testimonial model · Document model for testimonials
backend/models/Testimonial.js - MongoDB · Shared system of record for contacts and testimonials
Connections 25
- Root pkg → Client entry: run client · Workspace scripts can start the frontend
- Root pkg → Server: run api · Workspace scripts can start the backend
- Client entry → App: mounts · Bootstraps the React application
- App → Navigation: uses · Composes shared navigation
- App → Footer: uses · Composes shared footer
- App → Home: renders · Primary landing content
- App → Contact: renders · Contact page
- App → Plans: renders · Plans section
- App → Testimonials: renders · Testimonials page
- Home → Colors: styles · Uses shared palette
- Contact → API client: calls · Submits contact data to the backend
- Testimonials → API client: calls · Fetches and submits testimonials
- Navigation → Colors: styles · Uses shared palette
- Footer → Colors: styles · Uses shared palette
- Server → Contact routes: mounts · Registers contact endpoints
- Server → Testimonial routes: mounts · Registers testimonial endpoints
- Contact routes → Contact ctrl: dispatches · Delegates request handling
- Testimonial routes → Testimonial ctrl: dispatches · Delegates request handling
- Contact ctrl → Contact model: uses · Persists contact submissions
- Testimonial ctrl → Testimonial model: uses · Persists and reads testimonials
- Contact model → MongoDB: stores · Contact collection lives in MongoDB
- Testimonial model → MongoDB: stores · Testimonial collection lives in MongoDB
- Seed data → Testimonial model: loads · Creates testimonial documents
- Seed data → MongoDB: seeds · Populates the database
- API client → Server: HTTP API · Client-side network boundary to the Express API