activeadmin-graphql
GraphQL HTTP API for ActiveAdmin, built with graphql-ruby. Register resources as usual, optionally add a graphql do ... end block, enable the endpoint per namespace, and get a schema with queries and mutations aligned with ActiveAdmin authorization and filters.
Design changes go through rfcs/ (RFC 0001).
Setup
# Gemfile (graphql-ruby is pulled in by activeadmin-graphql)
gem "activeadmin" # 3.5, or pin 4.0.0.beta23
gem "activeadmin-graphql"ActiveAdmin 4.0 is still a prerelease. Pin it explicitly, for example gem "activeadmin", "4.0.0.beta23". Bundler will not select a prerelease from this gem's >= 3.2 floor. graphql-ruby must be 2.6.9 or newer.
# config/initializers/active_admin.rb
ActiveAdmin.setup do |config|
config.namespace :admin do |admin|
admin.graphql = true
# admin.graphql_path = "graphql" # default: POST /admin/graphql
end
endBundler loads this gem as usual; that requires graphql-ruby and wires ActiveAdmin routing and DSL for GraphQL.
Documentation: docs/graphql-api.md covers the endpoint, schema, graphql do ... end, authorization, composite PKs, visibility, and dataloaders. For an older GraphQL integration, see "Migrating GraphQL clients" in that guide (enum type names, typed mutation inputs, key/value lists vs JSON).
Development
Tests use a minimal Rails app under spec/dummy with SQLite (:memory: in test; each parallel_tests worker is a separate process with its own DB). From the gem root:
bundle install
bundle exec appraisal install # generates gemfiles/*.gemfile from Appraisals
bundle exec rubocop
bundle exec parallel_rspec spec # or: bundle exec rspec
# or
rake rubocop
rake specMatrixed Rails versions use Appraisal: gemfiles/rails72.gemfile pins Rails 7.2 with ActiveAdmin 3.5; rails8ruby34.gemfile and rails8ruby4.gemfile pin Rails 8.1 with ActiveAdmin 4.0.0.beta23 (integration tests follow the spec/dummy app). Run bundle exec appraisal rspec to execute RSpec in each gemfile context, or bundle exec parallel_rspec spec locally for faster multi-process runs on the current bundle.
Trunk config lives in .trunk/; CI runs trunk via .github/workflows/trunk.yml. Releases: usr/bin/release.rb (RuboCop, Appraisal RSpec across gemfiles, gem build / gem push, git tag, gh release).
No local ActiveAdmin checkout is required; the dummy app depends on the published activeadmin gem like a normal host app.
Links
- GitHub
- GitLab
- RubyGems
-
Versions Atom (feed id
10803975489574) - libraries.io
- Deps.dev
- SonarCloud
- Snyk
- Codecov
- OpenSSF Scorecard
License
MIT - see LICENSE.md.