Logo Lanfrica

jEmeralds/emsec-payment-system

Domaine:

mobilitydigital infrastructure

Type de record:

software
Créateur:
jEm
Hôte:
GPS-enabled QR payment system for Kenya's transport sector # EmSec Backend API Complete Node.js + Express backend for the EmSec QR Payment System with GPS-based fraud prevention. ## Features ✅ **Authentication System** - User registration with validation - JWT-based authentication - Refresh token support - Secure password hashing (bcrypt) ✅ **GPS Fraud Prevention** - Automatic origin detection using matatu GPS - Haversine distance calculations - Confidence scoring - Fraud alert system ✅ **Payment Processing** - Idempotency support (prevent duplicate charges) - Real-time balance updates - Commission calculations - Transaction audit trail ✅ **Security** - Helmet.js security headers - Rate limiting (100 req/min) - Input validation - CORS protection ## Tech Stack - **Node.js** v18+ - **Express.js** - Web framework - **Supabase** - PostgreSQL database - **JWT** - Authentication - **bcrypt** - Password hashing ## Project Structure ``` emsec-backend/ ├── src/ │ ├── config/ │ │ └── supabase.js # Database connection │ ├── controllers/ │ │ ├── authController.js # Register, login, logout │ │ └── paymentController.js # QR scan, payment processing │ ├── middleware/ │ │ ├── auth.js # JWT authentication │ │ └── validation.js # Input validation │ ├── routes/ │ │ ├── auth.js # Auth endpoints │ │ └── payment.js # Payment endpoints │ ├── utils/ │ │ ├── gps.js # GPS distance calculations │ │ └── response.js # Standard API responses │ └── server.js # Main application entry ├── package.json ├── .env.example └── README.md ``` ## Installation ### Prerequisites - Node.js v18 or higher - npm or yarn - Supabase account with EmSec database ### Step 1: Install Dependencies ```bash cd emsec-backend npm install ``` ### Step 2: Configure Environment Copy `.env.example` to `.env`: ```bash cp .env.example .env ``` Edit `.env` and fill in your values: ```env # Server PORT=3000 NODE_ENV=devel …