A modern and complete e-commerce application built with Next.js, TypeScript, and MongoDB. Teslo Shop offers a seamless shopping experience with secure authentication, cart management, and order processing.
- 🔐 Complete Authentication - Login/register with credentials and OAuth (GitHub)
- 🛒 Shopping Cart - Smart product and quantity management
- 📱 Responsive Design - Optimized for mobile and desktop devices
- 🏷️ Categorization - Products organized by gender (Men, Women, Kids)
- 🔍 Advanced Search - Find products by name, description, or tags
- 📦 Order Management - Complete purchase history and payment status
- 🎨 Modern UI - Elegant interface with Material-UI
- ⚡ SSR/SSG Optimization - Superior performance with Next.js
- Frontend: Next.js 12, React 18, TypeScript
- UI/UX: Material-UI (MUI), CSS Modules
- Backend: Next.js API Routes, NextAuth.js
- Database: MongoDB with Mongoose
- Authentication: JWT, NextAuth.js with multiple providers
- State Management: Context API with useReducer
- Validation: React Hook Form
- Deployment: Optimized for Vercel
- Node.js 16+
- Docker (for local MongoDB)
- Yarn or npm
git clone <repository-url>
cd teslo-shopyarn install
# or
npm installCopy the template file and configure the variables:
cp .env.template .envEdit the .env file with your values:
MONGO_URL=mongodb://localhost:27017/teslodb
NEXT_PUBLIC_TAX_RATE=0.15
JWT_SECRET_SEED=your-super-secure-jwt-secret
NEXTAUTH_SECRET=your-nextauth-secret
# OAuth Providers
GITHUB_ID=your-github-client-id
GITHUB_SECRET=your-github-client-secretdocker-compose up -dyarn dev
# Then visit: http://localhost:3000/api/seedyarn devThe application will be available at http://localhost:3000
teslo-shop/
├── 📁 components/ # Reusable components
│ ├── 🛒 cart/ # Cart components
│ ├── 🏗️ layouts/ # Page layouts
│ ├── 📦 products/ # Product components
│ └── 🎨 ui/ # UI components
├── 📁 context/ # React contexts (Auth, Cart, UI)
├── 📁 database/ # DB configuration and helpers
├── 📁 hooks/ # Custom hooks
├── 📁 interfaces/ # TypeScript definitions
├── 📁 models/ # Mongoose models
├── 📁 pages/ # Next.js pages and API routes
├── 📁 public/ # Static files
├── 📁 styles/ # Global styles
├── 📁 themes/ # MUI theme configuration
└── 📁 utils/ # Utility functions
yarn dev # Local development
yarn build # Production build
yarn start # Production server
yarn lint # ESLint linting- Registration and login with credentials
- GitHub OAuth integration
- Route protection with middleware
- Session management with NextAuth.js
- Complete catalog with category filters
- Real-time search
- Inventory and size management
- Optimized images with slideshow
- Persistent cart with cookies
- Automatic tax calculation
- Complete checkout process
- Order history
- Secure JWT authentication
- Client and server data validation
- Integrated CSRF protection
- Input sanitization
- Server-Side Rendering (SSR)
- Static Site Generation (SSG)
- Image lazy loading
- Automatic bundle optimization
Contributions are welcome. Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Developed with ❤️ using Next.js and TypeScript