forked from Manuel1234477/Stellar-Micro-Donation-API
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathARCHITECTURE_SIMPLE.txt
More file actions
124 lines (107 loc) · 10.7 KB
/
ARCHITECTURE_SIMPLE.txt
File metadata and controls
124 lines (107 loc) · 10.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
╔══════════════════════════════════════════════════════════════════════════════╗
║ STELLAR MICRO-DONATION API - ARCHITECTURE OVERVIEW ║
╚══════════════════════════════════════════════════════════════════════════════╝
┌─────────────────────────────────────────────────────────────────────────────┐
│ CLIENT LAYER │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Web Client │ │ Mobile App │ │ API Client │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ │
└───────────┼────────────────────┼────────────────────┼──────────────────────┘
│ │ │
└────────────────────┼────────────────────┘
│ HTTP/HTTPS
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ API LAYER (Express.js) │
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ Express Router │ │
│ └───┬────────────┬────────────┬────────────┬────────────────────────┘ │
│ │ │ │ │ │
│ ┌───▼───┐ ┌───▼───┐ ┌───▼───┐ ┌───▼───┐ │
│ │/donations│ │/wallets│ │/stream │ │ /stats │ │
│ │ │ │ │ │ │ │ │ │
│ │ Create │ │ Query │ │Schedule│ │Analytics│ │
│ │ Verify │ │ List │ │ Manage │ │Summary │ │
│ └───┬─────┘ └───┬────┘ └───┬────┘ └───┬────┘ │
└──────┼───────────┼───────────┼───────────┼─────────────────────────────────┘
│ │ │ │
│ │ │ │
▼ ▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ SERVICE LAYER │
│ │
│ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────────┐ │
│ │ Stellar Service │ │ Mock Stellar │ │ Recurring Donation │ │
│ │ │ │ Service │ │ Scheduler │ │
│ │ - Submit TX │ │ │ │ │ │
│ │ - Verify TX │ │ - Simulate TX │ │ - Check schedules │ │
│ │ - Query Horizon │ │ - In-memory │ │ - Execute donations │ │
│ └────────┬─────────┘ └────────┬─────────┘ └──────────┬───────────┘ │
└───────────┼─────────────────────┼─────────────────────────┼────────────────┘
│ │ │
│ └─────────┬───────────────┘
│ │
▼ ▼
┌─────────────────────────────┐ ┌─────────────────────────────────────────┐
│ STELLAR NETWORK │ │ DATA LAYER (SQLite) │
│ │ │ │
│ ┌──────────────────────┐ │ │ ┌─────────────────────────────────┐ │
│ │ Horizon API │ │ │ │ stellar_donations.db │ │
│ │ (Gateway) │ │ │ │ │ │
│ └──────────┬───────────┘ │ │ │ Tables: │ │
│ │ │ │ │ • users │ │
│ ┌──────────▼───────────┐ │ │ │ • transactions │ │
│ │ Stellar Blockchain │ │ │ │ • recurring_donations │ │
│ │ (Testnet/Mainnet) │ │ │ │ │ │
│ └──────────────────────┘ │ │ └─────────────────────────────────┘ │
└─────────────────────────────┘ └─────────────────────────────────────────┘
═══════════════════════════════════════════════════════════════════════════════
DATA FLOW EXAMPLES
═══════════════════════════════════════════════════════════════════════════════
ONE-TIME DONATION:
──────────────────
Client → POST /donations → Stellar Service → Horizon API → Stellar Network
↓
Record in DB → Return Success
RECURRING DONATION:
──────────────────
Client → POST /stream/create → Store Schedule in DB
↓
Scheduler (every 60s) checks DB
↓
Execute due donations → Record TX
↓
Update next execution date
WALLET TRANSACTIONS:
───────────────────
Client → GET /wallets/:publicKey/transactions → Query DB → Return Results
═══════════════════════════════════════════════════════════════════════════════
KEY COMPONENTS
═══════════════════════════════════════════════════════════════════════════════
API ENDPOINTS:
• /donations - One-time donation management
• /wallets - Wallet and transaction queries
• /stream - Recurring donation schedules
• /stats - Analytics and statistics
SERVICES:
• StellarService - Real blockchain integration
• MockStellarService - Development/testing simulation
• RecurringDonationScheduler - Automated donation execution
DATABASE TABLES:
• users - Stellar wallet addresses
• transactions - All donation transactions
• recurring_donations - Scheduled recurring donations
EXTERNAL:
• Stellar Network - Blockchain for transactions
• Horizon API - Gateway to Stellar Network
═══════════════════════════════════════════════════════════════════════════════
TECHNOLOGY STACK
═══════════════════════════════════════════════════════════════════════════════
Runtime: Node.js
Framework: Express.js
Database: SQLite3
Blockchain: Stellar Network (stellar-sdk)
Testing: Jest
Tools: Nodemon, ESLint