forked from Junirezz/YieldVault-RWA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.env.example
More file actions
191 lines (158 loc) · 7.74 KB
/
Copy path.env.example
File metadata and controls
191 lines (158 loc) · 7.74 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Backend Server Configuration
# Copy this to .env and customize for your environment
# Server Configuration
PORT=3000
NODE_ENV=development
# Rate Limiting Configuration
# Global rate limiter: 100 requests per 15 minutes (900000 ms)
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX_REQUESTS=100
# API endpoint rate limiter: 30 requests per minute (60000 ms)
API_RATE_LIMIT_WINDOW_MS=60000
API_RATE_LIMIT_MAX_REQUESTS=30
# ── Payload Size Limits ───────────────────────────────────────────────────────
# Route-tier-specific caps enforced by the payloadLimit middleware.
# Express size notation applies: "4kb", "16kb", "32kb", "1mb" etc.
# Omit a variable (or leave it blank) to use the compiled-in default.
#
# Tier Default Routes
# global 1mb All routes (last-resort baseline)
# auth 4kb /api/v1/auth/* (credentials/tokens only)
# admin 16kb /admin/* (structured config payloads)
# writes 32kb POST /api/v1/vault/deposits|withdrawals|deposits/v2|strategy
#PAYLOAD_LIMIT_GLOBAL=1mb
#PAYLOAD_LIMIT_AUTH=4kb
#PAYLOAD_LIMIT_ADMIN=16kb
#PAYLOAD_LIMIT_WRITES=32kb
# ── Wallet signed-action nonces ───────────────────────────────────────────────
# WALLET_NONCE_TTL_SECONDS=300
# WALLET_NONCE_MAX_ACTIVE_PER_WALLET=10
# WALLET_NONCE_ENFORCEMENT=strict # strict | off (default: strict in production)
# WALLET_SIGNATURE_MODE=stellar # stellar | hmac (default: stellar in production)
# WALLET_ACTION_HMAC_SECRET= # HMAC secret when WALLET_SIGNATURE_MODE=hmac
# Multi-instance production deployments must set REDIS_URL below so nonce
# allocation/consumption is atomic across every backend replica.
# ── Admin API Key RBAC ────────────────────────────────────────────────────────
# Roles (least → most privileged): viewer, operator, admin, super-admin
# Assign when registering keys via POST /admin/api-keys/register { "role": "..." }
# viewer – read-only admin endpoints
# operator – maintenance, cache, allowlist, webhooks (non-secret), jobs, exports
# admin – full admin except impersonation / global idempotency flush
# super-admin – all privileged operations
# Stellar RPC Configuration
STELLAR_RPC_URL=https://soroban-testnet.stellar.org
STELLAR_NETWORK=testnet
STELLAR_NETWORK_PASSPHRASE=Test SDF Network ; September 2015
# Vault Configuration
VAULT_CONTRACT_ID=
# PostgreSQL Database Configuration
# DATABASE_URL is required in production. The replica is optional; reads fall
# back to the primary when it is omitted or unavailable.
DATABASE_URL=postgres://postgres:postgres@localhost:5432/yieldvault
DATABASE_REPLICA_URL=
DATABASE_POOL_SIZE=10
DATABASE_CONNECTION_TIMEOUT_MS=5000
DATABASE_IDLE_TIMEOUT_MS=30000
PRISMA_POOL_MAX=10
PRISMA_POOL_TIMEOUT_MS=10000
PRISMA_QUERY_TIMEOUT_MS=5000
# Admin audit log persistence mode: memory | prisma | hybrid
ADMIN_AUDIT_LOG_STORAGE=hybrid
# Webhook verification
WEBHOOK_VERIFICATION_TIMEOUT_MS=5000
WEBHOOK_CHALLENGE_TTL_SECONDS=900
WEBHOOK_ALLOW_UNVERIFIED=false
# Prisma runtime connection settings
PRISMA_POOL_SIZE=10
PRISMA_POOL_TIMEOUT_SEC=10
PRISMA_QUERY_TIMEOUT_MS=5000
PRISMA_TX_MAX_WAIT_MS=5000
PRISMA_TX_TIMEOUT_MS=10000
# ── Query performance budgets and slow-query alerts ──────────────────────────
# Per-query defaults; exact model/action overrides use a JSON object.
# QUERY_READ_BUDGET_MS=100
# QUERY_WRITE_BUDGET_MS=200
# QUERY_BUDGETS_JSON={"User.findUnique":50,"Transaction.findMany":150}
# A breach at or above this multiple of its budget is critical.
# SLOW_QUERY_CRITICAL_MULTIPLIER=3
# SLOW_QUERY_ALERT_COOLDOWN_MS=900000
# SLOW_QUERY_ALERT_TIMEOUT_MS=5000
# QUERY_ALERT_TYPE=both # slack | pagerduty | both
# SLOW_QUERY_SLACK_WEBHOOK_URL= # falls back to SLACK_WEBHOOK_URL
# SLOW_QUERY_PAGERDUTY_INTEGRATION_KEY= # falls back to PAGERDUTY_INTEGRATION_KEY
# REDIS_URL below shares alert cooldowns across backend replicas.
# ── Cache Configuration ───────────────────────────────────────────────────────
# Redis-backed response cache for price and vault summary endpoints.
# When REDIS_URL is set, GET responses for /api/v1/vault/summary, /api/v1/vault/apy,
# and /api/v1/vault/metrics are cached in Redis so they survive process restarts and
# are shared across multiple backend replicas.
# When REDIS_URL is absent or Redis is temporarily unreachable the backend falls
# back transparently to the in-memory LRU store (CACHE_MAX_ENTRIES entries).
# Redis connection URL (also used for rate-limiting; set once for both)
REDIS_URL=redis://localhost:6379
# Response cache TTL in milliseconds (applies to vault summary, metrics, APY endpoints)
CACHE_TTL_MS=60000
# Alias accepted in addition to CACHE_TTL_MS
# CACHE_VAULT_METRICS_TTL_MS=60000
# Maximum entries kept in the in-memory LRU fallback store
CACHE_MAX_ENTRIES=500
# Redis cache key namespace prefix (default: "cache:")
# REDIS_CACHE_KEY_PREFIX=cache:
# Connection attempt timeout for the Redis cache client (ms)
# REDIS_CACHE_CONNECT_TIMEOUT_MS=2000
# Per-command timeout for Redis cache operations (ms)
# REDIS_CACHE_COMMAND_TIMEOUT_MS=500
# CORS Configuration
# Comma-separated list of allowed origins. Supports strings or regex like /https?:\/\/.*\.yieldvault\.finance/
CORS_ALLOWED_ORIGINS=http://localhost:3000,https://app.yieldvault.finance
# Email Notification Configuration
EMAIL_PROVIDER=resend
EMAIL_API_KEY=
EMAIL_FROM_ADDRESS=notifications@yieldvault.finance
# Latency SLO Monitoring Configuration
# SLO thresholds in milliseconds
SLO_READ_THRESHOLD_MS=200
SLO_WRITE_THRESHOLD_MS=500
# Evaluation window for P95 calculation (5 minutes = 300000 ms)
SLO_EVALUATION_WINDOW_MS=300000
# Alert cooldown period to prevent spam (15 minutes = 900000 ms)
SLO_ALERT_COOLDOWN_MS=900000
# SLO check interval (1 minute = 60000 ms)
SLO_CHECK_INTERVAL_MS=60000
# Alert Integration Configuration
# Set to 'slack', 'pagerduty', or 'both'
ALERT_TYPE=slack
# Slack Webhook URL (required if ALERT_TYPE includes 'slack')
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK
# PagerDuty Integration Key (required if ALERT_TYPE includes 'pagerduty')
PAGERDUTY_INTEGRATION_KEY=
# Event Polling Configuration
# Poll interval for checking new events (10 seconds = 10000 ms)
EVENT_POLL_INTERVAL_MS=10000
# Batch size for event replay (number of ledgers per batch)
EVENT_REPLAY_BATCH_SIZE=100
# ── Outbox Pattern Configuration ───────────────────────────────────────────────
# The outbox pattern ensures reliable, at-least-once event delivery by writing
# events to the EventOutbox table as part of business transactions, with a
# background processor that relays them to webhook consumers.
#
# Poll interval for the outbox processor (2 seconds = 2000 ms)
# OUTBOX_POLL_INTERVAL_MS=2000
#
# Maximum number of entries to process per poll cycle
# OUTBOX_BATCH_SIZE=50
#
# Lock timeout for distributed instance-level locking (60 seconds = 60000 ms)
# OUTBOX_LOCK_TIMEOUT_MS=60000
#
# Maximum delivery attempts before moving to dead-letter
# OUTBOX_MAX_ATTEMPTS=3
#
# Retention period for processed entries (7 days = 604800000 ms)
# OUTBOX_RETENTION_MS=604800000
#
# Unique instance identifier for distributed locking (auto-generated if unset)
# OUTBOX_INSTANCE_ID=
#
# Cleanup interval for removing old processed entries (1 hour = 3600000 ms)
# OUTBOX_CLEANUP_INTERVAL_MS=3600000