An API-first infrastructure platform that prevents duplicate invoice financing across banks and NBFCs using cryptographic hashing, AI-powered fraud detection, and an immutable cross-lender audit registry.
📖 Full Documentation · 🏗️ Architecture · 📡 API Reference · � SDK Guide
In Indian trade finance, a supplier can present the same invoice to multiple lenders simultaneously to fraudulently obtain multiple loans. NxtGen Hack solves this with a sub-second verification checkpoint that every lender calls before approving financing.
Vendor submits invoice → Lender calls /api/invoices/verify → System responds in < 100ms
│
┌──────────────┼──────────────────┐
▼ ▼ ▼
SHA-256 Hash Redis Duplicate AI Fraud Score
Fingerprint Lock (< 2ms) (IsolationForest)
│ │ │
└──────────────┴───────────────────┘
│
VERIFIED / DUPLICATE_DETECTED
REJECTED_HIGH_RISK
Three services communicate over HTTP:
| Service | Stack | Port |
|---|---|---|
| Frontend | React 19, TypeScript, Vite, TailwindCSS | 5173 |
| Node.js API | Express 4, TypeScript, PostgreSQL, Redis | 5001 |
| AI Service | FastAPI, scikit-learn, Pydantic v2 | 8000 |
→ See architecture.md for the full system diagram and request flows.
The entire NxtGen platform is containerized for sub-second deployment. Ensure you have Docker and Docker Compose installed.
# Clone the repository
git clone https://github.com/ThelastC0debenders/nxtgen-hack.git
cd nxtgen-hack
# Run the automated setup script
chmod +x setup.sh
./setup.shWhat this does:
- Generates
.envfiles with secure defaults. - Boots PostgreSQL, Redis, Node Backend, Python AI, and Frontend.
- Automatically generates the dataset and trains the AI model.
- Initializes the database schema.
Prerequisites: Node 18+, Python 3.10+, PostgreSQL 14+, Redis 7+
# 1. Backend
cd backend && npm install
cp .env.example .env # Fill in DB, Redis, JWT, AI token
npx ts-node init-db.ts # Create tables
npm run dev # http://localhost:5001
# 2. AI Service
cd backend-ai-fastapi && pip install -r requirements.txt
python -m app.training.generate_dataset
python -m app.training.train_model
uvicorn app.main:app --port 8000 --reload
# 3. Frontend
cd frontend/Frontend && npm install && npm run dev # http://localhost:5173The easiest way to integrate NxtGen into your lending or vendor backend is via our API wrappers. We provide comprehensive documentation for both Node.js and Python.
👉 Read the full SDK & Integration Guide
Node.js Example (Axios):
import { NxtGenClient } from './sdk';
const client = new NxtGenClient('https://api.nxtgen.xyz', 'lendor@gmail.com', 'securepass');
async function approveCapital(invoice) {
const result = await client.verifyInvoice({
...invoice,
buyerGSTIN: "33BBBB2222B1Z2"
});
if (result.status === 'VERIFIED') {
console.log('Safe to proceed with loan!');
}
}| Role | Password | |
|---|---|---|
| 🛡️ Admin | admin@gmail.com |
1234567890 |
| 🏦 Lender | lendor@gmail.com |
0987654321 |
| 📦 Vendor | vendor@gmail.com |
1234567890 |
| Feature | How |
|---|---|
| Sub-second verification | Redis SETNX duplicate lock resolves in < 2ms |
| AI fraud scoring | Isolation Forest (60%) + deterministic rule engine (40%) |
| Zero-knowledge registry | Only SHA-256 hashes stored — no raw invoice data shared cross-institution |
| Immutable audit trail | Hash-chained audit_logs table — tamper-proof by design |
| Role-based access | Per-route RBAC middleware for ADMIN, LENDER, VENDOR |
| Graceful degradation | System runs if AI service is unavailable (falls back to score = 0) |
| Lender financing actions | Finance or Reject invoices directly from dashboard |
nxtgen-hack/
├── backend/ Node.js + Express API (TypeScript)
├── backend-ai-fastapi/ Python FastAPI ML service
├── frontend/Frontend/ React SPA (TypeScript + TailwindCSS)
└── docs/ Full documentation
├── index.md Project overview & quick start
├── architecture.md System design & request flows
├── sdk-guide.md Node.js & Python SDK wrappers
└── api-reference.md All endpoints, request/response examples
PENDING_VERIFICATION → VERIFIED → FINANCED
→ REJECTED_HIGH_RISK
→ DUPLICATE_DETECTED
→ REJECTED_BY_LENDER
→ CLOSED
| Doc | Description |
|---|---|
| index.md | Project overview, problem, capabilities, demo creds |
| architecture.md | System diagram, all request flows, repo tree |
| sdk-guide.md | Node.js and Python SDK wrappers & Integration |
| api-reference.md | Every endpoint with examples and error codes |
Backend
- Express 4 · TypeScript 5.7 · jsonwebtoken · pg · redis · axios
AI Service
- FastAPI · Uvicorn · scikit-learn (IsolationForest) · Pydantic v2 · joblib · pandas
Frontend
- React 19 · TypeScript 5.9 · Vite 7 · TailwindCSS 4 · React Router v7 · Recharts · Lucide React
Infrastructure
- PostgreSQL 14 (invoices, audit_logs, users)
- Redis 7 (history cache + distributed locks)
Built with ❤️ by Team ThelastC0debenders