- Project setup (React + Vite + Express + MongoDB)
- All 6 MongoDB schemas designed
- Auth system (Register, Login, JWT, Middleware)
- Product API (CRUD operations)
- Home page UI
- Products listing page
- Product detail page
- Login & Register pages
- Cart (frontend + backend)
- Checkout flow
- Order management
- Impact tracker (trees + CO2 per order)
- Buyer dashboard
- Seller dashboard
- Admin panel
- Deployment
- Frontend: React + Vite + Tailwind CSS
- Backend: Node.js + Express
- Database: MongoDB Atlas
- Auth: JWT + bcryptjs
- State: Zustand
PHASES OF THE PROJECT Phase 1 — Warm Up Project setup, folder structure, connect React to Express, one test API call working end to end. Phase 2 — Schema Design (this deserves its own phase) Sit with pen and paper, design every MongoDB model. User, Product, Order, Cart, Review, SellerApplication. Think hard about relationships, what fields are needed, what's optional. Don't open VS Code for this — just think and draw. Phase 3 — Auth Register, Login, JWT, protected routes, Google OAuth. Only auth, nothing else. Phase 4 — Core Shopping Products listing, filters, search, product detail page, cart. Phase 5 — Checkout & Orders Checkout flow, Razorpay, order creation, impact counter logic, order confirmation. Phase 6 — Dashboards Buyer dashboard, Impact tracker, Seller dashboard, Add product form. Phase 7 — Admin + Deploy Admin panel, responsiveness, optimization, deployment.
create is the keyword that tells npm to scaffold a new project
PHASE 1
index.html This is the only HTML file in your entire React app. It has one single
in it. That's it. Your whole React app gets injected into that one div. main.jsx This is the entry point. It grabs thatbasicxally first we write or cdreate two folders one of server and client ,in client we stared our react app using vite and the n in our client we stared a express server before starting we installed mongoose expreess cors .env and then we created a cluster and copied that string to env file and also imported to our server.js file
PHASE 2
Schema desgin is a phase where we add what values we want to store in our database. Notice { timestamps: true } at the end — that automatically adds createdAt and updatedAt fields to every document. Always add this to every schema. Also notice unique: true on email — no two users can have the same email. {timestamps:true} this add upper hai ye schema desging wo htoa hai cheej kya kyua store karega ,agr cart ahi to wo mya kya store karega
WHY schema design comes before coding. We do schema design first because if we get our data models wrong, everything built on top breaks. It's the foundation of the foundation.
PHASE 3
In GreenCart auth works like this:
User registers → password gets encrypted → saved in DB User logs in → password checked → server creates a JWT token That token gets stored in browser cookie Every protected request sends that cookie → server verifies it → allows or blocks
Auth has two parts — authentication (who are you) and authorization (what can you do) bcryptjs hashes password so plain text is never stored in DB JWT is a token given after login — proves user is logged in on future requests Middleware is a checkpoint — verifyToken checks JWT before allowing access to protected routes Flow: Register → hash password → save to DB. Login → compare password → generate JWT → send token