Skip to content

code0era/MoraMart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ MoraMart - MERN E-Commerce Platform

MoraMart is a full-stack, feature-rich e-commerce application built for speed and scalability. It features a modern UI with Framer Motion animations, secure payments via Stripe, real-time admin analytics, and a robust caching system using Redis.

React Tailwind CSS Node.js MongoDB Stripe


πŸš€ Live Demo

πŸ‘‰ Click here to visit MoraMart Live


πŸ“Έ Screenshots

Home Page and Product Category

Screenshot 2025-12-05 225442

Shopping Cart

image

Admin Dashboard

image

Checkout Success

image

Mobile View

image

✨ Features

πŸ‘€ For Customers

  • Secure Authentication: Sign up and Login using JWT (Access & Refresh Tokens) with HTTP-Only cookies.
  • Browse & Filter: Explore products by categories (Jeans, Shoes, Glasses, etc.) with a beautiful, responsive UI.
  • Featured Products: Carousel slider highlighting top products.
  • Smart Recommendations: "People also bought" section powered by MongoDB aggregation.
  • Shopping Cart:
    • Add/Remove items
    • Adjust quantities in real-time
    • Persistent Cart: Cart items are saved to the database, so you never lose them even if you switch devices
  • Coupon System: Apply discount codes at checkout.
  • Stripe Checkout: Secure, PCI-compliant payment processing.
  • Confetti Celebration: Fun animation upon successful purchase.

πŸ›‘οΈ For Admins (Dashboard)

  • Product Management:
    • Create new products with image uploads (handled via Cloudinary)
    • Delete products
    • Toggle "Featured" status (Updates the homepage slider instantly)
  • Analytics Dashboard:
    • Visual Line Charts (Recharts) showing Daily Sales and Revenue trends
    • Quick stats: Total Users, Total Products, Total Sales, Total Revenue
  • Redis Caching: Featured products are cached for lightning-fast load times.

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
React (Vite) Fast UI framework with instant module replacement
Tailwind CSS Utility-first CSS framework for styling
Zustand Lightweight global state management (Cart, User, Products)
Framer Motion Smooth, production-ready animations
Lucide React Beautiful, consistent SVG icons
Recharts Composable charting library for analytics
Axios Promise-based HTTP client
React Hot Toast Elegant notifications and alerts

Backend

Technology Purpose
Node.js & Express Server and API routing
MongoDB & Mongoose NoSQL database with object modeling
Redis (Upstash) In-memory caching for featured products
Cloudinary Cloud-based image storage and optimization
Stripe API Secure payment processing
JWT & bcryptjs Authentication and password hashing

βš™οΈ Environment Variables

To run this project locally, create a .env file in the backend directory with the following variables:

# Server Configuration
PORT=5000
MONGO_URI=your_mongodb_connection_string
NODE_ENV=development

# Authentication Secrets
ACCESS_TOKEN_SECRET=your_super_secret_access_key
REFRESH_TOKEN_SECRET=your_super_secret_refresh_key

# Redis (Caching)
REDIS_URL=your_redis_connection_string

# Cloudinary (Image Uploads)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret

# Stripe (Payments)
STRIPE_SECRET_KEY=your_stripe_secret_key
CLIENT_URL=http://localhost:5173

# Frontend Keys (If needed in .env or strictly in Vite config)
# VITE_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key

πŸš€ Installation & Running Locally

1. Clone the Repository

git clone https://github.com/yourusername/moramart.git
cd moramart

2. Install Dependencies

Backend:

npm install

Frontend:

cd frontend
npm install

3. Run the Application

Terminal 1 (Backend):

# From root
npm run dev
# Server will start on http://localhost:5000

Terminal 2 (Frontend):

# From frontend folder
cd frontend
npm run dev
# App will start on http://localhost:5173

πŸ“¦ Deployment

This project is configured for Single Deployment. The frontend is built into static files and served by the Express backend.

Build Command

npm run build

This command:

  1. Installs backend dependencies
  2. Enters the frontend folder
  3. Installs frontend dependencies
  4. Builds the React app
  5. Moves the dist folder to the backend

Start Command

npm start

πŸ“‚ Project Structure

moramart/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ middleware/
β”‚   β”œβ”€β”€ server.js
β”‚   └── package.json
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ store/
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   └── main.jsx
β”‚   β”œβ”€β”€ vite.config.js
β”‚   └── package.json
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ package.json
└── README.md

πŸ” Security Features

  • JWT Authentication: Secure token-based authentication with refresh tokens
  • HTTP-Only Cookies: Prevents XSS attacks
  • Password Hashing: bcryptjs for secure password storage
  • PCI Compliance: Stripe handles all sensitive payment data
  • CORS Protection: Configured to accept requests only from trusted origins
  • Input Validation: Server-side validation on all endpoints

🚦 API Endpoints Overview

Authentication

  • POST /api/auth/signup - Register a new user
  • POST /api/auth/login - Login user
  • POST /api/auth/logout - Logout user
  • POST /api/auth/refresh - Refresh access token

Products

  • GET /api/products - Get all products
  • GET /api/products/:id - Get single product
  • POST /api/products - Create product (Admin)
  • DELETE /api/products/:id - Delete product (Admin)

Cart

  • GET /api/cart - Get user's cart
  • POST /api/cart - Add to cart
  • PUT /api/cart/:id - Update cart item
  • DELETE /api/cart/:id - Remove from cart

Orders

  • POST /api/orders - Create order
  • GET /api/orders - Get user's orders

Admin

  • GET /api/admin/analytics - Get sales analytics (Admin)

🀝 Contributing

Contributions are welcome! Here's how to contribute:

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

Distributed under the MIT License. See LICENSE for more information.


πŸ‘¨β€πŸ’» Author

[Your Name]


πŸ™ Acknowledgments


πŸ“ž Support

If you have any questions or issues, please feel free to:

  • Open an issue on GitHub
  • Contact me via email
  • Reach out on LinkedIn

Happy Coding! πŸŽ‰

Build With loveπŸ’– @code0era πŸŽ‰

About

An e-commerce store to sell and buy : Designed for both buyers and suppliers directly!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages