Graph Service
The Graph Service manages the social graphs, including follow/unfollow actions, blocking users, and other social interactions. It allows applications to maintain and query the social connections between users on the Frequency network.
API Reference
Configuration
âšī¸ Feel free to adjust your environment variables to taste. This application recognizes the following environment variables:
Name | Description | Range/Type | Required? | Default |
---|---|---|---|---|
API_BODY_JSON_LIMIT | Api json body size limit in string (some examples: 100kb or 5mb or etc) | string | 1mb | |
API_PORT | HTTP port that the application listens on | 1025 - 65535 | 3000 | |
API_TIMEOUT_MS | Overall API timeout limit in milliseconds. This is the maximum time allowed for any API request to complete. Any HTTP_RESPONSE_TIMEOUT_MS value must be less than this value | > 0 | 30000 | |
AT_REST_ENCRYPTION_KEY_SEED | This secret seed is used for generating an encryption/decryption key for encrypted sensitive data at rest | string | Y | |
BLOCKCHAIN_SCAN_INTERVAL_SECONDS | How many seconds to delay between successive scans of the chain (after end of chain is reached) | > 0 | 180 | |
CACHE_KEY_PREFIX | Prefix to use for Redis cache keys | string | content-watcher: | |
CAPACITY_LIMIT | Maximum amount of provider capacity this app is allowed to use (per epoch) type: 'percentage' 'amount' value: number (may be percentage, ie '80', or absolute amount of capacity) | JSON (example) | Y | |
DEBOUNCE_SECONDS | Number of seconds to retain pending graph updates in the Redis cache to avoid redundant fetches from the chain | >= 0 | ||
DEBUG | Enable additional logging | 'true' for debug logs, 'verbose' for debug + verbose logs | N | false |
FREQUENCY_API_WS_URL | Blockchain API Websocket URL | ws(s): URL | Y | |
FREQUENCY_TIMEOUT_SECS | Frequency chain connection timeout limit; app will terminate if disconnected longer | integer | 10 | |
GRAPH_ENVIRONMENT_TYPE | Graph environment type. | Mainnet|TestnetPaseo | Y | |
PROVIDER_ACCOUNT_SEED_PHRASE | Seed phrase for provider MSA control key | string | Y | |
PROVIDER_ID | Provider MSA Id | integer | Y | |
QUEUE_HIGH_WATER | Max number of jobs allowed on the 'graphUpdateQueue' before blockchain scan will be paused to allow queue to drain | >= 100 | 1000 | |
REDIS_OPTIONS | Additional Redis options. See ioredis configuration | JSON string | Y (either this or REDIS_URL) | '{"commandTimeout":10000}' |
REDIS_URL | Connection URL for Redis | URL | Y (either this or REDIS_OPTIONS) | |
VERBOSE_LOGGING | Enable 'verbose' log level | boolean | N | false |
WEBHOOK_FAILURE_THRESHOLD | Number of retry attempts to make when sending a webhook notification | > 0 | 3 | |
WEBHOOK_RETRY_INTERVAL_SECONDS | Number of seconds between provider webhook retry attempts when failing | > 0 | 10 | |
HTTP_RESPONSE_TIMEOUT_MS | Timeout in milliseconds to wait for a response as part of a request to an HTTP endpoint. Must be less than API_TIMEOUT_MS | > 0 and < API_TIMEOUT_MS | 3000 |
Best Practices
- Data Integrity: Ensure the integrity of social graph data by implementing robust validation checks.
- Efficient Queries: Optimize queries to handle large social graphs efficiently.
- User Privacy: Protect user privacy by ensuring that graph data is only accessible to authorized entities.