Sangria

What Sangria is
Sangria is a free, self-hosted Scala implementation of GraphQL for developers building GraphQL servers and endpoints. It works as a layer inside a Scala application, leaving transport, data format, and storage decisions to that application. Scala abstractions define GraphQL schemas, types, fields, and resolvers, while macros can derive object types from Scala classes and allow generated types to be customized. Sangria parses and validates queries, including compile-time syntax reporting, and its Executor runs queries against a schema with an optional user context for shared data or authorization. Query analysis includes complexity checks and schema comparisons. Middleware can support performance measurement, metrics, and field- or query-level security enforcement. Example integrations cover Akka HTTP and Play Framework. JSON marshalling supports Circe, spray-json, Play JSON, Argonaut, json4s, MessagePack, and Amazon Ion. The project describes compatibility with Apollo, Relay, GraphiQL, and other GraphQL tools, with sangria-relay for React Relay.
Who it suits
Sangria suits Scala developers creating self-hosted GraphQL servers or endpoints. It is intended for applications that choose their own transport, data format, and storage.
What it does well
- Free plan and self-hosted deployment
- Macros derive and customize GraphQL object types
- Executor supports user context data
- Query complexity and schema comparison checks
- Multiple JSON marshalling integrations
What to know first
- No explicit security primitives
- Requires a Scala application layer
- Transport and storage remain application responsibilities
Limits
Sangria leaves transport, data format, and storage choices to the surrounding Scala application. Authentication and authorization require application context, resolvers, middleware, or field tags rather than explicit security primitives.
Getting started
- Open the Sangria project website
- Add Sangria to a Scala application
- Define GraphQL schemas, types, fields, and resolvers
- Choose transport, storage, and data formats in the application
- Connect a JSON library or Akka HTTP or Play Framework integration
- Run the self-hosted GraphQL server
Verdict
Sangria provides Scala-focused GraphQL schema, parsing, execution, and analysis capabilities in a self-hosted library. Its integrations and JSON options support varied Scala server setups, while authentication must be built through application mechanisms.
Questions
What is Sangria?
Sangria is a Scala implementation of GraphQL for building servers and endpoints.
Is Sangria free?
Yes. It is offered as a free project under the Apache License 2.0.
How is Sangria deployed?
Sangria is self-hosted inside a Scala application.
Which JSON libraries work with Sangria?
Documented integrations include Circe, spray-json, Play JSON, Argonaut, json4s, MessagePack, and Amazon Ion.
Does Sangria support Apollo and Relay?
It describes itself as compatible with Apollo, Relay, GraphiQL, and other GraphQL tools, with sangria-relay for React Relay.
Where can users get help?
The community page directs users to Stack Overflow for help and Gitter for general discussion.
Facts from Sangria's own pages
- Audience
- The getting-started guide describes Sangria as a layer inside a Scala application for building a GraphQL server while leaving transport, data format, and storage choices to the application. · sangria-graphql.github.io, 8 Oct 2026
- Authentication
- The documentation says Sangria does not provide explicit security primitives and demonstrates implementing authentication and authorization through application context, resolvers, middleware, and field tags. · sangria-graphql.github.io, 8 Oct 2026
- Client compatibility
- The project describes Sangria as spec compliant and compatible with Apollo, Relay, GraphiQL, and other GraphQL tools and libraries. · github.com, 8 Oct 2026
- Code generation
- Macros can derive GraphQL object type definitions from Scala classes and customize generated types. · sangria-graphql.github.io, 8 Oct 2026
- Contributions
- Users are invited to report bugs through the issue tracker and contribute code or documentation through pull requests. · sangria-graphql.github.io, 8 Oct 2026
- Execution
- Its Executor runs queries against a schema and can use a user context object for shared data or authorization information. · sangria-graphql.github.io, 8 Oct 2026
- Framework examples
- The project provides example server integrations using Akka HTTP and Play Framework. · sangria-graphql.github.io, 8 Oct 2026
- Integrations
- The project says Sangria is spec compliant and works with Apollo, Relay, GraphiQL, and other GraphQL tools and libraries. · github.com, 8 Oct 2026
- Intended users
- The documentation presents Sangria as a library for Scala developers building GraphQL servers and endpoints. · sangria-graphql.github.io, 8 Oct 2026
- JSON libraries
- Sangria supports multiple JSON libraries, including Circe, spray-json, and Play JSON. · sangria-graphql.github.io, 8 Oct 2026
- JSON support
- The documentation lists marshalling integrations for spray-json, Play JSON, Circe, Argonaut, json4s, MessagePack, and Amazon Ion. · sangria-graphql.github.io, 8 Oct 2026
- License
- The Sangria repository states that the project is licensed under Apache License 2.0. · github.com, 8 Oct 2026
- Middleware
- Sangria middleware can support performance measurement, metrics collection, and security enforcement at field and query level. · sangria-graphql.github.io, 8 Oct 2026
- Product
- Sangria is a Scala implementation of GraphQL. · sangria-graphql.github.io, 8 Oct 2026
- Purpose
- Sangria is a Scala implementation of GraphQL. · sangria-graphql.github.io, 8 Oct 2026
- Query analysis
- It supports query and schema validation, query complexity checks, and schema comparisons. · sangria-graphql.github.io, 8 Oct 2026
- Query execution
- Its Executor runs GraphQL queries against a schema and user context. · sangria-graphql.github.io, 8 Oct 2026
- Query parsing
- Sangria parses GraphQL queries and offers a macro that reports syntax errors at compile time. · sangria-graphql.github.io, 8 Oct 2026
- Relay support
- The sangria-relay library is offered for using Sangria with the React Relay framework. · sangria-graphql.github.io, 8 Oct 2026
- Schema definition
- It provides Scala abstractions for defining GraphQL schemas, types, fields, and resolvers. · sangria-graphql.github.io, 8 Oct 2026
- Support
- The community page directs users to Stack Overflow for help and Gitter for general discussion. · sangria-graphql.github.io, 8 Oct 2026
Where Sangria stands on Freedom251
- GraphQL Tools#24 of 32