WunderGraph Cosmo

repository·main·Indexed 22 days ago

https://github.com/wundergraph/cosmo

A Lifecycle API Management platform for Federated GraphQL providing tools for schema registry, composition, routing, and observability. It includes the wgc CLI for managing namespaces, federated graphs, and subgraphs, an Admission Server for validating Router configurations, a CDN Server for high-availability configuration delivery, and support for AWS Lambda Router deployments.

Tokens
454.7K
Snippets
1K
Records
2.2K
Agent score
77%

What's inside wundergraph-cosmo

  1. Overview of Cosmo Analytics

    main

    Cosmo Analytics provides a detailed breakdown of requests made to your federated graph. It allows you to analyze your data using grouping, filtering, and date range features. The analytics suite is divided into several specialized views:

    • Metrics: High-level performance and request statistics.
    • Traces: Detailed request lifecycle information.
    • Distributed Tracing: Insights into how requests flow through your federated architecture.
    • Schema Field Usage: Analysis of which GraphQL schema fields are being queried.
    • Client Identification: Data regarding the clients making requests to your graph.
  2. Overview of the Cosmo Helm Chart

    main

    The Cosmo Helm Chart is an umbrella chart that manages the deployment of the Cosmo Platform. It is composed of several sub-charts that represent different components of the platform. You can use this chart for both local development and production environments.

    Chart Structure

    1. Umbrella Chart: The main chart that orchestrates the deployment of all Cosmo components.
    2. Sub-charts: Individual charts for specific platform services, including:
      • Controlplane
      • GraphqlMetrics
      • OTELCollector
      • Studio
      • Router
      • CDN

    Storage Components

    Cosmo does not manage storage components directly via its own sub-charts. Instead, it leverages external Helm charts from Bitnami for the following services:

    • PostgresSQL
    • Keycloak
    • ClickHouse
    • Minio
    • Redis

    To find the specific configuration options and default values for any component, refer to the README.md file located within that component's specific Helm directory.

  3. Overview of GraphQL Subscriptions in Cosmo Router

    main

    The Cosmo Router provides built-in support for GraphQL subscriptions, enabling real-time data updates via long-lived connections. It supports multiple protocols for both client-to-router and router-to-subgraph communication:

    • graphql-ws (Default): A coherent, zero-dependency, and widely adopted WebSocket protocol.
    • Server-Sent Events (SSE): Recommended for unidirectional updates; more resource-efficient than WebSockets and supports both GET and POST requests.
    • Multipart HTTP: Allows data to be delivered in chunks over time, ideal for streaming large or frequently updated data.
    • subscriptions-transport-ws: Legacy WebSocket transport (use graphql-ws or SSE instead).
    • absinthe: Legacy transport for Absinthe (Phoenix) protocol clients.

    You can configure the specific protocol used for each subgraph when registering or updating it on the control plane.

  4. What is Cosmo Router?

    main

    Cosmo Router is an Apache 2.0 licensed router compatible with both GraphQL Federation v1 and v2. It is implemented in Golang and is designed for high performance and maintainability.

    Its primary responsibilities include:

    • Understanding the GraphQL Federation protocol.
    • Routing incoming requests to the appropriate services.
    • Aggregating responses from multiple services into a single response.

    While the Router maintains a connection to the Control Plane to report status and health, its core operation is independent and does not depend on the Control Plane's availability.

  5. Overview of SCIM in Cosmo

    main

    Cosmo supports the System for Cross-domain Identity Management (SCIM) standard to automate user identity management. This allows identity providers (e.g., Okta) to communicate with Cosmo via RESTful APIs to streamline administrative processes like provisioning and de-provisioning.

    Supported integration workflows include:

    • Create users: When a user is added to the SCIM app in your identity provider, an invitation is sent to the user's email to join their organization in Cosmo.
    • Update user attributes: Modifications to user attributes within the SCIM app are automatically synced to Cosmo.
    • Deactivate users: When a user is removed from the SCIM app, their corresponding account in Cosmo is deactivated.
  6. Overview of Cosmo stack Docker subdirectories

    main

    The docker/ directory contains subdirectories for each container in the Cosmo stack, which include files used by Docker Compose to preconfigure the respective images.

    Available service subdirectories:

    • clickhouse: Custom configuration and setup scripts for ClickHouse.
    • grafana: Resources for provisioning dashboards, data sources, and plugins.
    • keycloak: Configuration and resources for initializing Keycloak.
    • postgres: Initialization scripts and configuration for PostgreSQL.
    • prometheus: Configuration files and custom settings for Prometheus.
    • redis: Configuration files and scripts for Redis setup.
  7. Overview of WunderGraph Cosmo

    main

    WunderGraph Cosmo is a full lifecycle GraphQL API management solution designed to manage Federated Graphs at scale. It provides a unified platform for composition checks, routing, analytics, and distributed tracing.

    Key capabilities include:

    • Scalability: Supports monolithic GraphQL APIs, Federation v1, and Federation v2 (including Subscriptions).
    • Deployment Flexibility: Can be run locally, on-premises, or as a managed cloud service.
    • Safety: Enables rapid iteration through composition checks to prevent breaking changes in federated architectures.
  8. Overview of Cosmo Studio

    main

    Cosmo Studio is a user-friendly dashboard designed to execute and maintain GraphQL Federated Architectures. It serves as the primary interface for consuming graphs created via the CLI.

    Key capabilities include:

    • Graph Management: View all federated graphs and their constituent subgraphs.
    • Federated Graph Dashboard: Monitor connected subgraphs, label matchers, composition status, the schema registry, and schema checks.
    • Change Tracking: Review the history of changes made to a federated graph via the changelog.
    • Querying: Use the bundled GraphiQL Playground to execute queries and explore your schema.
    • Observability: Access analytical data, including request trends over time and distributed tracing.
  9. Choose a Cosmo deployment model

    main

    Cosmo offers different deployment models depending on your security, regulatory, and operational requirements:

    • Open Source: Operate the Cosmo solution independently using Kubernetes, PostgreSQL, Redis, ClickHouse, and Keycloak.
    • Cosmo Cloud: A managed service that is SOC 2 compliant.
    • Cosmo Dedicated Cloud: A fully managed, isolated, and end-to-end secure deployment of Cosmo Cloud. It is SOC 2-certified, available in AWS, GCP, and Azure, and supports custom release cycles to avoid forced major updates. It can also be run in 100% air-gapped scenarios without public internet access.
    • Self-Hosted: For strictly regulated industries, Cosmo can be fully self-hosted and self-managed to satisfy specific security audits and internal constraints.
  10. Understand the data collected by the Cosmo Router

    main

    The router collects and exports different types of data depending on its configuration. Key data categories include:

    • Tracing (OTEL): Includes request host, schema, user-agent, protocol, bytes, router process ID, hostname, service name, and normalized GraphQL operation details.
    • Metrics (OTEL): Includes total request counts, byte counts (received/written), in-flight requests, latency, and runtime behavior, dimensioned by Operation Name and Subgraph Name.
    • Schema Usage Metrics: Includes GraphQL operation content and used GraphQL types per operation.
    • Request Logging: The router logs incoming requests at the INFO level locally. These logs include method, path, query, user-agent, anonymized client-IP, router version, config version, response status, and latency. Note: Request logs are not sent to external systems and remain in the router's local environment.
  11. Check gRPC integration feature support in Cosmo Router

    main

    When using gRPC as a subgraph (via plugins or services) with the Cosmo Router, certain GraphQL features are fully supported, while others are currently limited or unsupported.

    Supported Features

    • Operations: Query, Mutation, and Field Resolvers (with batching).
    • Federation: Entity Lookups (Single, Multiple, and Compound keys), @requires directive, and External Fields.
    • Type System: All standard scalars, Complex Input Types, Nullable Scalar Types, Enum Values, Interface Types, Union Types, Recursive Types, Nested Object Types, and Lists (including nested and complex list structures).

    Unsupported or Limited Features

    • Federation Entity Lookups (Nested Keys): ❌ Not yet supported.
    • Custom Scalar Conversion: ❌ Limited to fixed mappings only.
    • Nullable List Items: ❌ Not supported due to Protobuf constraints (e.g., [String]).
    • GraphQL Subscriptions: ❌ Real-time data subscriptions are not yet supported.