Ledger1
GraphQL and REST Together in Ledger1

GraphQL and REST Together in Ledger1

January 05, 2025Ledger1 Team
graphqlrestapiarchitecture

Ledger1 pairs GraphQL for product-facing experiences with REST for external system integrations. This keeps the product graph clean while respecting the operational realities of vendors.

When to use GraphQL

  • Product UI that composes data from multiple domains.
  • Strong typing and introspection for fast developer iteration.
  • Co-located queries with components to avoid over-fetching.

When to use REST

  • Integrations with third-party systems (POS, payroll, inventory) that expose REST.
  • Webhooks and idempotent task endpoints.
  • Long-running jobs (export/import) with job status polling.

Patterns that work

  • GraphQL behind the app; REST at the boundary for vendors.
  • Error shaping: convert vendor-specific errors to stable domain errors.
  • Versioning: REST endpoints versioned; GraphQL evolved with deprecation.
  • Caching: REST responses cached; GraphQL results memoized on client.

In the Varuni demo

  • Apollo Client with typed operations for dashboard queries.
  • REST routes for Toast ingestion, backfill, and reconciliation jobs.
  • Shared auth utilities and consistent request tracing across both.

This hybrid approach keeps the developer experience excellent while isolating vendor volatility from the product graph.