A modern, full-featured e-commerce application built with Next.js, Supabase, Better Auth, and Chapa payment integration.
- 🛍️ Product Catalog: Browse products with categories, search, and filtering
- 🔐 Authentication: Secure user authentication with Better Auth
- 🛒 Shopping Cart: Add/remove items, quantity management
- ❤️ Wishlist: Save favorite products
- 💳 Payment Processing: Secure payments with Chapa integration
- 📱 Responsive Design: Mobile-first responsive UI
- 🎨 Modern UI: Built with Tailwind CSS and Radix UI components
- 🔒 Row Level Security: Secure data access with Supabase RLS
- Frontend: Next.js 15, React, TypeScript
- Styling: Tailwind CSS, Radix UI
- Database: Supabase (PostgreSQL)
- Authentication: Better Auth
- Payment: Chapa Payment Gateway
- Icons: Lucide React
Before you begin, ensure you have:
- Node.js 18+ installed
- A Supabase account and project
- A Chapa merchant account (for payment processing)
git clone <your-repo-url>
cd ecommerce-nextjsnpm installCreate a .env.local file in the root directory:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# Better Auth Configuration
BETTER_AUTH_SECRET=your_random_secret_key_here
BETTER_AUTH_URL=http://localhost:3000
# Chapa Payment Configuration
CHAPA_SECRET_KEY=your_chapa_secret_key
CHAPA_PUBLIC_KEY=your_chapa_public_key
NEXT_PUBLIC_CHAPA_PUBLIC_KEY=your_chapa_public_key
# Application Configuration
NEXT_PUBLIC_APP_URL=http://localhost:3000-
Create Supabase Project: Go to Supabase and create a new project
-
Run Migrations: Execute the SQL files in the
supabase/migrations/directory in order:001_initial_schema.sql- Creates all tables and relationships002_rls_policies.sql- Sets up Row Level Security policies003_sample_data.sql- Adds sample data for testing
-
Enable RLS: Make sure Row Level Security is enabled on all tables
The app uses Better Auth which is already configured. The authentication tables will be created automatically when you run the migrations.
- Chapa Account: Sign up for a Chapa merchant account
- Get API Keys: Obtain your secret and public keys from the Chapa dashboard
- Configure Webhooks: Set up webhook URL:
your-domain.com/api/payment/callback
npm run devOpen http://localhost:3000 to see the application.
ecommerce-nextjs/
├── src/
│ ├── app/ # Next.js app router pages
│ │ ├── api/ # API routes
│ │ ├── auth/ # Authentication pages
│ │ └── payment/ # Payment pages
│ ├── components/ # React components
│ │ ├── auth/ # Authentication components
│ │ ├── cart/ # Shopping cart components
│ │ ├── layout/ # Layout components
│ │ ├── product/ # Product components
│ │ └── ui/ # UI components
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility libraries
│ └── types/ # TypeScript type definitions
├── supabase/
│ └── migrations/ # Database migration files
└── public/ # Static assets
- User registration and login
- Email verification
- Protected routes
- Session management
- Hierarchical categories (Main → Sub → End categories)
- Product variants (colors, sizes)
- Inventory management
- Product reviews and ratings
- Add/remove items
- Quantity management
- Persistent cart (saved to database)
- Real-time total calculation
- Chapa payment gateway integration
- Secure payment initialization
- Payment verification
- Order status tracking
- Users and authentication tables
- Product catalog with categories
- Shopping cart and wishlist
- Orders and payment tracking
- Reviews and ratings
POST /api/auth/[...all]- Better Auth endpoints
POST /api/payment/initialize- Initialize paymentPOST /api/payment/callback- Payment webhookGET /api/payment/verify- Verify payment status
- Push your code to GitHub
- Connect your repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy
The app can be deployed to any platform that supports Next.js:
- Netlify
- Railway
- DigitalOcean App Platform
- AWS Amplify
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support, please open an issue in the GitHub repository or contact the development team.