Skip to content

maaliksaad/Teacommerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸƒ TeaCommerce: Premium E-commerce Ecosystem

TeaCommerce Banner Full Stack License

TeaCommerce is a high-fidelity, dual-backend e-commerce platform built for specialty tea retailers. It combines a robust Express.js core with a reactive NestJS social microservice to deliver a seamless, real-time shopping and community experience.


πŸ—οΈ The Architecture: Dual-Backend Strategy

TeaCommerce leverages a distributed architecture to separate concerns and optimize performance:

  1. Core API (backend): Built with Express.js, it handles the transactional heavy liftingβ€”authentication, catalog management, inventory tracking, and secure order processing.
  2. Social Microservice (reviews-service): Built with NestJS, this service manages high-frequency social interactions like real-time reviews, likes, replies, and mentions, utilizing WebSockets for instant feedback.
  3. Client Web App (frontend): A high-performance Vite + React application that provides a premium, "app-like" feel with smooth transitions and real-time state synchronization.

πŸ› οΈ Tech Stack & Badges

Frontend

React Vite Tailwind CSS Framer Motion Zustand TanStack Query TipTap

Backend (Core)

Node.js Express.js MongoDB Cloudinary Zod Swagger

Social Microservice

NestJS Socket.io TypeScript


🌟 Key Features

πŸ›’ High-Fidelity Shopping

  • Dynamic Catalog: Advanced filtering by category, price, and custom attributes.
  • Variant Management: Support for multiple product weights/types with dynamic price calculations.
  • Premium Checkout: Secure cart management and simulated payment flow.
  • Modern UI: Dark mode support, Glassmorphism, and Framer Motion micro-animations.

πŸ’¬ Social & Community (Real-time)

  • Interactive Reviews: Users can leave detailed reviews with rich text formatting.
  • User Mentions: Full @mention support in reviews and replies using TipTap.
  • Social Engagement: Real-time "Like" system and nested threading for replies.
  • Live Notifications: Instant breadcrumbs and toast alerts (via Socket.io) for mentions, likes, and social replies.

πŸ›‘οΈ Role-Based Access Control (RBAC)

  • Customer: Browsing, shopping, social interaction, and personal order history.
  • Admin: Full catalog control, inventory management, and order fulfillment tracking.
  • SuperAdmin: Global system oversight, comprehensive user management, and advanced analytics access.

πŸ“Š Advanced Dashboards

  • Live Sales Tracking: Real-time charts showing revenue growth and order volume.
  • Inventory Watchdog: Automated alerts for low-stock items.
  • User Insights: Monitoring community engagement and social metrics.

πŸ› οΈ Tech Stack

Frontend

  • Framework: React 19 + Vite
  • Styling: Tailwind CSS + Shadcn UI
  • Animations: Framer Motion
  • Editor: TipTap (Rich Text + Mentions)
  • State Management: Zustand
  • Data Fetching: TanStack Query (React Query)
  • Real-time: Socket.io-client

Backend (Main)

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB (via Mongoose)
  • Validation: Zod
  • Documentation: Swagger/OpenAPI

Reviews Service

  • Framework: NestJS (TypeScript)
  • Real-time: Socket.io / NestJS WebSockets
  • Database: MongoDB (via Mongoose)

πŸ”„ Project Flow

graph TD
    User((User/Admin)) -->|Interacts| Frontend[React Vite App]
    
    Frontend -->|Auth / Products / Orders| CoreBackend[Express Core API]
    CoreBackend -->|Stores Data| MainDB[(MongoDB)]
    CoreBackend -->|Uploads| CloudService[Cloudinary]
    
    Frontend -->|Reviews / Likes / Replies| NewsService[NestJS Social Service]
    NewsService -->|Mentions / Interaction| SocDB[(MongoDB)]
    NewsService -->|Real-time Events| Sockets((WebSockets))
    
    Sockets -->|Push Notifications| Frontend
Loading

πŸ“‚ Detailed File Structure

Teacommerce/
β”œβ”€β”€ backend/                   # Main Express API
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/       # Business logic handlers
β”‚   β”‚   β”œβ”€β”€ models/            # Mongoose schemas (User, Order, Product)
β”‚   β”‚   β”œβ”€β”€ routes/            # API endpoints (Auth, Cart, Orders, Admin)
β”‚   β”‚   β”œβ”€β”€ services/          # Core service layer
β”‚   β”‚   β”œβ”€β”€ middlewares/       # Auth & Role-based guards
β”‚   β”‚   └── utils/             # Helper functions (JWT, error handling)
β”‚   └── .env                   # Configuration
β”‚
β”œβ”€β”€ reviews-service/           # NestJS Microservice
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ reviews/           # Review, Like, & Reply logic
β”‚   β”‚   β”œβ”€β”€ notifications/     # Socket.io Gateways & Real-time emitters
β”‚   β”‚   β”œβ”€β”€ common/            # Shared guards (JWT) and decorators
β”‚   β”‚   └── main.ts            # Entry point (Port 3001)
β”‚   └── .env                   # Configuration
β”‚
└── frontend/                  # React Vite Client
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ layout/        # Navbar, Footer, Admin layouts
    β”‚   β”‚   β”œβ”€β”€ products/      # Catalog and Detail components
    β”‚   β”‚   └── ui/            # TipTap Editor & Shadcn primitives
    β”‚   β”œβ”€β”€ hooks/             # Custom hooks (Notifications, Cart, UI)
    β”‚   β”œβ”€β”€ pages/             # Route components
    β”‚   └── store/             # Zustand state stores
    └── package.json

βš™οΈ Setup & Installation

1. Prerequisites

  • Node.js v18 or higher.
  • MongoDB (Local instance or Atlas connection string).
  • Cloudinary Account (For image storage).

2. Installation

# Clone the repo
git clone https://github.com/maaliksaad/Teacommerce.git
cd Teacommerce

3. Configure Environment Variables

Create .env files in backend/, reviews-service/, and frontend/ based on the provided configuration samples.

4. Run the Services

Start the main backend:

cd backend
npm install
npm run dev

Start the reviews microservice:

cd reviews-service
npm install
npm run start:dev

Start the frontend:

cd frontend
npm install
npm run dev

πŸ’‘ Server Awareness

This project is configured for cloud hosting. Note that if hosted on a Free Tier service, the backend might experience a "cold start" period of 1-2 minutes after inactivity. A warning modal is integrated into the UI to notify users during this period.


πŸ“„ License

TeaCommerce is licensed under the MIT License.

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors