{"id":21529191,"url":"https://github.com/everx-labs/ever-q-server","last_synced_at":"2025-04-09T23:50:18.563Z","repository":{"id":38184410,"uuid":"192898150","full_name":"everx-labs/ever-q-server","owner":"everx-labs","description":"GraphQL API for TVM networks (Everscale, TON, Venom, Gosh, etc)","archived":false,"fork":false,"pushed_at":"2024-09-11T18:09:56.000Z","size":11981,"stargazers_count":1,"open_issues_count":5,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-24T01:35:39.187Z","etag":null,"topics":["api","blockchain","everscale","free","freeton","graphql","node","ton","venom","venom-blockchain","venom-developer-program"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/everx-labs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-20T10:14:42.000Z","updated_at":"2024-09-11T18:10:01.000Z","dependencies_parsed_at":"2023-09-29T16:30:28.000Z","dependency_job_id":"f32fad43-6faf-44cc-ba58-9bf0c72ee72e","html_url":"https://github.com/everx-labs/ever-q-server","commit_stats":null,"previous_names":["everx-labs/ton-q-server","tonlabs/ton-q-server"],"tags_count":120,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everx-labs%2Fever-q-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everx-labs%2Fever-q-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everx-labs%2Fever-q-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/everx-labs%2Fever-q-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/everx-labs","download_url":"https://codeload.github.com/everx-labs/ever-q-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248131454,"owners_count":21052819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","blockchain","everscale","free","freeton","graphql","node","ton","venom","venom-blockchain","venom-developer-program"],"created_at":"2024-11-24T01:56:10.556Z","updated_at":"2025-04-09T23:50:18.533Z","avatar_url":"https://github.com/everx-labs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ever-q-server\n\nEverscale GraphQL Server.\n\nThis component is a part of EverX Labs Server and must not be accessed directly but through EverX Labs Client\nLibraries.\n\n## Prerequisites\n\nNode.js\n\n## Install\n\nClone this repository and run\n\n```bash\nnpm install\n```\n\n## Setup\n\nYou can configure Q Server with command line parameters and/or ENV variables:\n\n```text\nOption                                          ENV                                             Default                                 Description\n----------------------------------------------  ----------------------------------------------  --------------------------------------  -------------------------------------------------------------------------------------------------------------------------------\n--config                                        Q_CONFIG                                                                                Path to JSON configuration file\n--host                                          Q_HOST                                          {ip}                                    Listening address\n--port                                          Q_PORT                                          4000                                    Listening port\n--keep-alive                                    Q_KEEP_ALIVE                                    60000                                   GraphQL keep alive ms\n--requests-mode                                 Q_REQUESTS_MODE                                 kafka                                   Requests mode:\n                                                                                                                                        `tcpadnl` – posts external messages to c++ liteserver\n                                                                                                                                        `kafka` – writes external messages to kafka topic\n                                                                                                                                        `rest` – posts external messages to REST endpoint\n                                                                                                                                        `jrpc` – posts external messages to JRPC endpoint\n--requests-server                               Q_REQUESTS_SERVER                               kafka:9092                              Requests server url\n--requests-pubkey                               Q_REQUESTS_PUBKEY                                                                       Liteserver base64 pubkey\n--requests-topic                                Q_REQUESTS_TOPIC                                requests                                Requests topic name\n--requests-max-size                             Q_REQUESTS_MAX_SIZE                             65535                                   Maximum request message size in bytes\n--subscriptions-kafka-server                    Q_SUBSCRIPTIONS_KAFKA_SERVER                    kafka:9092                              Subscriptions server url (for 'external' subscriptions mode)\n--subscriptions-kafka-topic                     Q_SUBSCRIPTIONS_KAFKA_TOPIC                     subscriptions                           Subscriptions topic name (for 'external' subscriptions mode)\n--subscriptions-max-filter-size                 Q_SUBSCRIPTIONS_MAX_FILTER_SIZE                 65535                                   Maximum subscription's filter size in bytes (for 'external' subscriptions mode)\n--subscriptions-filters-millis                  Q_SUBSCRIPTIONS_FILTERS_MILLIS                  30000                                   Kafka keep alive period for filters in millisecons (for 'external' subscriptions mode)\n--subscriptions-redis-port                      Q_SUBSCRIPTIONS_REDIS_PORT                      6379                                    Redis port (for 'external' subscriptions mode)\n--subscriptions-redis-host                      Q_SUBSCRIPTIONS_REDIS_HOST                      redis                                   Redis host (for 'external' subscriptions mode)\n--subscriptions-health-redis-channel            Q_SUBSCRIPTIONS_HEALTH_REDIS_CHANNEL                                                    Redis channel with 'subscriptions are alive' messages\n--subscriptions-health-timeout                  Q_SUBSCRIPTIONS_HEALTH_TIMEOUT                  60000                                   Timeout for 'subscriptions are alive' messages\n--filter-or-conversion                          Q_FILTER_OR_CONVERSION                          sub-queries                             Filter OR conversion:\n                                                                                                                                        `or-operator` – q-server uses AQL with OR\n                                                                                                                                        `sub-queries` – q-server performs parallel queries for each OR operand\n                                                                                                                                         and combines results (this option provides faster execution\n                                                                                                                                         than OR operator in AQL)\n--stringify-key-in-aql-comparison               Q_STRINGIFY_KEY_IN_AQL_COMPARISON               false                                   **UNSTABLE!** If `true` then AQL will use `TO_STRING(doc._key)` conversion\n                                                                                                                                        if _key comparison operator is used in filter (e.g. `{ id: { lt: \"123\" }`).\n--query-max-runtime                             Q_QUERY_MAX_RUNTIME                             600                                     Max allowed execution time for ArangoDb queries in seconds\n--query-max-timeout-arg                         Q_QUERY_MAX_TIMEOUT_ARG                         86400000                                Max allowed `timeout` argument value (is ms) for collections queries\n                                                                                                                                        (timeout will be coerced down to this value)\n--slow-queries                                  Q_SLOW_QUERIES                                  redirect                                Slow queries handling:\n                                                                                                                                        `enable` – process slow queries on the main database\n                                                                                                                                        `redirect` – redirect slow queries to slow-queries database\n                                                                                                                                        `disable` – fail on slow queries\n--query-wait-for-period                         Q_QUERY_WAIT_FOR_PERIOD                         1000                                    Initial collection polling period for wait-for queries\n                                                                                                                                        (collection queries with timeout) in ms\n--remp-enabled                                  Q_REMP_ENABLED                                  false                                   REMP enabled\n--remp-redis-client-url                         Q_REMP_REDIS_CLIENT_URL                         redis://localhost:6379                  URL to remp redis\n--remp-message-list-key                         Q_REMP_MESSAGE_LIST_KEY                         remp-receipts:{message}                 Key for message list\n                                                                                                                                        This parameter must contain substring `{message}`\n                                                                                                                                        that will be replaced with actual message id\n--remp-message-changes-key                      Q_REMP_MESSAGE_CHANGES_KEY                      __keyspace@0__:remp-receipts:{message}  Key for message changes channel\n                                                                                                                                        This parameter must contain substring `{message}`\n                                                                                                                                        that will be replaced with actual message id\n--use-listeners (DEPRECATED)                    Q_USE_LISTENERS                                 true                                    Use database listeners for subscriptions (deprecated in favor of subscriptions-mode)\n--walking-use-cache                             Q_WALKING_USE_CACHE                             false                                   Use cache to serve block walking algorithm\n--ignore-messages-for-latency                   Q_IGNORE_MESSAGES_FOR_LATENCY                   false                                   Exclude messages from total latency (for networks without service messages)\n--subscriptions-mode                            Q_SUBSCRIPTIONS_MODE                            arango                                  Subscriptions mode:\n                                                                                                                                        `disabled` - disable subscriptions\n                                                                                                                                        `arango` - subscribe to ArangoDB WAL for changes\n                                                                                                                                        `external` - use external services to handle subscriptions\n--hot                                           Q_HOT                                                                                   Default hot databases\n--archive                                       Q_ARCHIVE                                                                               Default archive databases\n--hot-cache                                     Q_HOT_CACHE                                                                             hot cache server\n--hot-cache-expiration                          Q_HOT_CACHE_EXPIRATION                          10                                      hot cache expiration in seconds\n--hot-cache-empty-data-expiration               Q_HOT_CACHE_EMPTY_DATA_EXPIRATION               2                                       hot cache empty entries expiration in seconds\n--accounts                                      Q_ACCOUNTS                                                                              Accounts databases\n--blocks-hot                                    Q_BLOCKS_HOT                                                                            Blocks hot databases\n--blocks-archive                                Q_BLOCKS_ARCHIVE                                                                        Blocks archive databases\n--blocks-cache                                  Q_BLOCKS_CACHE                                                                          Blocks cache server\n--blocks-cold                                   Q_BLOCKS_COLD                                                                           Blocks cold databases\n--transactions-hot                              Q_TRANSACTIONS_HOT                                                                      Transactions and messages hot databases\n--transactions-archive                          Q_TRANSACTIONS_ARCHIVE                                                                  Transactions and messages archive databases\n--transactions-cache                            Q_TRANSACTIONS_CACHE                                                                    Transactions and messages cache server\n--transactions-cold                             Q_TRANSACTIONS_COLD                                                                     Transactions and messages cold databases\n--zerostate                                     Q_ZEROSTATE                                                                             Zerostate database\n--counterparties                                Q_COUNTERPARTIES                                                                        Counterparties databases\n--chain-ranges-verification                     Q_CHAIN_RANGES_VERIFICATION                                                             Chain ranges verification databases\n--slow-queries-hot-cache                        Q_SLOW_QUERIES_HOT_CACHE                                                                Slow queries hot cache server\n--slow-queries-hot-cache-expiration             Q_SLOW_QUERIES_HOT_CACHE_EXPIRATION             10                                      Slow queries hot cache expiration in seconds\n--slow-queries-hot-cache-empty-data-expiration  Q_SLOW_QUERIES_HOT_CACHE_EMPTY_DATA_EXPIRATION  2                                       Slow queries hot cache empty entries expiration in seconds\n--slow-queries-accounts                         Q_SLOW_QUERIES_ACCOUNTS                                                                 Slow queries accounts databases\n--slow-queries-blocks-hot                       Q_SLOW_QUERIES_BLOCKS_HOT                                                               Slow queries blocks hot databases\n--slow-queries-blocks-archive                   Q_SLOW_QUERIES_BLOCKS_ARCHIVE                                                           Slow queries blocks archive databases\n--slow-queries-blocks-cache                     Q_SLOW_QUERIES_BLOCKS_CACHE                                                             Slow queries blocks cache server\n--slow-queries-blocks-cold                      Q_SLOW_QUERIES_BLOCKS_COLD                                                              Slow queries blocks cold databases\n--slow-queries-transactions-hot                 Q_SLOW_QUERIES_TRANSACTIONS_HOT                                                         Slow queries transactions and messages hot databases\n--slow-queries-transactions-archive             Q_SLOW_QUERIES_TRANSACTIONS_ARCHIVE                                                     Slow queries transactions and messages archive databases\n--slow-queries-transactions-cache               Q_SLOW_QUERIES_TRANSACTIONS_CACHE                                                       Slow queries transactions and messages cache server\n--slow-queries-transactions-cold                Q_SLOW_QUERIES_TRANSACTIONS_COLD                                                        Slow queries transactions and messages cold databases\n--slow-queries-zerostate                        Q_SLOW_QUERIES_ZEROSTATE                                                                Slow queries zerostate database\n--block-bocs-s3-endpoint                        Q_BLOCK_BOCS_S3_ENDPOINT                                                                block-bocs S3 endpoint\n--block-bocs-s3-region                          Q_BLOCK_BOCS_S3_REGION                                                                  block-bocs S3 region\n--block-bocs-s3-bucket                          Q_BLOCK_BOCS_S3_BUCKET                          everblocks                              block-bocs S3 bucket\n--block-bocs-s3-num-buckets                     Q_BLOCK_BOCS_S3_NUM_BUCKETS                     0                                       block-bocs S3 number of buckets (if specified and \u003e 0, then bucket name will be equal to `{bucket}-{crc32(file) % numBuckets}`)\n--block-bocs-s3-access-key                      Q_BLOCK_BOCS_S3_ACCESS_KEY                                                              block-bocs S3 access key\n--block-bocs-s3-secret-key                      Q_BLOCK_BOCS_S3_SECRET_KEY                                                              block-bocs S3 secret key\n--block-bocs-s3-timeout                         Q_BLOCK_BOCS_S3_TIMEOUT                         300000                                  block-bocs S3 request timeout in millis\n--block-bocs-pattern                            Q_BLOCK_BOCS_PATTERN                                                                    block-bocs BOC retrieval url pattern. `{hash} will be replaced with BOC's hash\n--block-bocs-arango-database                    Q_BLOCK_BOCS_ARANGO_DATABASE                                                            block-bocs Arango database\n--block-bocs-arango-collection                  Q_BLOCK_BOCS_ARANGO_COLLECTION                  blocks                                  block-bocs Arango collection\n--accounts-evernode-rpc-endpoint                Q_ACCOUNTS_EVERNODE_RPC_ENDPOINT                                                        Accounts Evernode RPC endpoint\n--accounts-evernode-rpc-timeout                 Q_ACCOUNTS_EVERNODE_RPC_TIMEOUT                 300000                                  Accounts Evernode RPC timeout in millis\n--jaeger-endpoint                               Q_JAEGER_ENDPOINT                                                                       Jaeger endpoint\n--trace-service                                 Q_TRACE_SERVICE                                 Q Server                                Trace service name\n--trace-tags                                    Q_TRACE_TAGS                                                                            Additional trace tags (comma separated name=value pairs)\n--last-key-block-cache-enabled                  Q_LAST_KEY_BLOCK_CACHE_ENABLED                  true                                    Last key block cache enabled\n--last-key-block-cache-ttl-ms                   Q_LAST_KEY_BLOCK_CACHE_TTL_MS                   300000                                  Last key block cache TTL in millis\n--statsd-server                                 Q_STATSD_SERVER                                                                         StatsD server (host:port)\n--statsd-tags                                   Q_STATSD_TAGS                                                                           Additional StatsD tags (comma separated name=value pairs)\n--statsd-reset-interval                         Q_STATSD_RESET_INTERVAL                         0                                       Interval between statsd reconnects.\n                                                                                                                                        If it is zero – no reconnects.\n--is-tests                                      Q_IS_TESTS                                      false                                   Determines that q-server runs in unit tests mode.\n--network-name                                  Q_NETWORK_NAME                                  cinet.tonlabs.io                        Define the name of the network q-server is working with\n--cache-key-prefix                              Q_CACHE_KEY_PREFIX                              Q_                                      Prefix string to identify q-server keys in data cache\n--endpoints                                     Q_ENDPOINTS                                                                             Alternative endpoints of q-server (comma separated addresses)\n```\n\nIf you use `config.json` file the specified file must have the following structure (in TypeScript\nnotation):\n\n```ts\ntype QConfig = {\n    config: string,\n    server: {\n        host: string,\n        port: number,\n        keepAlive: number,\n    },\n    requests: {\n        mode: RequestsMode,\n        server: string,\n        pubkey: string,\n        topic: string,\n        maxSize: number,\n    },\n    queries: {\n        filter: FilterConfig,\n        maxRuntimeInS: number,\n        slowQueries: SlowQueriesMode,\n        waitForPeriod: number,\n    },\n    useListeners: boolean,\n    blockchain: QBlockchainDataConfig,\n    counterparties: string[],\n    chainRangesVerification: string[],\n\n    slowQueriesBlockchain?: QBlockchainDataConfig,\n\n    data?: QDeprecatedDataConfig,\n    slowQueriesData?: QDeprecatedDataConfig,\n\n    authorization: {\n        endpoint: string,\n    },\n    jaeger: {\n        endpoint: string,\n        service: string,\n        tags: Record\u003cstring, string\u003e,\n    },\n    statsd: {\n        server: string,\n        tags: string[],\n        resetInterval: number,\n    },\n    mamAccessKeys: string[],\n    isTests: boolean,\n    networkName: string,\n    cacheKeyPrefix: string,\n    endpoints: string[],\n};\n\ntype FilterConfig = {\n    orConversion: FilterOrConversion,\n};\n\ntype QBlockchainDataConfig = {\n    hotCache?: string,\n    hotCacheExpiration: number,\n    hotCacheEmptyDataExpiration: number,\n    accounts: string[],\n    blocks: QHotColdDataConfig,\n    transactions: QHotColdDataConfig,\n    zerostate: string,\n};\n\ntype QHotColdDataConfig = {\n    hot: string[],\n    cache?: string,\n    cold: string[],\n};\n\ntype QDeprecatedDataConfig = {\n    mut?: string;\n    hot?: string;\n    cold?: string[];\n    cache?: string;\n    counterparties?: string;\n};\n\nenum SlowQueriesMode {\n    ENABLE = \"enable\",\n    REDIRECT = \"redirect\",\n    DISABLE = \"disable\"\n}\n\nexport enum RequestsMode {\n    TCP_ADNL = \"tcpadnl\", // via c++ lite-server tcp adnl\n    KAFKA = \"kafka\",\n    REST = \"rest\",\n    JRPC = \"jrpc\",\n}\n\nenum FilterOrConversion {\n    OR_OPERATOR = \"or-operator\",\n    SUB_QUERIES = \"sub-queries\",\n}\n```\n\nCommand line parameters and ENV variables with \"databases\"\nat the end of description accept comma-separated list of database urls\n(described below).\nE.g.:\n```text\nQ_ACCOUNTS: accounts_db_url\nQ_BLOCKS_HOT: blocks_00_url,blocks_01_url,blocks_10_url,blocks_11_url\n```\n\nZerostate database defaults to the first database in hot blocks databases.\nDb config must be specified in the form of URL:\n\n```text\n    `[https://][user:password@]host[:8529][/path][?[name=blockchain][\u0026maxSockets=100][\u0026listenerRestartTimeout=1000][\u0026resultCacheTTL=0]]`\n```\n\nParameters:\n\n- `protocol` default value is `https://`;\n- `auth` default is empty (it is means no auth);\n- `port` default is `8529`;\n- `path` default is empty;\n- `name` default is `blockchain`;\n- `maxSockets` is a maximum simultaneous connection to the arango database.\n  Default is `100` for fast queries and `3` for slow queries.\n- `listenerRestartTimeout` when Arango WAL listener has encountered a connection problem,\n  it retries using this timeout.\n  Measured in milliseconds.\n  Default is `1000`.\n- `resultCacheTTL` enables cache of the arango query results.\n  Measured in milliseconds.\n  `0` disables caching.\n  Default is `0`.\n\n## Run\n\n```bash\nnode index.js\n```\n\n## Connectivity\n\nQ-Server is accessible with GraphQL HTTP/WebSocket protocol on port \"4000\" and path \"/graphql\".\n\nThere is the only valid way to communicate with Q-Server – EverX Labs Client Libraries.\n\n## StatsD\n\nQ-Server reports several StatsD metrics if it is configured with `statsd` option:\n\n```text\n    Metric                       Type     Tags             Description\n    ---------------------------  -------  ---------------  -------------------------------------------------------------\n    qserver.start                counter  collection=name  Incremented for each start.\n                                                           Contains the `version` tag.\n\n    qserver.doc.count            counter  collection=name  Incremented for each db event (document insert/update)\n\n    qserver.post.count           counter                   Incremented for each node request\n\n    qserver.post.failed          counter                   Incremented for each failed node request\n\n    qserver.query.count          counter  collection=name  Incremented for each db query\n\n    qserver.query.failed         counter  collection=name  Incremented for each failed db query\n\n    qserver.query.slow           counter  collection=name  Incremented each time when q-server has encountered\n                                                           slow query\n\n    qserver.query.time           timer    collection=name  Reported each time when q-server has finished\n                                                           query handler from SDK client\n\n    qserver.request.duration     timer                     Reported each time when q-server has finished\n                                                           HTTP request from SDK client\n\n    qserver.query.active         gauge    collection=name  Updated each time when q-server has started and finished\n                                                           query handler from SDK client\n\n    qserver.subscription.count   counter  collection=name  Incremented for each subscription start\n\n    qserver.stats.error.internal counter                   Incremented for each internal server error\n```\n\nQ-Server can report additional tags with help of optional parameter `Q_STATSD_TAGS`.\n\n## Adding Indexes\n\nIf you need to add or change or remove index in Arango Db you must change following files:\n\n- [https://github.com/everx-labs/ever-q-server/blob/d491c7c0e6e11cb70d5f7f0813eef719ea6b997d/src/server/data/data-provider.js#L65]\n- [https://github.com/everx-labs/TVM-infrastructure/blob/ef4d409d9508ca5e1d815c5f21ec11f16c4b8f39/pipelines/arango/arango/initdb.d/upgrade-arango-db.js#L7]\n\nHow to determine which index required to serve some slow query.\n\nLet look to SLOW query reported by q-server log.\n\n```text\nmessages QUERY {\"filter\":{\"src\":{\"eq\":\"...\"},\"dst\":{\"eq\":\"...\"},\"value\":{\"ne\":null},\"OR\":{\"src\":{\"eq\":\"...\"},\"dst\":{\"eq\":\"...\"},\"value\":{\"ne\":null}}},\"orderBy\":[{\"path\":\"created_at\",\"direction\":\"DESC\"}],\"limit\":1}\n```\n\nFirst, lets extract `collection`, `filter` and `orderBy`:\n\n```text\ncollection: messages\nfilter: {\"src\":{\"eq\":\"...\"},\"dst\":{\"eq\":\"...\"},\"value\":{\"ne\":null},\"OR\":{\"src\":{\"eq\":\"...\"},\"dst\":{\"eq\":\"...\"},\"value\":{\"ne\":null}}}\norderBy:[{\"path\":\"created_at\",\"direction\":\"DESC\"}]\n```\n\nNext, reduce filter and order by:\n\n- remove quotes;\n- remove constants (`eq:\"...\"` -\u003e `eq`);\n- remove filter outer `{}`;\n- replace order by with path direction pairs;\n\n```text\ncollection: messages\nfilter: src:{eq},dst:{eq},value:{ne},OR:{src:{eq},dst:{eq},value:{ne}}\norderBy: created_at DESC\n```\n\nNext, separate filter by `OR` on several filters:\n\n```text\ncollection: messages\nfilter: src:{eq},dst:{eq},value:{ne}\nfilter: src:{eq},dst:{eq},value:{ne}\norderBy: created_at DESC\n```\n\nNext, remove duplicated filters:\n\n```text\ncollection: messages\nfilter: src:{eq},dst:{eq},value:{ne}\norderBy: created_at DESC\n```\n\nNext, collect fields from filter and order by into index (filter fields must be placed first in any\norder, then fields from `orderBy` in same order as in `orderBy`:\n\n```text\ncollection: messages\nfilter: src:{eq},dst:{eq},value:{ne}\norderBy: created_at DESC\nindex: src,dst,value,created_at\n```\n\n## For Developers\n\nIMPORTANT!!!\n\n**FIRST**. If you have modified source code you need to compile it:\n\n```bash\nnpm run tsc\n```\n\nThis will regenerate file in `dist` folder.\n\n**SECOND**. If you want to modify scheme of database, you must do it only in one\nplace: `db-schema.ts`. After that you need to generate source code for a graphql type definitions and\nfor resolvers JavaScript code. You must do it with:\n\n```bash\nnpm run tsc\nnpm run gen\nnpm run tsc\n```\n\nYes, you need too run tsc twice :(.\n\n## Tests\n\nBy default tests connect to Arango on [http://localhost:8901]\n\n```bash\n$ npx everdev se start\nStarting tonlabs-tonos-se-user... ✓\n$ npx everdev se set --db-port 8901\nStopping [tonlabs-tonos-se-user]... ✓\nRemoving [tonlabs-tonos-se-user]... ✓\nCreating tonlabs-tonos-se-user... ✓\nStarting tonlabs-tonos-se-user... ✓\n$ npx everdev se info\nInstance  State    Version  GraphQL Port  ArangoDB Port  Docker Container       Docker Image\n--------  -------  -------  ------------  -------------  ---------------------  --------------------------\ndefault   running  0.28.11  80            8901           tonlabs-tonos-se-user  tonlabs/local-node:0.28.11\n$ Q_HOT=http://localhost:8901 Q_ARCHIVE=http://localhost:8901 Q_SLOW_QUERIES=enable npm run test\n```\n\nOptionally you can change Arango address for the tests\n```\n$ npx everdev se set --db-port 2021\n$ npx everdev se info\nInstance  State    Version  GraphQL Port  ArangoDB Port  Docker Container       Docker Image\n--------  -------  -------  ------------  -------------  ---------------------  --------------------------\ndefault   running  0.28.11  80            2021           tonlabs-tonos-se-user  tonlabs/local-node:0.28.11\n$ export Q_ACCOUNTS=\"http://localhost:2021\"\n$ export Q_HOT=\"http://localhost:2021\"\n$ export Q_ARCHIVE=\"http://localhost:2021\"\n$ Q_SLOW_QUERIES=enable npm run test\n```\n\n## Configuration\n\nYou can change default behavior with env:\n\n```bash\nexport Q_ACCOUNTS=http://localhost:8529\nexport Q_ACCOUNTS=${Q_DATA_MUT}\nexport Q_BLOCKS_HOT=${Q_DATA_MUT}\nexport Q_BLOCKS_COLD=${Q_DATA_MUT}\nexport Q_TRANSACTIONS_HOT=${Q_DATA_MUT}\nexport Q_TRANSACTIONS_COLD=${Q_DATA_MUT}\nexport Q_SLOW_QUERIES_ACCOUNTS=${Q_DATA_MUT}\nexport Q_SLOW_QUERIES_BLOCKS_HOT=${Q_DATA_MUT}\nexport Q_SLOW_QUERIES_BLOCKS_COLD=${Q_DATA_MUT}\nexport Q_SLOW_QUERIES_TRANSACTIONS_HOT=${Q_DATA_MUT}\nexport Q_SLOW_QUERIES_TRANSACTIONS_COLD=${Q_DATA_MUT}\n```\n\nor/and via arg `--config \u003cpath to config\u003e`\n\n```json\n{\n\t\"endpoints\": [],\n\t\"server\": {\n\t\t\"host\": \"localhost\",\n\t\t\"port\": 4000,\n\t\t\"keepAlive\": 60000\n\t},\n\t\"requests\": {\n\t\t\"mode\": \"rest\",\n\t\t\"server\": \"kafka:9092\",\n        \"pubkey\": \"\",\n\t\t\"topic\": \"requests\",\n\t\t\"maxSize\": \"16383\"\n\t},\n    \"blockchain\": {\n        \"hotCache\": \"\",\n        \"hotCacheExpiration\": 10,\n        \"hotCacheEmptyDataExpiration\": 3,\n        \"acounts\": [],\n        \"blocks\": {\n            \"hot\": [],\n            \"cache\": \"\",\n            \"cold\": []\n        },\n        \"transactions\": {\n            \"hot\": [],\n            \"cache\": \"\",\n            \"cold\": []\n        },\n        \"zerostate\": \"\"\n    },\n    \"slowQueriesBlockchain\": {\n        \"hotCache\": \"\",\n        \"hotCacheExpiration\": 10,\n        \"hotCacheEmptyDataExpiration\": 3,\n        \"acounts\": [],\n        \"blocks\": {\n            \"hot\": [],\n            \"cache\": \"\",\n            \"cold\": []\n        },\n        \"transactions\": {\n            \"hot\": [],\n            \"cache\": \"\",\n            \"cold\": []\n        },\n        \"zerostate\": \"\"\n    },\n\t\"authEndpoint\": \"\",\n\t\"mamAccessKeys\": \"\",\n\t\"jaegerEndpoint\": \"\",\n\t\"trace\": {\n\t\t\"service\": \"\",\n\t\t\"tags\": []\n\t},\n\t\"statsd\": {\n\t\t\"server\": \"\",\n\t\t\"tags\": [],\n\t\t\"resetInterval\": 0\n\t}\n}\n```\n\nConfiguration priority is follows:\n\n    Program args \u003e Config file \u003e ENVs \u003e defaults\n\n### Reload config\n\nQServer can reload config file without an actual restart by handling `SIGHUP` signal.\n\nRequired at least one of `--config` or `env Q_CONFIG` to be set at server start\n\n### Run q-server in docker for development\nIf you want to run q-server in docker do the following:\n1. Compile source files\n```\nnpm install\nnpm run tsc\n```\n2. Build docker image\n```\ndocker build . -t qserver\n```\n3. q-server needs other available resources (like ArangoDB and node). The easiest way to provide them is to run Evernode SE as a docker image:\n```\n$ everdev se start\n$ everdev se set --db-port 8901\n```\nWait a bit (sometimes it takes up to 2 minutes) and check if the ArangoDB web interface is available at http://localhost:8901.\n\n4. Create and run a new container (change 192.168.122.1 to your IP address)\n```\ndocker run --rm -d \\\n    -p 4000:4000 \\\n    -e Q_REQUESTS_MODE=rest \\\n    -e Q_REQUESTS_SERVER=192.168.122.1 \\\n    -e Q_DATA_MUT=http://192.168.122.1:8901 \\\n    -e Q_DATA_HOT=http://192.168.122.1:8901 \\\n  qserver\n```\nGraphQL playground must be available on http://localhost:4000/graphql\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feverx-labs%2Fever-q-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feverx-labs%2Fever-q-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feverx-labs%2Fever-q-server/lists"}