Skip to content

Commit 80a694c

Browse files
authored
Merge pull request #1 from willynikes2/codex/provide-scaffolding-for-crypto-payment-gateway-project
2 parents cebcbca + c2d3814 commit 80a694c

60 files changed

Lines changed: 740 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Database
2+
POSTGRES_USER=gateway
3+
POSTGRES_PASSWORD=gateway
4+
POSTGRES_DB=gateway
5+
6+
# RPC endpoints
7+
ETHEREUM_RPC_WS=
8+
SOLANA_RPC=
9+
BTC_RPC=
10+
FTM_RPC=
11+
BSC_RPC=
12+
13+
# API Keys
14+
DEX_AGGREGATOR_KEY=
15+
KYC_PROVIDER_KEY=
16+
WEBHOOK_SECRET=

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
service: [ingestion, swap-engine, wallet-manager, settlement, compliance, monitoring]
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Setup Node
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: '18'
20+
- name: Install dependencies
21+
run: |
22+
cd services/${{ matrix.service }}
23+
npm install
24+
- name: Run tests
25+
run: |
26+
cd services/${{ matrix.service }}
27+
npm test --if-present

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
dist/
3+
.env

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Multi-Chain Crypto Payment Gateway Scaffold
2+
3+
This repository contains a minimal scaffold for a multi-service crypto payment gateway.
4+
5+
## Services
6+
7+
- **ingestion** – Generates invoices and QR codes, listens for chain payments.
8+
- **swap-engine** – Calls DEX aggregators (1inch, LI.FI, OpenOcean, ParaSwap) for quotes/swaps.
9+
- **wallet-manager** – Manages MPC key shares for custodial wallets.
10+
- **settlement** – Handles USDC balances and withdrawals to exchanges.
11+
- **compliance** – Merchant onboarding with KYC checks.
12+
- **monitoring** – Emits webhooks for payment and swap events.
13+
14+
## Getting Started
15+
16+
1. Install dependencies in each service directory.
17+
2. Copy `.env.example` to `.env` and fill in required variables.
18+
3. Run `docker-compose up --build` to start all services and databases.
19+
20+
## TODO
21+
22+
- Implement API documentation.
23+
- Complete compliance rules and Travel Rule logic.
24+
- Add environment variables for RPC URLs, API keys, and database credentials.
25+
- Flesh out blockchain listeners and swap execution logic.
26+
- Configure CI pipeline and tests.

docker-compose.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: '3.8'
2+
services:
3+
postgres:
4+
image: postgres:14
5+
restart: always
6+
environment:
7+
POSTGRES_USER: gateway
8+
POSTGRES_PASSWORD: gateway
9+
POSTGRES_DB: gateway
10+
ports:
11+
- "5432:5432"
12+
13+
mongo:
14+
image: mongo:5
15+
restart: always
16+
ports:
17+
- "27017:27017"
18+
19+
ingestion:
20+
build: ./services/ingestion
21+
depends_on:
22+
- postgres
23+
environment:
24+
- DATABASE_URL=postgresql://gateway:gateway@postgres:5432/gateway
25+
ports:
26+
- "3001:3000"
27+
28+
swap-engine:
29+
build: ./services/swap-engine
30+
depends_on:
31+
- postgres
32+
ports:
33+
- "3002:3000"
34+
35+
wallet-manager:
36+
build: ./services/wallet-manager
37+
depends_on:
38+
- postgres
39+
ports:
40+
- "3003:3000"
41+
42+
settlement:
43+
build: ./services/settlement
44+
depends_on:
45+
- postgres
46+
ports:
47+
- "3004:3000"
48+
49+
compliance:
50+
build: ./services/compliance
51+
depends_on:
52+
- postgres
53+
ports:
54+
- "3005:3000"
55+
56+
monitoring:
57+
build: ./services/monitoring
58+
depends_on:
59+
- postgres
60+
ports:
61+
- "3006:3000"
62+

docs/architecture.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Architecture Overview
2+
3+
This document outlines the microservice layout and key components for the payment gateway.
4+
5+
TODO: expand with sequence diagrams, database schemas, and API contracts.

scripts/start.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
docker-compose up --build

services/compliance/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:18-alpine
2+
WORKDIR /app
3+
COPY package.json tsconfig.json ./
4+
RUN npm install
5+
COPY src ./src
6+
RUN npm run build
7+
CMD ["node", "dist/main.js"]

services/compliance/package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "compliance",
3+
"version": "0.1.0",
4+
"main": "dist/main.js",
5+
"scripts": {
6+
"start": "nest start",
7+
"build": "nest build",
8+
"test": "jest"
9+
},
10+
"dependencies": {
11+
"@nestjs/common": "^9.0.0",
12+
"@nestjs/core": "^9.0.0",
13+
"@nestjs/platform-express": "^9.0.0",
14+
"reflect-metadata": "^0.1.13",
15+
"rxjs": "^7.5.0",
16+
"uuid": "^9.0.0"
17+
},
18+
"devDependencies": {
19+
"@nestjs/cli": "^9.0.0",
20+
"@types/node": "^18",
21+
"ts-node": "^10.0.0",
22+
"typescript": "^4.8.0",
23+
"jest": "^29.0.0",
24+
"ts-jest": "^29.0.0"
25+
}
26+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Module } from '@nestjs/common';
2+
import { ComplianceService } from './compliance.service';
3+
import { OnboardingController } from './onboarding.controller';
4+
5+
@Module({
6+
controllers: [OnboardingController],
7+
providers: [ComplianceService],
8+
})
9+
export class AppModule {}

0 commit comments

Comments
 (0)