spree-resource
Installation
SKILL.md
Adding a Spree Resource
Commands below use the Spree CLI form (
spree …, Docker). On a classic Rails app without the CLI (typical pre-5.4), use the native mapping in thespree-projectskill —bin/rails/bundle exec rakefrom the app root, paths without thebackend/prefix.
To add a new model that's exposed via the Spree v3 API, use the spree:api_resource generator. One command produces:
- The model (in
backend/app/models/spree/<name>.rb) - The migration
- Store + Admin API controllers
- Store + Admin serializers
- FactoryBot factory
- Controller specs covering full CRUD
- Routes (injected into
spree/api/config/routes.rb)
Prerequisite: run spree eject first — the generator executes inside the Docker container, and only the ejected dev compose bind-mounts ./backend, so generated files appear (and persist) on your host.