Lacinia implements Facebook’s GraphQL specification in Clojure as a backend-agnostic execution engine you wire into HTTP stacks.
Overview
Lacinia is a Clojure library for implementing GraphQL servers. It executes queries against a schema you define and sits between GraphQL clients and your data sources, similar in scope to the reference JavaScript implementation rather than acting as an object-relational mapper.
You express schemas as EDN data, attach field resolver functions for databases or remote services, compile the schema once at startup, and run requests through an execute pathway that returns EDN results convertible to JSON. It supports GraphQL types, interfaces, unions, enums, input objects, custom scalars, subscriptions, fragments, and schema introspection, with asynchronous query execution.
The library plugs into any Clojure HTTP pipeline. Companion projects such as lacinia-pedestal and duct-lacinia expose HTTP and subscription endpoints on Pedestal and Duct. Lacinia itself stays unaware of the web tier.
Walmart has used Lacinia in production since 2017. Design goals include composing schemas from data, embracing Clojure idioms, and applying sensible defaults with minimal magic.
Key features
- Full GraphQL specification support
- EDN schema definitions
- Asynchronous query execution
- Subscriptions and introspection
- Field resolver functions
- Inline and named fragments
- Custom scalar types
- HTTP pipeline integration
Use cases
- Clojure GraphQL APIs
- Mobile-friendly flexible data fetching
- Backend service integration via GraphQL
- Pedestal or Duct HTTP endpoints
- Schema-driven client contracts