Initial commit

This commit is contained in:
Michilis
2025-12-19 23:56:07 -03:00
commit 23f716255e
48 changed files with 14834 additions and 0 deletions

139
env.example Normal file
View File

@@ -0,0 +1,139 @@
# ============================================
# Cashumints.space API Configuration
# ============================================
# Copy this file to .env and adjust values
#
# Production setup:
# cp env.example .env
# openssl rand -hex 32 # Generate ADMIN_API_KEY
# nano .env # Edit configuration
#
# ============================================
# ============================================
# Server Configuration
# ============================================
PORT=3000
HOST=0.0.0.0
NODE_ENV=production
# ============================================
# Admin Configuration
# ============================================
# API key for admin endpoints (REQUIRED in production)
# Generate a secure key: openssl rand -hex 32
ADMIN_API_KEY=
# ============================================
# Database Configuration
# ============================================
# SQLite database path (relative or absolute)
# Ensure the directory exists and is writable
DATABASE_PATH=./data/cashumints.db
# ============================================
# Probing Configuration
# ============================================
# Timeout for probe requests (milliseconds)
PROBE_TIMEOUT_MS=10000
# Probe interval for online mints (milliseconds)
# Default: 300000 (5 minutes)
PROBE_INTERVAL_ONLINE_MS=300000
# Probe interval for offline mints (milliseconds)
# Default: 900000 (15 minutes)
PROBE_INTERVAL_OFFLINE_MS=900000
# Number of consecutive failures before marking offline
CONSECUTIVE_FAILURES_OFFLINE=3
# Days offline before marking as abandoned
ABANDONED_AFTER_DAYS=30
# RTT threshold for degraded status (milliseconds)
DEGRADED_RTT_MS=2000
# ============================================
# Metadata Configuration (NUT-06)
# ============================================
# Minimum interval between metadata fetches (milliseconds)
# Default: 3600000 (1 hour)
METADATA_FETCH_INTERVAL_MS=3600000
# ============================================
# Nostr Configuration (NIP-87)
# ============================================
# Comma-separated list of Nostr relay URLs
# Reviews and mint announcements are ingested from these relays
NOSTR_RELAYS=wss://relay.damus.io,wss://relay.nostr.band,wss://relay.cashumints.space,wss://relay.primal.net,wss://purplepag.es
# ============================================
# Trust Score Configuration
# ============================================
# Component weights (should sum to ~100 before penalties)
TRUST_WEIGHT_UPTIME=40
TRUST_WEIGHT_SPEED=25
TRUST_WEIGHT_REVIEWS=20
TRUST_WEIGHT_IDENTITY=10
# Maximum penalty points for issues
TRUST_PENALTY_MAX=15
# ============================================
# Rate Limiting
# ============================================
# Time window for rate limiting (milliseconds)
# Default: 60000 (1 minute)
RATE_LIMIT_WINDOW_MS=60000
# Maximum requests per window per IP
RATE_LIMIT_MAX_REQUESTS=100
# ============================================
# CORS Configuration
# ============================================
# Allowed origins (comma-separated, use * for all)
CORS_ORIGINS=*
# ============================================
# Logging
# ============================================
# Log level: debug, info, warn, error
LOG_LEVEL=info
# Enable request logging (true/false)
REQUEST_LOGGING=true
# ============================================
# Plausible Analytics
# ============================================
# Self-hosted Plausible instance URL
PLAUSIBLE_URL=https://analytics.azzamo.net
# Plausible API key for stats access
# Generate from your Plausible dashboard: Settings > API Keys
PLAUSIBLE_API_KEY=
# Site ID/domain configured in Plausible
PLAUSIBLE_SITE_ID=cashumints.space
# ============================================
# Quick Reference
# ============================================
#
# Start API server:
# npm start
#
# Start workers:
# npm run workers
#
# Test health:
# curl http://localhost:3000/v1/health
#
# Test admin (requires ADMIN_API_KEY):
# curl -H "X-Admin-Api-Key: YOUR_KEY" http://localhost:3000/v1/admin/system/metrics
#
# View docs:
# open http://localhost:3000/docs
#