A comprehensive, full-stack e-commerce platform built with modern web technologies, featuring authentication, product management, shopping cart, and order processing capabilities.
- User Registration & Login with secure JWT authentication
- Email Verification with token-based verification system
- Password Reset functionality with secure tokens
- Password encryption using bcryptjs
- Protected routes with role-based access control
- Persistent login sessions across page refreshes
- Automatic token validation and expiry handling
- Seamless user data persistence in localStorage
- Form validation with Zod schemas and react-hook-form
- Responsive design with Tailwind CSS
- Interactive modals with React Portals for proper z-index layering
- Toast notifications with smart fallback system (works with/without react-hot-toast)
- Loading states and smooth animations
- Mobile-first approach with clean, modern interface
- Lazy loading with React.lazy and Suspense for optimal performance
- URL-based navigation with persistent tab states
- Consistent design system with icon-free buttons and clean typography
- Product catalog with categories and detailed views
- Shopping cart functionality
- Order management system
- User profiles with comprehensive management
- Profile information editing with avatar upload
- Password change with validation
- Address management with multiple address types
- Email verification status
- Address Management
- Multiple address support (Home, Work, Other)
- Default address selection
- City autocomplete with Geoapify API integration
- Color-coded address type badges
- Newsletter subscription system
- Search and filtering capabilities
- TypeScript for type safety across the entire stack
- ESLint for code quality and consistency (zero warnings)
- Hot reload for fast development
- Environment-based configuration
- Clean architecture with separation of concerns
- Type-safe API responses with proper interfaces
- Optimized production builds with code splitting and tree shaking
- Security vulnerability-free dependencies
- React 19 with TypeScript for modern UI development
- Vite for lightning-fast development and optimized builds
- Tailwind CSS for utility-first styling
- React Router for client-side routing
- Zustand for lightweight state management
- React Hook Form with Zod validation
- Axios for API communication
- Lucide React for beautiful icons
- Node.js with Express.js framework
- MongoDB with Mongoose ODM
- JWT for secure authentication
- bcryptjs for password hashing
- Express Validator for input validation
- Helmet for security headers
- Morgan for request logging
- Rate limiting for API protection
- ESLint with TypeScript support
- Nodemon for development server
- CORS for cross-origin requests
- dotenv for environment management
ShopCo/
βββ client/ # React Frontend Application
β βββ src/
β β βββ components/ # Reusable UI Components
β β β βββ ui/ # Core UI components (Modal, ConfirmModal)
β β β βββ layout/ # Layout components (Header, Footer)
β β β βββ forms/ # Form components (Input, Button)
β β β βββ auth/ # Authentication components (ProtectedRoute)
β β β βββ providers/ # Context providers (ToastProvider)
β β β βββ cart/ # Shopping cart components
β β βββ pages/ # Page Components
β β β βββ auth/ # Authentication pages (Login, Signup)
β β β βββ home/ # Home page components
β β β βββ NotFound.tsx # 404 error page
β β βββ services/ # API Services
β β β βββ api.ts # Main API configuration
β β β βββ authService.ts # Authentication API calls
β β β βββ toastService.ts # Toast notification service
β β βββ stores/ # State Management (Zustand)
β β β βββ authStore.ts # Authentication state
β β βββ schemas/ # Validation Schemas (Zod)
β β β βββ auth.schemas.ts # Auth form validation
β β βββ hooks/ # Custom React Hooks
β β β βββ useAuth.ts # Authentication hook
β β βββ routes/ # Routing Configuration
β β β βββ AppRoutes.tsx # Main route definitions
β β βββ types/ # TypeScript Definitions
β β β βββ auth.types.ts # Authentication types
β β βββ config/ # Configuration Files
β βββ package.json
βββ server/ # Express Backend API
βββ models/ # Database Models (Mongoose)
β βββ User.js # User model with authentication
β βββ Product.js # Product catalog model
β βββ Category.js # Product categories
β βββ Order.js # Order management
βββ routes/ # API Route Handlers
β βββ authRoutes.js # Authentication endpoints
βββ controllers/ # Business Logic Controllers
βββ middleware/ # Custom Middleware
βββ validators/ # Input Validation
βββ utils/ # Utility Functions
βββ config/ # Database & App Configuration
βββ index.js # Main server entry point
βββ .env # Environment variables
βββ package.json
- Node.js (v18 or higher)
- MongoDB (local installation or MongoDB Atlas)
- yarn or npm package manager
-
Clone the repository
git clone https://github.com/marmikitpl-dev/ShopCo.git cd ShopCo -
Install dependencies
# Install server dependencies cd server yarn install # Install client dependencies cd ../client yarn install
-
Environment Setup
# Copy environment template cd server cp .env.example .env
Configure your
.envfile:# Server Configuration PORT=5000 NODE_ENV=development # Database MONGODB_URI=mongodb://localhost:27017/shopco # Or use MongoDB Atlas: mongodb+srv://username:password@cluster.mongodb.net/shopco # JWT Configuration JWT_SECRET=your-super-secret-jwt-key-here JWT_EXPIRES_IN=7d # CORS Configuration CLIENT_URL=http://localhost:5173
-
Database Setup
# Make sure MongoDB is running locally, or use MongoDB Atlas # The application will automatically create the database and collections
-
Start the backend server
cd server yarn devServer will run on
http://localhost:5000 -
Start the frontend (in a new terminal)
cd client yarn devClient will run on
http://localhost:5173
-
Build the client
cd client yarn build -
Start the server
cd server yarn start
yarn dev- Start development serveryarn build- Build for productionyarn preview- Preview production buildyarn lint- Run ESLint
yarn start- Start production serveryarn dev- Start development server with nodemon
GET /- Welcome messageGET /api- API informationGET /api/health- Health check endpoint
POST /api/auth/register- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user profilePUT /api/auth/profile- Update user profilePUT /api/auth/change-password- Change user passwordPOST /api/auth/verify-email- Verify email with tokenPOST /api/auth/resend-verification- Resend verification emailPOST /api/auth/forgot-password- Request password resetPOST /api/auth/reset-password- Reset password with token
GET /api/addresses- Get all user addressesPOST /api/addresses- Add new addressPUT /api/addresses/:id- Update addressDELETE /api/addresses/:id- Delete addressPUT /api/addresses/:id/default- Set address as default
POST /api/newsletter/subscribe- Subscribe to newsletterPOST /api/newsletter/unsubscribe- Unsubscribe from newsletter
GET /api/products- Get all productsGET /api/products/:id- Get product by IDPOST /api/products- Create new product (Admin)PUT /api/products/:id- Update product (Admin)DELETE /api/products/:id- Delete product (Admin)
GET /api/categories- Get all categoriesPOST /api/categories- Create category (Admin)
GET /api/orders- Get user ordersPOST /api/orders- Create new orderGET /api/orders/:id- Get order by ID
The client is optimized for Vercel deployment:
-
Connect your repository to Vercel
-
Configure build settings:
- Build Command:
yarn build - Output Directory:
dist - Root Directory:
client
- Build Command:
-
Environment Variables:
VITE_API_BASE_URL=https://your-backend-url.com
The server is configured for Render deployment:
-
Connect your repository to Render
-
Configure service settings:
- Build Command:
yarn install - Start Command:
yarn start - Root Directory:
server
- Build Command:
-
Environment Variables:
NODE_ENV=production PORT=10000 MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/shopco JWT_SECRET=your-production-jwt-secret JWT_EXPIRES_IN=7d CLIENT_URL=https://your-frontend-url.vercel.app
- Frontend: Netlify, GitHub Pages, AWS S3
- Backend: Railway, Heroku, AWS EC2, DigitalOcean
# Server Configuration
PORT=5000 # Server port
NODE_ENV=development # Environment (development/production)
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/shopco # MongoDB connection string
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-here # JWT signing secret
JWT_EXPIRES_IN=7d # JWT expiration time
# CORS Configuration
CLIENT_URL=http://localhost:5173 # Frontend URL for CORS
# Optional: Email Configuration (for future features)
# SMTP_HOST=smtp.gmail.com
# SMTP_PORT=587
# SMTP_USER=your-email@gmail.com
# SMTP_PASS=your-app-password# API Configuration
VITE_API_BASE_URL=http://localhost:5000 # Backend API URLcd client
# Run tests (when implemented)
yarn test
# Run linting
yarn lintcd server
# Run tests (when implemented)
yarn test
# Check for security vulnerabilities
yarn audit- Password Hashing: bcryptjs with salt rounds
- JWT Authentication: Secure token-based authentication
- Input Validation: Server-side validation with express-validator
- Rate Limiting: API rate limiting to prevent abuse
- CORS Protection: Configured cross-origin resource sharing
- Security Headers: Helmet.js for security headers
- Environment Variables: Sensitive data stored in environment variables
- β User authentication system (Register, Login, Logout)
- β Email verification system
- β Password reset functionality
- β Modern UI with React 19
- β Modal and toast notification system
- β Responsive design
- β
User profile management
- β Profile information editing
- β Avatar upload
- β Password change
- β Address management (6 types)
- β City autocomplete
- β Newsletter subscription system
- β URL-based navigation with persistent states
- β Type-safe API responses
- β Production-optimized builds
- β Zero security vulnerabilities
- π Product catalog and management
- π Shopping cart functionality
- π Order processing system
- π Payment gateway integration
- π Payment integration (Stripe/PayPal)
- π Email notifications
- π Admin dashboard
- π Product reviews and ratings
- π Wishlist functionality
- π Search and filtering
- π Mobile app (React Native)
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Commit your changes
git commit -m 'feat: add amazing feature' - Push to your branch
git push origin feature/amazing-feature
- Open a Pull Request
- Use TypeScript for type safety
- Follow ESLint configuration
- Write descriptive commit messages
- Add comments for complex logic
- Ensure responsive design for UI changes
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Email: marmiksoni777@gmail.com
- React Team for the amazing React 19 features
- Tailwind CSS for the utility-first CSS framework
- Vite for the lightning-fast build tool
- MongoDB for the flexible database solution
- All Contributors who help make this project better
Built with β€οΈ by the ShopCo Team
β Star this repo β’ π Report Bug β’ β¨ Request Feature
Happy Shopping! πβ¨