Skip to content

Kalharapasan/Ecommerce-App-I

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ E-Commerce App (Client + Server)

πŸ“Έ Screenshots

Home Page Product Page Cart Page Admin Dashboard
Home Product Cart Admin

βœ… Overview

This repository includes both the client (React + Vite + Tailwind CSS) and the server (Node.js + Express + MongoDB) for a full e-commerce application.

Key backend features:

  • JWT authentication
  • MongoDB with Mongoose
  • File uploads via Cloudinary
  • Stripe payments
  • Cart & order management

🧩 Tech Stack

Client: React, Vite, Tailwind CSS
Server: Node.js, Express
Database: MongoDB (Mongoose)
Auth: JWT
Payments: Stripe
File Storage: Cloudinary


πŸ“¦ Prerequisites

  • Node.js v18+
  • npm or yarn
  • MongoDB connection URI
  • Cloudinary credentials:
    • CLOUDINARY_CLOUD_NAME
    • CLOUDINARY_API_KEY
    • CLOUDINARY_API_SECRET
  • Stripe secret key

πŸ” Environment Variables

server/.env

PORT=4000
MONGODB_URI=<your-mongodb-uri>
JWT_SECRET=<strong-jwt-secret>
CLOUDINARY_CLOUD_NAME=<cloud_name>
CLOUDINARY_API_KEY=<api_key>
CLOUDINARY_API_SECRET=<api_secret>
STRIPE_SECRET_KEY=<stripe_secret_key>
STRIPE_WEBHOOK_SECRET=<stripe_webhook_secret>  # optional
COOKIE_SECRET=<cookie-secret>                  # optional

client/.env (optional)

VITE_API_BASE_URL=http://localhost:4000

βš™οΈ Local Setup

1️⃣ Install dependencies

# Server
cd server
npm install

# Client
cd ../client
npm install

2️⃣ Run the server

cd server
npm run serve    # development with nodemon
# or
npm start        # production

Default port: 4000

3️⃣ Run the client

cd client
npm run dev

Default Vite port: http://localhost:5173


πŸ”„ Scripts

Server

  • npm run serve β€” dev mode with nodemon
  • npm start β€” production

Client

  • npm run dev β€” Vite dev server
  • npm run build β€” production build
  • npm run preview β€” preview build

πŸ“‘ API Routes (server)

  • GET / β€” health check
  • /api/user/* β€” user auth & profile
  • /api/seller/* β€” seller functionality
  • /api/product/* β€” products CRUD
  • /api/cart/* β€” cart actions
  • /api/address/* β€” addresses
  • /api/order/* β€” orders & Stripe webhook

Auth header format:

Authorization: Bearer <token>

☁️ Cloudinary & Stripe

  • Cloudinary config via configs/cloudinary.js
  • Stripe integration for payment + optional webhook handling with STRIPE_WEBHOOK_SECRET

πŸš€ Deployment Notes

Server: Set production environment variables for MongoDB, Stripe, Cloudinary, JWT, etc.

Client: Deploy /dist to services like Netlify, Vercel, Surge, or serve statically via Express.


πŸ›  Common Issues

Issue Fix
MongoDB connection fails Ensure valid URI (mongodb+srv:// or mongodb://)
Cloudinary not working Check env variables
CORS/cookies broken Update CORS settings in Express
Wrong DB name Update in server .connect() if needed

πŸ“‚ Project Structure

root/
β”œβ”€β”€ client/                 # Frontend (React + Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ public/
β”‚   └── ...
β”œβ”€β”€ server/                 # Backend (Express + MongoDB)
β”‚   β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ configs/
β”‚   β”œβ”€β”€ middleware/
β”‚   └── ...
└── README.md

πŸ“œ License: Proprietary – Permission Required


If you’d like extra sections (setup screenshots, Docker support, or contribution guidelines), just say the word!

About

No description, website, or topics provided.

Resources

License

Stars

6 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages