A full-stack mini e-commerce platform built with React (Vite) & Tailwind CSS (frontend), Node.js & Express (backend), and PostgreSQL (database).
root/
āāā backend/
ā āāā src/
ā ā āāā app.js
ā ā āāā config/
ā ā āāā controllers/
ā ā āāā models/
ā ā āāā routes/
ā āāā package.json
ā āāā ...
āāā frontend/
ā āāā src/
ā ā āāā components/
ā ā āāā pages/
ā ā āāā ...
ā āāā package.json
ā āāā ...
āāā README.md
āāā ...
git clone https://github.com/Vaasu02/Mini-E-Commerce-Platform-with-Two-Tabs.git
cd Mini-E-Commerce-Platform-with-Two-Tabs
cd backend
npm install
# Configure your PostgreSQL connection in backend/src/config/database.js or via .env
npm run init-db # Initializes the database and creates tables
npm run dev # Starts the backend server on http://localhost:5000
cd frontend
npm install
npm run dev # Starts the frontend on http://localhost:5173
backend/src/config/database.js
or use a .env
file.http://localhost:5000/api/products
POST /api/products
{
"name": "Product Name",
"price": 99.99,
"description": "Product description...",
"image_url": "https://example.com/image.jpg"
}
{
"success": true,
"data": { ...productObject }
}
{
"success": false,
"error": "Validation error message"
}
GET /api/products
{
"success": true,
"data": [ ...arrayOfProducts ]
}
GET /api/products/:id
{
"success": true,
"data": { ...productObject }
}
{
"success": false,
"error": "Product not found"
}
PUT /api/products/:id
{
"name": "Updated Name",
"price": 79.99,
"description": "Updated description...",
"image_url": "https://example.com/new.jpg"
}
{
"success": true,
"data": { ...updatedProductObject }
}
{
"success": false,
"error": "Validation error or Product not found"
}
DELETE /api/products/:id
{
"success": true,
"message": "Product deleted successfully"
}
{
"success": false,
"error": "Product not found"
}
GET /api/products/search?q=keyword&type=simple|contextual
q
: Search query stringtype
: simple
(default) or contextual
/api/products/search?q=gaming&type=simple
/api/products/search?q=Need something to sit with my family&type=contextual
GET /health
{
"success": true,
"message": "Server and database are healthy"
}
success: false
with an error message.Feel free to reach out for any questions or improvements!