REST APIs from your GraphQL schema
SOFA takes your GraphQL schema, looks for the available queries, mutations and subscriptions, and turns all of them into a REST API, with an OpenAPI definition to match. Part of the Hive ecosystem by The Guild.
- One line of setup
- Fully RESTful
- OpenAPI included
Why SOFA
- Easy to useSet up SOFA within a single line of code and start serving a REST API right away, next to your existing GraphQL endpoint.
- Fully RESTfulQueries become GET endpoints, mutations become POST endpoints, and subscriptions become webhooks, following REST conventions.
- OpenAPI for freeGenerate an OpenAPI definition from the same schema, so REST consumers get typed clients and interactive docs.
Your schema, served twice
Mount SOFA as middleware and every operation in the schema is reachable over REST, with the GraphQL execution underneath.
Read the introductionimport { useSofa } from 'sofa-api';
import express from 'express';
const app = express();
app.use(
'/api',
useSofa({
basePath: '/api',
schema,
}),
);
// GET /api/users -> query { users }
// POST /api/add-user -> mutation { addUser }Learn more
Essentials
How queries, mutations and subscriptions map onto REST endpoints.
Essentials →Recipes
OpenAPI generation, error handling and other real-world setups.
Recipes →API reference
Every option of useSofa, from context and models to the error handler.
API reference →
Discover the complete ecosystem of tools and libraries
Complete GraphQL Federation Stack
Our libraries to support all your GraphQL needs
Explore the Ecosystem