This guide walks you through setting up soda-gql in your project.
This initial version supports queries and mutations only. Subscriptions, directives, and native GraphQL fragments are planned for future releases.
Run the init command to scaffold all necessary files:
This creates:
soda-gql.config.ts - Configuration fileschema.graphql - Sample GraphQL schemagraphql-system/default.inject.ts - Scalars and adapter definitionsgraphql-system/.gitignore - Ignore generated filesReplace the sample schema.graphql with your actual GraphQL schema:
Edit graphql-system/default.inject.ts to add custom scalars:
This generates the type-safe GraphQL system in the graphql-system/ directory.
Fragments specify reusable field selections:
Operations define complete GraphQL queries with field selections:
soda-gql requires a build plugin to transform your code. Choose the one that matches your setup:
| Plugin | Use Case |
|---|---|
@soda-gql/babel-plugin | Babel-based builds |
@soda-gql/tsc-plugin | TypeScript compiler |
@soda-gql/webpack-plugin | Webpack projects |
@soda-gql/vite-plugin | Vite projects |
@soda-gql/metro-plugin | React Native / Expo |
See the Recipes section for framework-specific setup guides.