A full-stack MERN E-Commerce Application inspired by the Snitch clothing brand. The project provides secure authentication, product management, cloud image uploads, shopping cart functionality, and AI-powered semantic product search using Mistral AI Embeddings and Pinecone Vector Database.
- User Registration
- User Login (JWT Authentication)
- Secure HTTP-only Cookies
- Logout
- Get Current User
- Protected Routes
- Google OAuth (In Progress)
- Create Product
- Update Product
- Delete Product
- Get All Products
- Get Product by ID
- Get Products by Category
- Get Distinct Categories
- Cloud Image Upload using ImageKit
- Product Stock Management
- Add Product to Cart
- Get Logged-in User Cart
- Remove Product from Cart
- Clear Cart
- Quantity Management
- Stock Validation before Adding Products
- Protected Cart APIs
- AI-powered Semantic Product Search
- Product Embedding using Mistral AI Embeddings
- Vector Storage using Pinecone
- Automatic Embedding Generation when Product is Created
- Automatic Embedding Update when Product is Updated
- Automatic Vector Deletion when Product is Deleted
- Semantic Similarity Search using Vector Embeddings
- JWT Authentication
- HTTP-only Cookies
- Password Hashing using bcrypt
- Protected REST APIs
- CORS Configuration
- React
- Vite
- React Router
- Axios
- Tailwind CSS
- Node.js
- Express.js
- MongoDB
- Mongoose
- Multer
- ImageKit
- JWT
- Cookie Parser
- LangChain
- Mistral AI Embeddings
- Pinecone Vector Database
snitch-fullstack/
β
βββ Backend/
β βββ src/
β β
β βββ controllers/
β β βββ auth.controller.js
β β βββ post.controller.js
β β βββ cart.controller.js
β β
β βββ middleware/
β β
β βββ models/
β β βββ user.models.js
β β βββ post.models.js
β β βββ cart.models.js
β β
β βββ routes/
β β βββ auth.routes.js
β β βββ post.routes.js
β β βββ cart.routes.js
β β
β βββ config/
β βββ app.js
β βββ package.json
β βββ .env
β
βββ Frontend/
β βββ src/
β βββ public/
β βββ package.json
β βββ vite.config.js
β
βββ README.md
git clone https://github.com/sandeep7348/snitch-fullstack.git
cd snitch-fullstackcd Backend
npm installCreate a .env file.
PORT=3000
MONGODB_URL=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
IMAGE_KIT_PUBLIC_KEY=your_public_key
IMAGE_KIT_PRIVATE_KEY=your_private_key
IMAGE_KIT_URL_ENDPOINT=your_url_endpoint
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
MISTRAL_API_KEY=your_mistral_api_key
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=your_pinecone_index_nameRun Backend
npm run devcd Frontend
npm install
npm run dev| Method | Endpoint |
|---|---|
| POST | /api/auth/register |
| POST | /api/auth/login |
| GET | /api/auth/getMe |
| POST | /api/auth/logout |
| Method | Endpoint |
|---|---|
| POST | /api/post |
| GET | /api/allpost |
| GET | /api/post/:id |
| PUT | /api/post/:postId |
| DELETE | /api/post/:postId |
| GET | /api/category/:category |
| GET | /api/categories |
| POST | /api/search |
| Method | Endpoint |
|---|---|
| POST | /api/cart/add |
| GET | /api/cart |
| DELETE | /api/cart/remove/:postId |
| DELETE | /api/cart/clear |
Every product is converted into a vector embedding using Mistral AI Embeddings.
The embedding is stored in Pinecone along with product metadata.
When a user searches for a product:
- The search query is converted into an embedding.
- Pinecone performs semantic similarity search.
- Matching product IDs are returned.
- Complete product details are fetched from MongoDB.
- Relevant products are returned to the user.
Admin Creates Product
β
βΌ
Upload Image (ImageKit)
β
βΌ
Save Product (MongoDB)
β
βΌ
Generate Embedding (Mistral AI)
β
βΌ
Store Vector (Pinecone)
User Login
β
βΌ
Browse Products
β
βΌ
Click Add to Cart
β
βΌ
Authenticate User
β
βΌ
Check Product Availability
β
βΌ
Validate Stock
β
βΌ
Create Cart / Update Existing Cart
β
βΌ
Save Cart in MongoDB
β
βΌ
Return Updated Cart
User Search Query
β
βΌ
Generate Query Embedding
β
βΌ
Pinecone Similarity Search
β
βΌ
Retrieve Matching Product IDs
β
βΌ
Fetch Products from MongoDB
β
βΌ
Return Relevant Products
{
"query": "black oversized cotton t-shirt"
}- oversized black t-shirt
- formal white shirt
- winter hoodie
- casual streetwear
- denim jeans
- cotton summer shirt
- cargo pants
- office wear
- premium men's clothing
- comfortable everyday clothes
Product images are uploaded to ImageKit.
Only the secure image URL is stored in MongoDB.
Register/Login
β
βΌ
Generate JWT
β
βΌ
Store HTTP-only Cookie
β
βΌ
Access Protected APIs
- Order Management
- Stripe / Razorpay Integration
- Wishlist
- AI Shopping Assistant
- Personalized Product Recommendations
- Product Filtering & Sorting
- Pagination
- Product Reviews & Ratings
- Admin Dashboard
- User Profile Management
- Google OAuth Authentication
Sandeep Choudhary
GitHub: https://github.com/sandeep7348
β If you found this project useful, consider giving it a star on GitHub!