Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

2.4 KB
Raw Blame
# {{plugin_name}}

A Spree plugin: **{{name}}**.

This monorepo holds the dashboard half of the plugin:

- `packages/dashboard/` — TypeScript dashboard plugin (extends the Spree 6.0 admin via [`@spree/dashboard-core`](https://www.npmjs.com/package/@spree/dashboard-core))

The example pages call `/api/v3/admin/{{name}}` endpoints through the SDK's `request` method. Those endpoints don't exist yet — they belong in a Spree extension gem (a Rails engine) that you create separately, with its model, Admin API controller and permission scope, as described in [Creating an extension](https://spreecommerce.org/docs/developer/contributing/creating-an-extension). Then point your Spree host's Gemfile at it:

```ruby
gem '{{ruby_name}}', path: '../path/to/{{ruby_name}}'
```

## Development setup

```bash
pnpm install
pnpm build   # type-checks the plugin (it ships TypeScript source)
```

## Running against a Spree host app

Activate the dashboard plugin with a side-effect import in the host's `main.tsx`, before the router mounts. This runs `defineDashboardPlugin` so the nav entry, route, slot widget, and table column register:

```tsx
import '{{npm_dashboard_package}}'
```

That's it — no `vite.config.ts` edit. This plugin's `package.json` declares `"spree": { "dashboard": { "plugin": true } }`, which `@spree/dashboard-core/vite`'s auto-discovery picks up so Tailwind v4 scans the plugin's source files for utility classes automatically.

If you'd rather opt out of auto-discovery and register manually, pass an explicit `plugins` array to `spreeDashboardPlugin` in the host's `vite.config.ts`.

## Documentation

- [Dashboard overview](https://spreecommerce.org/docs/developer/dashboard/overview) — three-package split + when to plug-in vs. customize in-app
- [Customization quickstart](https://spreecommerce.org/docs/developer/dashboard/customization/quickstart) — the registries this plugin uses
- [Plugin overview](https://spreecommerce.org/docs/developer/dashboard/plugins/overview) — packaging + publishing your plugin to npm
- [Slots catalog](https://spreecommerce.org/docs/developer/dashboard/slots-catalog) — every named slot the dashboard exposes
- [Custom Admin Endpoints](https://spreecommerce.org/docs/developer/sdk/admin/extending) — adding your own API endpoints
- [Creating an extension](https://spreecommerce.org/docs/developer/contributing/creating-an-extension) — the Rails-engine side

## License

{{license}} © {{year}} {{author_name}}