A full-stack e-commerce application specialized in baby products, built with React and Node.js.
- Authentication: Secure user registration and login with JWT
- Product Catalog: Browse products by category with search and filtering
- Product Details: Detailed product pages with images and descriptions
- Shopping Cart: Add, remove, and manage cart items with quantity control
- Responsive Design: Mobile-friendly interface with modern UI
- Product Management: Create, edit, and delete products
- Category Management: Organize products into categories
- Offer Management: Create special offers and discounts
- Dashboard: Comprehensive admin interface for store management
- React 19.1.1 - Modern UI library
- Vite 7.1.2 - Fast build tool and dev server
- React Router DOM 7.8.2 - Client-side routing
- TailwindCSS 3.4.17 - Utility-first CSS framework
- Lucide React - Beautiful icons
- Node.js - JavaScript runtime
- Express.js 4.21.2 - Web application framework
- MongoDB - NoSQL database
- Mongoose 8.16.5 - MongoDB object modeling
- JWT - Authentication tokens
- bcrypt - Password hashing
- Multer - File upload handling
desoft/
βββ clientside/ # React frontend
β βββ src/
β β βββ Pages/ # Route components
β β β βββ Home.jsx # Landing page
β β β βββ Products.jsx # Product catalog
β β β βββ ProductDetail.jsx # Individual product page
β β β βββ Cart.jsx # Shopping cart
β β β βββ Auth.jsx # Login/Register
β β β βββ Admin.jsx # Admin dashboard
β β βββ components/ # Reusable components
β β β βββ Nav.jsx # Navigation bar
β β β βββ Footer.jsx # Footer component
β β β βββ ProtectedRoute.jsx # Route protection
β β βββ context/ # React context
β β β βββ AuthContext.jsx # Authentication state
β β βββ services/ # API services
β β βββ api.js # API communication
β βββ public/ # Static assets
βββ serverside/ # Express backend
βββ controllers/ # Business logic
β βββ authController.js # Authentication
β βββ ProductApi.js # Product operations
β βββ CartApi.js # Cart operations
β βββ CategoryApi.js # Category management
β βββ OfferApi.js # Offer management
βββ routes/ # API routes
β βββ auth.routes.js # Auth endpoints
β βββ user.routes.js # User endpoints
β βββ admin.routes.js # Admin endpoints
βββ MongoDb/ # Database
β βββ models/ # Data models
β βββ connect.js # Database connection
βββ index.js # Server entry point
- Node.js (v16 or higher)
- MongoDB (local or cloud instance)
- npm or yarn
-
Clone the repository
git clone <repository-url> cd dp-store
-
Backend Setup
cd serverside npm install -
Frontend Setup
cd clientside npm install -
Environment Variables Create a
.envfile in theserversidedirectory:PORT=5000 MONGODB_URL=mongodb://localhost:27017/dpstore JWT_SECRET=your_jwt_secret_key_here
-
Start the Backend Server
cd serverside npm startServer will run on
http://localhost:5000 -
Start the Frontend Development Server
cd clientside npm run devFrontend will run on
http://localhost:5173
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logout
GET /api/user/products- Get all productsGET /api/user/product/:id- Get product by IDGET /api/user/products/category/:category- Get products by categoryGET /api/user/products/on-offer- Get products on offerPOST /api/user/cart- Add to cartGET /api/user/cart/:userId- Get user cartPUT /api/user/cart/:userId/:productId- Update cart itemDELETE /api/user/cart/:userId/:productId- Remove from cart
POST /api/admin/product- Create productPUT /api/admin/product/:id- Update productDELETE /api/admin/product/:id- Delete productPOST /api/admin/category- Create categoryPOST /api/admin/offer- Create offer
- Secure JWT-based authentication
- Password hashing with bcrypt
- Protected routes for admin access
- Persistent login state
- Complete CRUD operations for products
- Category-based organization
- Stock management
- Special offers system
- Image upload support
- Interactive product catalog with filtering
- Detailed product pages
- Shopping cart with quantity management
- Real-time cart updates
- Responsive design for all devices
- Comprehensive product management
- Category and offer management
- Intuitive tabbed interface
- Modal-based forms for data entry
- Uses React Context for global state management
- Modular component structure
- API service layer for backend communication
- Protected routes for admin functionality
- RESTful API design
- Mongoose schemas for data modeling
- JWT middleware for authentication
- CORS enabled for cross-origin requests
- User: Authentication and user data
- Product: Core product information
- Cart: Shopping cart items
- Category: Product categorization
- Offer: Special promotions
- Order: Purchase tracking
- Set up MongoDB database (MongoDB Atlas recommended)
- Configure environment variables
- Deploy to platforms like Heroku, Railway, or DigitalOcean
- Build the React app:
npm run build - Deploy to platforms like Netlify, Vercel, or GitHub Pages
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
For support and questions, please open an issue in the repository or contact the development team.
Desoft - Your trusted partner for premium baby care products! πΆποΈ