11# BridgeShield — AML Gateway for LI.FI Cross-Chain Trades
22
3+ [ ![ GitHub license] ( https://img.shields.io/badge/license-MIT-blue.svg )] ( https://github.com/easyshellworld/bridgeshield/blob/main/LICENSE )
4+ [ ![ PRs Welcome] ( https://img.shields.io/badge/PRs-welcome-brightgreen.svg )] ( https://github.com/easyshellworld/bridgeshield/pulls )
5+ [ ![ GitHub Repo stars] ( https://img.shields.io/github/stars/easyshellworld/bridgeshield?style=social )] ( https://github.com/easyshellworld/bridgeshield/stargazers )
6+ [ ![ Open Issues] ( https://img.shields.io/github/issues/easyshellworld/bridgeshield )] ( https://github.com/easyshellworld/bridgeshield/issues )
7+ [ ![ GitHub closed pull requests] ( https://img.shields.io/github/issues-pr-closed/easyshellworld/bridgeshield )] ( https://github.com/easyshellworld/bridgeshield/pulls?q=is%3Apr+is%3Aclosed )
8+ [ ![ Last Commit] ( https://img.shields.io/github/last-commit/easyshellworld/bridgeshield )] ( https://github.com/easyshellworld/bridgeshield/commits/main )
9+
10+ [ ![ Node.js] ( https://img.shields.io/badge/Node.js-20+-339933?logo=node.js )] ( https://nodejs.org/ )
11+ [ ![ TypeScript] ( https://img.shields.io/badge/TypeScript-5.0+-3178C6?logo=typescript )] ( https://www.typescriptlang.org/ )
12+ [ ![ Express] ( https://img.shields.io/badge/Express-4.x-000000?logo=express )] ( https://expressjs.com/ )
13+ [ ![ React] ( https://img.shields.io/badge/React-18-61DAFB?logo=react )] ( https://react.dev/ )
14+ [ ![ Tailwind CSS] ( https://img.shields.io/badge/Tailwind_CSS-3.0+-06B6D4?logo=tailwindcss )] ( https://tailwindcss.com/ )
15+ [ ![ Prisma] ( https://img.shields.io/badge/Prisma-5.x-5A67D8?logo=prisma )] ( https://prisma.io/ )
16+ [ ![ Vitest] ( https://img.shields.io/badge/Vitest-1.x-6B9DF8?logo=vitest )] ( https://vitest.io/ )
17+
18+ [ ![ CI/CD] ( https://img.shields.io/badge/CI%2FCD-GitHub%20Actions-2088FF?logo=githubactions )] ( https://github.com/easyshellworld/bridgeshield/actions )
19+ [ ![ Tests] ( https://img.shields.io/badge/tests-88%20%2B%2021-brightgreen )] ( https://github.com/easyshellworld/bridgeshield/actions )
20+ [ ![ Docker Ready] ( https://img.shields.io/badge/Docker-Ready-2496ED?logo=docker )] ( https://www.docker.com/ )
21+
322BridgeShield is an Anti-Money Laundering (AML) compliance gateway designed specifically for cross-chain trading platforms like LI.FI. It provides real-time risk assessment, transaction monitoring, and regulatory compliance for decentralized finance (DeFi) transactions.
423
524## 🏗️ Architecture
625
726```
8- ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
9- │ │ │ │ │ │
10- │ Frontend Demo │ │ Backend API │ │ Frontend Admin │
11- │ (Port: 5173) │◄───┤ (Port: 3000) │───►│ (Port: 5174) │
12- │ │ │ │ │ │
13- └─────────────────┘ └─────────────────┘ └─────────────────┘
14- │ │ │
15- │ │ │
16- ▼ ▼ ▼
17- ┌─────────────────────────────────────────────────────────────┐
18- │ │
19- │ Docker Compose │
20- │ │
21- └─────────────────────────────────────────────────────────────┘
27+ ┌─────────────────────────────────────────────────────────────────────────┐
28+ │ │
29+ │ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
30+ │ │ │ │ │ │ │ │
31+ │ │ Frontend Demo │ │ Backend API │ │ Frontend Admin │ │
32+ │ │ (Port: 5173) │◄───┤ (Port: 3000) │───►│ (Port: 5174) │ │
33+ │ │ │ │ │ │ │ │
34+ │ └─────────────────┘ └─────────────────┘ └─────────────────┘ │
35+ │ │ │
36+ │ ▼ │
37+ │ ┌─────────────────┐ │
38+ │ │ SDK Package │ │
39+ │ │ @bridgeshield/ │ │
40+ │ │ sdk │ │
41+ │ └─────────────────┘ │
42+ │ │
43+ └─────────────────────────────────────────────────────────────────────────┘
2244```
2345
2446## 🚀 Quick Start
@@ -27,7 +49,7 @@ BridgeShield is an Anti-Money Laundering (AML) compliance gateway designed speci
2749
28501 . ** Clone the repository:**
2951 ``` bash
30- git clone < repository-url >
52+ git clone https://github.com/easyshellworld/bridgeshield
3153 cd bridgeshield
3254 ```
3355
@@ -55,23 +77,56 @@ For hot-reload during development:
5577docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
5678```
5779
80+ ## 📦 SDK Package
81+
82+ For easy integration into your own applications:
83+
84+ ``` bash
85+ npm install @bridgeshield/sdk
86+ ```
87+
88+ ``` typescript
89+ import { BridgeShieldClient } from ' @bridgeshield/sdk' ;
90+
91+ const client = new BridgeShieldClient ({
92+ baseUrl: ' https://api.bridgeshield.io' ,
93+ });
94+
95+ const result = await client .checkAddress ({
96+ address: ' 0x1234567890abcdef1234567890abcdef12345678' ,
97+ chainId: 1 ,
98+ });
99+
100+ console .log (result .riskLevel ); // 'LOW' | 'MEDIUM' | 'HIGH'
101+ console .log (result .decision ); // 'ALLOW' | 'REVIEW' | 'BLOCK'
102+ ```
103+
104+ See [ packages/sdk/README.md] ( packages/sdk/README.md ) for full documentation.
105+
58106## 📁 Project Structure
59107
60108```
61109bridgeshield/
62110├── backend/ # Node.js/TypeScript backend API
63111│ ├── src/ # Source code
64112│ ├── prisma/ # Database schema and migrations
65- │ ├── Dockerfile # Production Dockerfile
113+ │ ├── tests/ # Unit and integration tests
114+ │ ├── Dockerfile # Production Dockerfile
66115│ └── package.json
67116├── frontend-demo/ # Demo interface for users
68- │ ├── src/ # Vue.js /TypeScript source
69- │ ├── Dockerfile # Production Dockerfile
117+ │ ├── src/ # React /TypeScript source
118+ │ ├── Dockerfile # Production Dockerfile
70119│ └── package.json
71120├── frontend-admin/ # Admin dashboard
72- │ ├── src/ # Vue.js /TypeScript source
73- │ ├── Dockerfile # Production Dockerfile
121+ │ ├── src/ # React /TypeScript source
122+ │ ├── Dockerfile # Production Dockerfile
74123│ └── package.json
124+ ├── packages/
125+ │ └── sdk/ # @bridgeshield/sdk npm package
126+ │ ├── src/ # TypeScript source
127+ │ ├── __tests__/ # Unit tests
128+ │ ├── README.md # SDK documentation
129+ │ └── package.json
75130├── docker-compose.yml # Production services
76131├── docker-compose.dev.yml # Development overrides
77132└── README.md # This file
@@ -142,63 +197,93 @@ bridgeshield/
142197 npm run dev
143198 ```
144199
200+ ### SDK Development
201+
202+ 1 . ** Navigate to SDK directory:**
203+ ``` bash
204+ cd packages/sdk
205+ ```
206+
207+ 2 . ** Install dependencies:**
208+ ``` bash
209+ npm install
210+ ```
211+
212+ 3 . ** Build:**
213+ ``` bash
214+ npm run build
215+ ```
216+
217+ 4 . ** Run tests:**
218+ ``` bash
219+ npm test
220+ ```
221+
145222## 🌐 API Endpoints
146223
147- ### Core API (Port 3000)
224+ ### Core AML API (Port 3000)
148225
149226| Method | Endpoint | Description |
150227| --------| ----------| -------------|
151- | GET | ` /api/v1/health ` | Health check |
152- | GET | ` /api/v1/docs ` | OpenAPI documentation |
153- | POST | ` /api/v1/transactions/analyze ` | Analyze transaction for AML risks |
154- | GET | ` /api/v1/transactions/:id ` | Get transaction details |
155- | GET | ` /api/v1/transactions ` | List transactions with filtering |
156- | POST | ` /api/v1/addresses/check ` | Check wallet address against risk databases |
157- | GET | ` /api/v1/addresses/:address ` | Get address risk profile |
158- | GET | ` /api/v1/compliance/rules ` | List active compliance rules |
159- | POST | ` /api/v1/compliance/rules ` | Create new compliance rule |
160- | GET | ` /api/v1/reports/risk-summary ` | Generate risk summary report |
161-
162- ### WebSocket Endpoints
163-
164- - ` /ws/transactions ` - Real-time transaction monitoring
165- - ` /ws/alerts ` - Compliance alert notifications
228+ | GET | ` /api/v1/health ` | Health check with service status |
229+ | POST | ` /api/v1/aml/check ` | Check address risk score |
230+ | GET | ` /api/v1/aml/whitelist ` | Get whitelist summary |
231+ | POST | ` /api/v1/aml/appeal ` | Submit appeal for flagged address |
232+ | GET | ` /api/v1/aml/appeal/status/:ticketId ` | Check appeal status |
233+
234+ ### Admin API (Port 3000)
235+
236+ | Method | Endpoint | Description |
237+ | --------| ----------| -------------|
238+ | GET | ` /api/v1/admin/dashboard/stats ` | Dashboard statistics |
239+ | GET | ` /api/v1/admin/dashboard/risk-trend ` | 7-day risk trend |
240+ | GET | ` /api/v1/admin/dashboard/risk-distribution ` | Risk level distribution |
241+ | GET | ` /api/v1/admin/appeals ` | List all appeals |
242+ | POST | ` /api/v1/admin/appeal/:id/approve ` | Approve appeal |
243+ | POST | ` /api/v1/admin/appeal/:id/reject ` | Reject appeal |
244+ | GET | ` /api/v1/admin/whitelist ` | List whitelist entries |
245+ | POST | ` /api/v1/admin/whitelist ` | Add to whitelist |
246+ | DELETE | ` /api/v1/admin/whitelist/:id ` | Remove from whitelist |
247+ | GET | ` /api/v1/admin/logs ` | View check logs |
166248
167249## 🛡️ Features
168250
169251### Risk Assessment
170252- ** Wallet Screening:** Check addresses against OFAC, UN, EU sanctions lists
171- - ** Transaction Pattern Analysis :** Detect suspicious transaction patterns
172- - ** Cross-chain Tracking :** Monitor fund flows across multiple blockchains
173- - ** Risk Scoring :** Assign risk scores based on multiple factors
253+ - ** Real-time Scoring :** Risk score 0-100 with HIGH/MEDIUM/LOW classification
254+ - ** Risk Factors :** Detailed breakdown of risk indicators
255+ - ** Caching :** Multi-tier in-memory caching with TTL
174256
175257### Compliance Tools
176- - ** Custom Rules Engine :** Define custom compliance rules
177- - ** Audit Trail :** Comprehensive logging of all compliance decisions
178- - ** Report Generation :** Generate regulatory compliance reports
179- - ** Alert System :** Real-time alerts for high-risk transactions
258+ - ** Appeal System :** Users can contest flagged addresses
259+ - ** Whitelist Management :** Admin can manage permanent whitelists
260+ - ** Audit Trail :** Complete logging of all checks and decisions
261+ - ** Transaction Monitoring :** Track checked transactions
180262
181- ### Integration
182- - ** LI.FI Compatible:** Designed specifically for LI.FI cross-chain transactions
183- - ** REST API:** Full-featured API for integration with other systems
184- - ** WebSocket Support:** Real-time updates and notifications
263+ ### Integration Options
264+ - ** REST API:** Full-featured API for direct integration
265+ - ** @bridgeshield/sdk :** Official JavaScript/TypeScript SDK
266+ - ** Demo Frontend:** Working example with React
267+ - ** Admin Dashboard:** Admin panel for managing whitelist and appeals
185268
186269## 🧪 Testing
187270
188271### Backend Tests
189272``` bash
190273cd backend
191- npm test # Run unit tests
192- npm run test:e2e # Run end-to-end tests
274+ npm test # Run all tests (88 tests)
193275```
194276
195- ### Frontend Tests
277+ ### SDK Tests
196278``` bash
197- cd frontend-demo
198- npm test # Run component tests
279+ cd packages/sdk
280+ npm test # Run SDK tests (21 tests)
281+ ```
199282
200- cd ../frontend-admin
201- npm test # Run component tests
283+ ### Frontend Builds
284+ ``` bash
285+ cd frontend-demo && npm run build
286+ cd frontend-admin && npm run build
202287```
203288
204289## 🐳 Docker Commands
@@ -236,40 +321,33 @@ docker-compose logs -f backend
236321## 🔐 Security
237322
238323### Environment Variables
239- - ` DATABASE_URL ` : PostgreSQL connection string
240- - ` JWT_SECRET ` : Secret for JWT token generation
241- - ` SANCTIONS_API_KEY ` : API key for sanctions list checking
324+ - ` DATABASE_URL ` : SQLite/PostgreSQL connection string
242325- ` LOG_LEVEL ` : Logging level (debug, info, warn, error)
243326
244- ### Security Best Practices
245- - All API endpoints require authentication
246- - Sensitive data is encrypted at rest
247- - Regular security audits and dependency updates
327+ ### Security Features
248328- Rate limiting on public endpoints
329+ - Input validation on all endpoints
330+ - Helmet security headers
331+ - CORS configuration
332+ - Parameterized queries (Prisma)
249333
250334## 📊 Tech Stack
251335
252336| Component | Technology |
253337| -----------| ------------|
254338| ** Backend** | Node.js, TypeScript, Express, Prisma |
255- | ** Database** | SQLite (development), PostgreSQL (production) |
256- | ** Frontend** | Vue.js 3, TypeScript, Vite, Tailwind CSS |
339+ | ** Database** | SQLite (dev), PostgreSQL (prod) |
340+ | ** Frontend** | React 18, TypeScript, Vite, Tailwind CSS |
341+ | ** SDK** | TypeScript, tsup (ESM + CJS) |
257342| ** Container** | Docker, Docker Compose |
258- | ** API** | REST, WebSocket, OpenAPI/Swagger |
259- | ** Testing** | Jest, Vitest, Supertest |
343+ | ** Testing** | Vitest, Supertest |
260344| ** Monitoring** | Winston logging, Health checks |
261345
262346## 📈 Monitoring & Logging
263347
264348### Health Checks
265349- Backend: ` GET http://localhost:3000/api/v1/health `
266- - Returns service status and uptime
267-
268- ### Logging Levels
269- - ` DEBUG ` : Detailed debugging information
270- - ` INFO ` : General operational information
271- - ` WARN ` : Warning conditions
272- - ` ERROR ` : Error conditions
350+ - Returns service status, uptime, and dependency health
273351
274352### View Logs
275353``` bash
@@ -280,7 +358,7 @@ docker-compose logs
280358docker-compose logs backend
281359
282360# Follow logs in real-time
283- docker-compose logs -f
361+ docker-compose logs -f backend
284362```
285363
286364## 🔄 Development Workflow
@@ -322,14 +400,10 @@ docker-compose logs --tail=100
322400
323401## 📄 License
324402
325- MIT License - see LICENSE file for details.
403+ MIT License - see [ LICENSE] ( LICENSE ) file for details.
326404
327405## 🙏 Acknowledgments
328406
329407- ** LI.FI** for cross-chain transaction infrastructure
330- - ** Vue.js ** and ** TypeScript** communities
408+ - ** React ** and ** TypeScript** communities
331409- ** Open-source contributors** to all dependencies
332-
333- ---
334-
335- ** BridgeShield** is developed with ❤️ for secure and compliant DeFi transactions.
0 commit comments