A modern sports predictions platform built with Next.js, featuring M-Pesa payment integration for the Kenyan market.
- User Authentication - Secure login/register with NextAuth.js
- VIP Subscriptions - Daily, Weekly, and Monthly plans
- M-Pesa Payments - Seamless STK Push integration
- Admin Dashboard - Manage predictions and users
- Responsive Design - Works on all devices
- Frontend: Next.js 14, React, Tailwind CSS
- Backend: Next.js API Routes
- Database: PostgreSQL (Neon/Supabase)
- ORM: Prisma
- Auth: NextAuth.js
- Payments: M-Pesa Daraja API
- Clone the repository:
git clone https://github.com/ADAMSmugwe/sureodds.git
cd sureodds- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env
# Edit .env with your values- Set up the database:
npx prisma generate
npx prisma db push
npx prisma db seed- Run the development server:
npm run devSee .env.example for all required variables.
DATABASE_URL- PostgreSQL connection stringNEXTAUTH_SECRET- Secret for NextAuth.jsMPESA_*- M-Pesa sandbox credentials
- All development variables
MPESA_ENVIRONMENT="production"- Production M-Pesa credentials
- HTTPS callback URL
- Create account at developer.safaricom.co.ke
- Create a new app and get sandbox credentials
- Use ngrok for local callback testing:
ngrok http 3000
- Update
MPESA_CALLBACK_URLwith ngrok URL
- Apply for M-Pesa Go Live
- Get production credentials
- Set
MPESA_ENVIRONMENT="production" - Use your domain for callback URL
- Push to GitHub
- Import project in Vercel
- Add environment variables
- Deploy!
- Add all variables from
.env.production.example - Use Vercel's environment variable encryption
| Endpoint | Method | Description |
|---|---|---|
/api/auth/* |
- | NextAuth.js routes |
/api/predictions |
GET/POST | Get/Create predictions |
/api/mpesa/stkpush |
POST | Initiate M-Pesa payment |
/api/mpesa/callback |
POST | M-Pesa callback (Safaricom) |
/api/mpesa/status |
GET | Check payment status |
/api/subscription |
GET | Get user subscription |
/api/health |
GET | Health check |
This platform provides sports predictions for informational purposes only. Users must be 18+ and are responsible for their own betting decisions. Gamble responsibly.
MIT License - see LICENSE file for details.
Adams Mugwe - GitHub