spree-resource

Installation
SKILL.md

Adding a Spree Resource

Commands use the Spree CLI (spree …, Docker, Rails app in server/). On a classic Rails app without the CLI, run bin/rails g spree:api_resource … from the app root and drop the server/ prefix from paths (see spree-project).

To add a model exposed through the v3 API, use the spree:api_resource generator. One command produces:

  • The model (server/app/models/spree/<name>.rb) and its migration
  • Store + Admin API controllers and serializers
  • A FactoryBot factory and controller specs for both APIs
  • Route lines inside the Spree::Core::Engine.add_routes block of your app's config/routes.rb
  • The read_<plural> / write_<plural> permission scope (Spree.permissions.register_scope appended to config/initializers/spree.rb) and its role-editor label (config/locales/spree_<plural>.en.yml) — Admin surface only

Prerequisite: run spree eject first. Generators execute inside the web container, and only the ejected dev compose bind-mounts ./server, so generated files appear (and persist) on your host.

The one-command path

Installs
272
GitHub Stars
10
First Seen
Jun 11, 2026