Overview of @hive/storage
main@hive/storage package is a service designed to create the database access layer and manage data storage for Hive Console. It utilizes Slonik as a wrapper for interacting with Postgres instances.repository·main·Indexed 19 days ago
https://github.com/graphql-hive/consoleAn open-source schema registry and analytics platform for GraphQL federation and standalone APIs. Includes documentation for the Hive CLI, schema management (publish, check, promote, fetch), app deployment, and integration with Apollo and Grafana monitoring.
@hive/storage package is a service designed to create the database access layer and manage data storage for Hive Console. It utilizes Slonik as a wrapper for interacting with Postgres instances.Hive Console provides several key capabilities for managing GraphQL APIs:
external-composition package specifically supports scenarios where schema composition is performed outside of the Hive Console ecosystem.@hive/policy is a service designed to run GraphQL-ESLint as part of Hive schema policy checks. It allows you to enforce linting rules and schema quality standards during the Hive schema lifecycle.The @hive/commerce service provides the commerce backend for Hive. Its primary responsibilities include:
It exposes a tRPC router named commerceRouter (located in src/api.ts). This router is intended to be consumed by the server and usage services by configuring the COMMERCE_ENDPOINT environment variable.
The @hive/usage service is responsible for handling HTTP requests for usage reporting. It acts as an ingestion point for usage data, which is then processed through a pipeline:
@hive/usage.usage-ingestor service consumes data from Kafka and feeds it into ClickHouse.Version 0.54.0 introduced several enhanced validation rules for Federation composition via federation-composition v0.21.0:
@authenticated, @requiresScopes, and @policy. These cannot be placed on interfaces, interface fields, or interface objects (AUTH_REQUIREMENTS_APPLIED_ON_INTERFACE).@requires specify at least the auth requirements of the fields they select. Failure results in a MISSING_TRANSITIVE_AUTH_REQUIREMENTS error.@authenticated, @requiresScopes, and @policy directives from implementing object types.@cost Directive Restrictions: The @cost directive is restricted from being placed on interface types, their fields, or field arguments.@listSize Validation: Validates that sizedFields point to actual list fields and ensures slicingArguments only include arguments present in all subgraphs.EXTERNAL_MISSING_ON_BASE: Fixed false positives for @interfaceObject corner-cases involving @external fields.The @hive/schema service handles incoming composition requests via HTTP (tRPC) using a multi-layered approach to optimize performance and stability:
TaskManager checks if the specific composition task is already in progress. If so, the request waits for the existing task to complete rather than starting a new one.WorkerPool. Each task runs in an isolated worker thread with memory limits to ensure that a single malfunctioning task does not crash the entire service.When working with @hive/migrations, follow these best practices to ensure database integrity:
main branch, do not change its code or filename.down migration that performs the exact opposite operation, typically in reverse order.Introduced in version 0.58.0, Hive supports app deployment retirement protection settings. When enabled, these settings prevent the retirement of app deployments that meet certain criteria, such as:
Integration tests utilize a combination of two Docker Compose files to simulate a complete Hive Cloud environment:
docker-compose.community.yml: Contains all services and configurations required to run Hive core (excluding Cloud-specific services like billing). This is the same file used for self-hosting.docker-compose.integration.yaml: An extension/override file used to run mocks for services like the CloudFlare CDN mock and external composition service.Warning: docker-compose.integration.yaml includes environment variable overrides specific to integration testing. Use caution when adding environment variables that might be affected by these overrides.