data-hub

Prosperous Data Hub

Production-ready fintech platform for Ghana internet data bundles (VTU), featuring secure authentication, wallet management, Mobile Money integration, and admin controls.

Tech Stack

Component Technology
Frontend Next.js 16.2.x + React 19 + Tailwind CSS
Backend Node.js + Express (modular architecture)
Database PostgreSQL with connection pooling
Authentication JWT + bcrypt
Payments Hubtel, Paystack, ExpressPay (pluggable)
Hosting Render (recommended), PM2 + Nginx, or Docker

โœจ Core Features

๐Ÿ“ Project Structure

backend/src/           # Express backend
  โ”œโ”€โ”€ config/          # Environment & config
  โ”œโ”€โ”€ db/              # Database utilities
  โ”œโ”€โ”€ middleware/      # Auth, validation, errors
  โ”œโ”€โ”€ modules/         # Feature modules
  โ”‚   โ”œโ”€โ”€ auth/        # Registration, login, OTP
  โ”‚   โ”œโ”€โ”€ payment/     # Payment processing
  โ”‚   โ”œโ”€โ”€ vtu/         # Data bundle purchases
  โ”‚   โ”œโ”€โ”€ wallet/      # Wallet operations
  โ”‚   โ”œโ”€โ”€ transaction/ # Transaction history
  โ”‚   โ””โ”€โ”€ admin/       # Admin operations
  โ””โ”€โ”€ utils/           # Utility functions

frontend/              # Next.js frontend
  โ”œโ”€โ”€ app/             # Pages & layouts
  โ”œโ”€โ”€ components/      # React components
  โ””โ”€โ”€ lib/             # API & utilities

docs/                  # Documentation
database/              # SQL schema

๐Ÿš€ Getting Started

For Development

# Install and setup
cd backend && npm install && npm run db:setup
cd ../frontend && npm install
cd ..

# Copy environment files
cp backend/.env.example backend/.env
cp frontend/.env.local.example frontend/.env.local

# Start services (in separate terminals)
cd backend && npm run dev    # http://localhost:4000
cd frontend && npm run dev   # http://localhost:3000

โ†’ See DEVELOPMENT_SETUP.md for detailed setup

For Production

Follow the DEPLOYMENT.md guide for step-by-step production deployment.

Before deploying, complete the PRODUCTION_CHECKLIST.md.

๐Ÿ” Security & Fintech Features

๐Ÿ“– Documentation

Document Purpose
DEVELOPMENT_SETUP.md Local development environment setup
DEPLOYMENT.md Production deployment instructions
PRODUCTION_CHECKLIST.md Pre-deployment verification
PRODUCTION_READY.md Production hardening summary
API.md Complete API endpoint reference
HUBTEL_SMS_SETUP.md SMS gateway configuration
SMS_QUICK_START.md SMS setup quick reference

๐Ÿงช Testing

Backend tests:

cd backend
npm test              # Run all tests
npm run test:watch   # Watch mode

Frontend E2E tests:

cd frontend
npm run test:e2e      # Run Playwright tests
npm run test:e2e:ui   # Run with UI

๐Ÿ“ฑ Testing Payment Callbacks

To test payment callback handling:

curl -X POST http://localhost:4000/api/payment/callback \
  -H "Content-Type: application/json" \
  -H "x-callback-token: your_callback_token" \
  -d '{
    "externalReference": "REF-123",
    "status": "SUCCESS",
    "providerReference": "PROV-456"
  }'

โš ๏ธ Known Issues

๐Ÿšข Deployment Options

Traditional: VPS with PM2 + Nginx

Frontend: Vercel

Docker Compose

docker compose up --build

๐Ÿ“‹ Environment Variables

All environment variables are documented in:

โš ๏ธ Never commit .env files - Use .env.example templates only

๐Ÿ”— API Endpoints

See API.md for complete endpoint documentation including:

๐Ÿค Contributing

  1. Read DEVELOPMENT_SETUP.md
  2. Create a feature branch
  3. Write tests for new features
  4. Ensure tests pass: npm test (backend) or npm run test:e2e (frontend)
  5. Submit a pull request

๐Ÿ“ž Support

For deployment or configuration issues, see:

  1. DEPLOYMENT.md - Setup instructions
  2. PRODUCTION_CHECKLIST.md - Verification items
  3. DEVELOPMENT_SETUP.md - Troubleshooting section

๐Ÿ“„ License

[Add your license here]

cd backend npm test


Frontend:

```bash
cd frontend
npx playwright install
npm run test:e2e

Deployment

See: