# Qtro WiFi - Voucher Management System
A complete voucher management and selling system for MikroTik and TP-Link routers with M-Pesa payment integration.
## Features
- 🔐 **User Authentication** - Secure login and signup with Supabase Auth
- 📊 **Dashboard** - Real-time statistics and analytics
- 🎫 **Voucher Management** - Upload, manage, and track WiFi vouchers
- 💰 **M-Pesa Integration** - STK Push payment processing
- 🌐 **Public Portal** - Shareable portal for customers to buy vouchers
- 📦 **Plan Management** - Create and manage daily, weekly, and monthly plans
- 💳 **Transaction Tracking** - Complete payment and sales history
- 📱 **Mobile Responsive** - Works perfectly on all devices
## Tech Stack
- **Frontend**: Next.js 14, React, TypeScript, Tailwind CSS
- **Backend**: Next.js API Routes, Supabase
- **Database**: PostgreSQL (via Supabase)
- **Authentication**: Supabase Auth
- **Payment**: M-Pesa Daraja API
- **Deployment**: Vercel (recommended)
## Prerequisites
- Node.js 18+ installed
- Supabase account
- M-Pesa Daraja API credentials (sandbox or production)
## Setup Instructions
### 1. Install Dependencies
```bash
npm install
```
### 2. Set Up Supabase
1. Create a new project at supabase.com
2. Go to Project Settings > API to get your credentials
3. Go to SQL Editor and run the SQL from `supabase-schema.sql`
### 3. Configure Environment Variables
Copy `.env.example` to `.env.local` and fill in your credentials. Every variable is
documented in that file — it is the single reference for what the app needs.
```bash
cp .env.example .env.local
```
Nothing is hardcoded in the source. `.env.local` is git-ignored; `.env.example`
contains placeholders only and is the only env file that should ever be committed.
**You do not set callback or webhook URLs.** They are derived from one base URL in
`lib/config.ts` — see Changing your domain.
### 4. Get M-Pesa Credentials
#### For Testing (Sandbox):
1. Go to Safaricom Developer Portal
2. Create an account and …