A modern full-stack e-commerce web application template for electronics stores - featuring product catalog, shopping cart, user authentication, order management, and repair services.
β οΈ Note: This is a demonstration/portfolio project and is not intended for production use at this time.
This is a production-ready, complete full-stack e-commerce application with:
| Layer | Technology | Status |
|---|---|---|
| π¨ Frontend | React 19 + Vite | β Complete |
| βοΈ Backend | FastAPI (Python) | β Complete |
| ποΈ Database | PostgreSQL (Supabase) | β Complete |
| π Authentication | Supabase Auth | β Complete |
| π‘ API | RESTful API | β Complete |
Once you configure your Supabase credentials and run both frontend & backend:
- Database tables are auto-created in your Supabase project on first run
- Frontend connects to Backend via the configured API URL
- Authentication flows work out of the box with Supabase
- Your e-commerce site is live on localhost!
π‘ No manual database setup required - just add your Supabase credentials and everything connects automatically.
- Overview
- Features
- Tech Stack
- Project Structure
- Getting Started
- Environment Variables
- API Documentation
- Screenshots
- Contributing
- License
This is a full-stack e-commerce platform designed for retail electronics businesses. The application bridges online convenience with offline trust, supporting features like:
- Pay Online: Complete purchases with online payment
- Reserve & Pickup: Reserve items online and pay at the store
- Pre-booking: Advance booking for out-of-stock items
- Repair Services: Submit repair inquiries for fans, motors, and appliances
This system is designed to support the unique requirements of an Indian retail business where customers often prefer to see products in person and negotiate prices.
- π Product Browsing - Browse products by category with search and filters
- π¦ Shopping Cart - Add items, manage quantities, and checkout
- π Authentication - Sign up/login with email or Google (via Supabase)
- π± Responsive Design - Mobile-first design with dedicated mobile navigation
- π οΈ Repair Inquiries - Submit service requests for electrical repairs
- π Pre-booking - Book items in advance for store visits
- π€ User Account - View order history and manage profile
- π Inventory Management - Track stock levels and reservations
- π Order Management - Process and update order statuses
- π·οΈ Category Management - Create and organize product categories
- π₯ Role-based Access - Customer, Staff, and Admin roles
- π Ceiling & Table Fans
- π³ Kitchen Appliances
- π§ Spare Parts & Motors
- β‘ Electrical Accessories
| Technology | Purpose |
|---|---|
| React 19 | UI Framework |
| React Router 7 | Client-side routing |
| Vite 7 | Build tool & dev server |
| Supabase JS | Authentication & real-time |
| Lucide React | Icon library |
| CSS Modules | Component styling |
| Technology | Purpose |
|---|---|
| FastAPI | REST API framework |
| SQLAlchemy 2.0 | Async ORM |
| PostgreSQL | Database (via Supabase) |
| Alembic | Database migrations |
| Pydantic v2 | Data validation |
| Supabase | Auth & database hosting |
| Technology | Purpose |
|---|---|
| Supabase | Backend-as-a-Service |
| PostgreSQL | Relational database |
| Uvicorn | ASGI server |
ecommerce-website/
βββ π backend/ # FastAPI Backend
β βββ π alembic/ # Database migrations
β β βββ versions/ # Migration files
β βββ π app/
β β βββ π api/
β β β βββ deps.py # Dependency injection
β β β βββ middleware.py # Custom middleware
β β β βββ π routes/ # API endpoints
β β β βββ auth.py # Authentication
β β β βββ users.py # User management
β β β βββ products.py # Products & categories
β β β βββ orders.py # Order processing
β β β βββ prebookings.py # Pre-booking system
β β β βββ repairs.py # Repair inquiries
β β βββ π core/
β β β βββ config.py # Settings management
β β β βββ logging.py # Structured logging
β β β βββ security.py # Security utilities
β β βββ π db/
β β β βββ database.py # SQLAlchemy setup
β β β βββ supabase.py # Supabase client
β β βββ π models/ # SQLAlchemy models
β β βββ π schemas/ # Pydantic schemas
β βββ π scripts/ # Utility scripts
β βββ requirements.txt # Python dependencies
β βββ alembic.ini # Alembic configuration
β
βββ π src/ # React Frontend
β βββ π assets/ # Static assets
β β βββ categories/ # Category images
β β βββ products/ # Product images
β βββ π components/
β β βββ π common/ # Reusable components
β β β βββ Badge.jsx
β β β βββ Button.jsx
β β β βββ Input.jsx
β β β βββ ProductCard.jsx
β β βββ π home/ # Homepage sections
β β β βββ HeroSection/
β β β βββ CategoryShowcase/
β β β βββ FeaturedProducts/
β β β βββ WhyChooseUs/
β β β βββ RepairHighlight/
β β β βββ StorePresence/
β β βββ π layout/ # Layout components
β β βββ Header.jsx
β β βββ Footer.jsx
β β βββ MobileNav.jsx
β βββ π context/ # React Context
β β βββ AuthContext.jsx
β β βββ CartContext.jsx
β βββ π hooks/ # Custom hooks
β βββ π pages/ # Page components
β β βββ HomePage.jsx
β β βββ ShopPage.jsx
β β βββ ProductPage.jsx
β β βββ CartPage.jsx
β β βββ RepairPage.jsx
β β βββ SparePartsPage.jsx
β β βββ LoginPage.jsx
β β βββ SignupPage.jsx
β β βββ AccountPage.jsx
β β βββ AboutPage.jsx
β β βββ ContactPage.jsx
β βββ π services/ # API services
β β βββ api.js # Backend API calls
β β βββ supabase.js # Supabase client
β βββ App.jsx # Root component
β βββ main.jsx # Entry point
β βββ index.css # Global styles
β
βββ π public/ # Static public files
βββ index.html # HTML entry point
βββ vite.config.js # Vite configuration
βββ eslint.config.js # ESLint configuration
βββ package.json # Frontend dependencies
βββ README.md # This file
- Node.js 18+ and npm/yarn
- Python 3.11+
- Supabase Account (free tier works)
-
Clone the repository
git clone https://github.com/yourusername/ecommerce-website.git cd ecommerce-website -
Install dependencies
npm install
-
Configure environment variables
# Create .env file in root directory cp .env.example .envAdd your Supabase credentials:
VITE_SUPABASE_URL=your_supabase_project_url VITE_SUPABASE_ANON_KEY=your_supabase_anon_key VITE_API_BASE_URL=http://localhost:8000/api/v1
-
Start development server
npm run dev
The app will be available at
http://localhost:5173
-
Navigate to backend directory
cd backend -
Create virtual environment
python -m venv venv # Windows .\venv\Scripts\activate # macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
# Create .env file in backend directory cp .env.example .envAdd your credentials:
ENVIRONMENT=development DEBUG=True # Supabase SUPABASE_URL=your_supabase_project_url SUPABASE_KEY=your_supabase_anon_key SUPABASE_SERVICE_KEY=your_supabase_service_role_key SUPABASE_JWT_SECRET=your_supabase_jwt_secret # Database DATABASE_URL=postgresql+asyncpg://user:password@host:5432/database # CORS CORS_ORIGINS=http://localhost:5173,http://localhost:3000 # Security SECRET_KEY=your-secret-key-change-in-production
-
Run database migrations
alembic upgrade head
-
Start the backend server
uvicorn app.main:app --reload
The API will be available at
http://localhost:8000- API Documentation:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
- API Documentation:
If you encounter database connection issues, it's likely due to IPv4 vs IPv6 compatibility with Supabase.
Connection refusederrorsTimeoutwhen connecting to database- Backend fails to start with database errors
-
Check your Supabase connection string
- Go to Supabase Dashboard β Settings β Database
- Use the Connection String for your network type
- Some ISPs only support IPv4, others prefer IPv6
-
Force IPv4 in your connection
# Instead of using the hostname, try the direct IPv4 address # Find it in Supabase Dashboard β Settings β Database β Connection Info -
Update your DATABASE_URL
# If using IPv6 causes issues, check "Use connection pooling" in Supabase # and use the pooler connection string instead DATABASE_URL=postgresql+asyncpg://postgres:password@aws-0-region.pooler.supabase.com:5432/postgres
-
Windows Users
- Open Command Prompt as Administrator
- Run:
netsh interface ipv6 show prefixpolicies - If IPv6 is preferred, you may need to adjust or use IPv4 explicitly
-
Test your connection
# Test if you can reach Supabase ping db.your-project-id.supabase.co
π‘ Tip: Supabase's connection pooler (port 6543) often resolves these issues.
| Variable | Description | Required |
|---|---|---|
VITE_SUPABASE_URL |
Supabase project URL | β |
VITE_SUPABASE_ANON_KEY |
Supabase anonymous key | β |
VITE_API_BASE_URL |
Backend API base URL | β |
| Variable | Description | Required |
|---|---|---|
ENVIRONMENT |
development or production |
β |
DEBUG |
Enable debug mode | β |
SUPABASE_URL |
Supabase project URL | β |
SUPABASE_KEY |
Supabase anonymous key | β |
SUPABASE_SERVICE_KEY |
Supabase service role key | β |
SUPABASE_JWT_SECRET |
Supabase JWT secret | β |
DATABASE_URL |
PostgreSQL connection string | β |
CORS_ORIGINS |
Allowed origins (comma-separated) | β |
SECRET_KEY |
Application secret key | β |
When running in development mode, API documentation is available at:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
| Method | Endpoint | Description |
|---|---|---|
| Authentication | ||
| POST | /api/v1/auth/register |
Register new user |
| POST | /api/v1/auth/login |
Login with email/password |
| POST | /api/v1/auth/google |
Login with Google |
| POST | /api/v1/auth/logout |
Logout user |
| Users | ||
| GET | /api/v1/users/me |
Get current user profile |
| PUT | /api/v1/users/me |
Update user profile |
| Products | ||
| GET | /api/v1/products |
List products (with filters) |
| GET | /api/v1/products/{id} |
Get product details |
| GET | /api/v1/products/categories |
List categories |
| Orders | ||
| POST | /api/v1/orders |
Create new order |
| GET | /api/v1/orders |
List user orders |
| GET | /api/v1/orders/{id} |
Get order details |
| Pre-bookings | ||
| POST | /api/v1/prebookings |
Create pre-booking |
| GET | /api/v1/prebookings |
List user pre-bookings |
| Repairs | ||
| POST | /api/v1/repairs |
Submit repair inquiry |
| GET | /api/v1/repairs |
List repair requests |
Screenshots coming soon...
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your 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 with Attribution Requirement.
You are free to use this code as a starting point for your own e-commerce website, but you must give credit to this repository. This can be done by:
- Adding a credit line in your website footer
- Mentioning the original repo in your About/Credits page
- Referencing this repo in your project's README
You cannot claim this code as entirely your own original work.
See the LICENSE file for full details.
E-Commerce Website Contributors
- Website: [Coming Soon]
- Email: [Contact Email]
Made with β€οΈ in India