Overview
CryptoPulse uses environment variables for configuration. Copy.env.example to .env in your project root and configure the variables below.
Server Configuration
The port on which the API server will listen.Example:
3000Logging verbosity level. Controls the Winston logger output.Options:
error, warn, info, debug, verboseExample: infoAuthentication
Username for JWT authentication via the
/auth/login endpoint.Example: adminPassword for JWT authentication via the
/auth/login endpoint.Example: secretSecret key used to sign JWT tokens. Must be kept secure and never exposed.Example:
change-meJWT token expiration time. Accepts time strings like
1h, 30m, 7d.Example: 1hDatabase
PostgreSQL connection string. When running locally, use
localhost. When running in Docker Compose, use the service name.Format: postgres://username:password@host:port/databaseExample (local): postgres://postgres:postgres@localhost:5432/crypto_pulseExample (docker): postgres://postgres:postgres@postgres:5432/crypto_pulseRedis
Redis connection string. Used for batching coordination and distributed throttling. When running locally, use
localhost. When running in Docker Compose, use the service name.Format: redis://host:portExample (local): redis://localhost:6379Example (docker): redis://redis:6379Rate Limiting
Throttle time window in milliseconds. Defines the rolling time window for rate limit counters.Example:
60000 (1 minute)Maximum number of requests allowed per
THROTTLE_TTL_MS window for all endpoints (excluding /docs and /docs-json).Example: 20Maximum number of login requests allowed per
THROTTLE_TTL_MS window for the POST /auth/login endpoint.Example: 5CoinGecko API
Your CoinGecko API key for accessing cryptocurrency price data.Example:
xyzGet your API key from CoinGecko.Base URL for the CoinGecko API. Typically only changed for testing purposes.Example:
https://api.coingecko.comTimeout in milliseconds for CoinGecko API requests.Example:
3000Request Batching
Time window in milliseconds to wait for additional requests before flushing a batch. The first request for a coin starts this timer.Example:
5000 (5 seconds)Number of pending requests for the same coin that triggers an immediate batch flush, bypassing the
BATCH_WINDOW_MS wait time.Example: 3Maximum time in milliseconds that a single request will wait for a batch result before timing out.Example:
8000 (8 seconds)Example Configuration
.env