A modern, full-featured e-commerce platform built with Next.js 14, FastAPI, and PostgreSQL. Features a beautiful UI with dark mode support, comprehensive product management, secure payments, and vendor capabilities.
- Product Browsing: Advanced filtering, search, and sorting
- Shopping Cart: Real-time cart updates with quantity management
- Secure Checkout: Stripe payment integration
- Order Tracking: Detailed order history and status updates
- User Profiles: Complete profile management and preferences
- Wishlist: Save favorite products for later
- Responsive Design: Works perfectly on all devices
- Vendor Dashboard: Comprehensive analytics and insights
- Product Management: Add, edit, and manage inventory
- Order Management: Track and fulfill customer orders
- Sales Analytics: Revenue tracking and performance metrics
- Inventory Control: Stock management and low-stock alerts
- Dark/Light Mode: Complete theme support
- Modern Design: Glass morphism and gradient effects
- Animations: Smooth transitions and loading states
- Accessibility: Screen reader friendly and keyboard navigation
- Mobile First: Responsive design for all screen sizes
- JWT Authentication: Secure user sessions
- Password Hashing: bcrypt encryption
- CORS Protection: Secure API endpoints
- Input Validation: Comprehensive data validation
- Error Handling: Graceful error management
- Loading States: Optimized user experience
- Next.js 14 - React framework with App Router
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first styling
- Shadcn/ui - Beautiful component library
- Lucide Icons - Modern icon set
- React Context - State management
- FastAPI - High-performance Python web framework
- PostgreSQL - Reliable relational database
- JWT - Secure authentication
- Stripe - Payment processing
- Asyncpg - Async PostgreSQL driver
- ESLint - Code linting
- Prettier - Code formatting
- TypeScript - Static type checking
Before running this application, make sure you have:
- Node.js 18+ installed
- Python 3.9+ installed
- PostgreSQL database
- Stripe account for payments
git clone https://github.com/ansh7432/Kommercio.git
cd ecommerce-fullstack# Install dependencies
npm install
# Create environment file
cp .env.example .env.local# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Create environment file
cp .env.example .env-- Create PostgreSQL database
CREATE DATABASE ecommerce_db;
-- The application will automatically create tables on first runNEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_key# Database
DATABASE_URL=postgresql://username:password@localhost:5432/ecommerce_db
# JWT
SECRET_KEY=your-super-secret-jwt-key
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Stripe
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_secret
# CORS
ALLOWED_ORIGINS=["http://localhost:3000", "https://yourdomain.com"]cd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000# In a new terminal
npm run devVisit:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
# Build the application
npm run build
# Deploy to Vercel
vercel --prod# The application is ready for deployment with:
# - vercel.json for Vercel
# - requirements.txt for Python dependencies
# - Automatic table creationecommerce-fullstack/
βββ app/ # Next.js app directory
β βββ api/ # API route handlers
β βββ auth/ # Authentication pages
β βββ cart/ # Shopping cart
β βββ orders/ # Order management
β βββ products/ # Product pages
β βββ profile/ # User profiles
β βββ vendor/ # Vendor dashboard
β βββ payment/ # Payment pages
β βββ globals.css # Global styles
β βββ layout.tsx # Root layout
β βββ page.tsx # Homepage
βββ components/ # Reusable components
β βββ ui/ # Shadcn/ui components
β βββ navbar.tsx # Navigation
β βββ theme-provider.tsx # Theme management
βββ contexts/ # React contexts
β βββ auth-context.tsx # Authentication
β βββ cart-context.tsx # Shopping cart
βββ backend/ # FastAPI backend
β βββ main.py # Main application
β βββ requirements.txt # Python dependencies
β βββ vercel.json # Deployment config
βββ public/ # Static assets
βββ README.md # Documentation
POST /auth/signup- Create new accountPOST /auth/login- User loginGET /auth/me- Get current userPUT /auth/profile- Update profilePUT /auth/password- Change password
GET /products- List products with filtersGET /products/{id}- Get product detailsPOST /products- Create product (vendor)PUT /products/{id}- Update product (vendor)DELETE /products/{id}- Delete product (vendor)
GET /cart- Get user's cartPOST /cart/items- Add item to cartPUT /cart/items/{id}- Update cart itemDELETE /cart/items/{id}- Remove from cart
GET /orders- List user ordersGET /orders/{id}- Get order detailsPOST /orders- Create new orderPUT /orders/{id}/cancel- Cancel order
POST /create-payment-intent- Create Stripe paymentPOST /confirm-payment- Confirm payment
The application uses a comprehensive design system with:
- Theme Support: Light/dark mode with system preference detection
- Responsive Design: Mobile-first approach with Tailwind CSS
- Glass Morphism: Modern UI effects with backdrop blur
- Animations: Smooth transitions and loading states
- Accessibility: ARIA labels and keyboard navigation
/* Primary Colors */
--purple-600: #9333ea
--pink-600: #db2777
--orange-500: #f97316
/* Neutral Colors */
--gray-50: #f9fafb
--gray-900: #111827// In your products page component
const CATEGORIES = [
{ value: "electronics", label: "Electronics" },
{ value: "clothing", label: "Clothing" },
{ value: "books", label: "Books" },
// Add your new category here
{ value: "sports", label: "Sports & Outdoors" }
]/* In globals.css */
:root {
--primary: your-color-hsl;
--secondary: your-color-hsl;
}-
Cart not loading after login
- Check if the API URL is correct in environment variables
- Verify JWT token is being sent with requests
-
Database connection errors
- Ensure PostgreSQL is running
- Check database credentials in .env file
-
Stripe payments failing
- Verify Stripe keys are correct
- Check webhook endpoint configuration
-
Build errors
- Clear node_modules and reinstall dependencies
- Check TypeScript errors in terminal
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow TypeScript best practices
- Use conventional commit messages
- Add tests for new features
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
- Shadcn/ui for the beautiful component library
- Vercel for seamless deployment
- Stripe for secure payment processing
- FastAPI for the excellent Python framework
- Next.js team for the amazing React framework
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed description
- Contact: support@kommercio.com
