Backend infrastructure for the ImpactFlow Protocol.
This repository provides backend services for:
- Authentication
- Campaign management
- Beneficiary verification
- Notifications
- Analytics
- Off-chain validation
- Wallet authentication via Stellar wallet signature verification
- JWT-based session issuance
- In-memory session handling
- Role-based access control (planned)
- Campaign APIs
- Beneficiary onboarding
- Milestone approval workflow
- Event tracking
- Queue processing
- Node.js
- Express
- TypeScript
- JWT
- Stellar SDK
git clone https://github.com/impactflowlabs/impactflow-api.git
cd impactflow-api
npm install
cp .env.example .env
npm run devDATABASE_URL=
JWT_SECRET=your-super-secret-key
REDIS_URL=
STELLAR_RPC_URL=https://horizon-testnet.stellar.org
CONTRACT_ID=POST /auth/challenge
Request body:
{
"publicKey": "G..."
}Response:
{
"publicKey": "G...",
"challenge": "ImpactFlow wallet authentication ...",
"expiresAt": 1680000000000
}POST /auth/verify
Request body:
{
"publicKey": "G...",
"signature": "Base64SignatureHere"
}Response:
{
"token": "eyJ...",
"expiresIn": 3600,
"publicKey": "G..."
}GET /auth/me
Headers:
Authorization: Bearer <token>Response:
{
"publicKey": "G...",
"authMethod": "wallet"
}POST /auth/logout
Headers:
Authorization: Bearer <token>Response:
{
"status": "logged out"
}src/
├── auth/
│ ├── auth.controller.ts
│ ├── auth.service.ts
│ ├── session.service.ts
│ ├── stellar.utils.ts
│ └── types.ts
├── middleware/
│ └── jwt.middleware.ts
├── app.ts
└── server.tsJWT_SECRETmust be set in.envfor secure token signing.- This implementation uses an in-memory session store; replace with Redis or database storage for production.