Skill v1.0.1
currentAutomated scan96/100+3 new
version: "1.0.1" name: rstore-vite-monospace description: "Use when wiring Monospace into a plain Vite/Vue app with @rstore/vite-monospace, including rstoreMonospace config, remote or local OpenAPI generation, virtual:rstore-monospace modules, generated rstore-monospace.d.ts declarations, runtimeApiKey handling, primaryKeys, and store setup with the generated schema and monospacePlugin."
Rstore Vite Monospace
Use @rstore/vite-monospace to generate Monospace-backed rstore schema and plugin modules in a non-Nuxt Vite app.
Setup
Register the Vite plugin in vite.config.ts:
import { rstoreMonospace } from '@rstore/vite-monospace'import { defineConfig } from 'vite'export default defineConfig({plugins: [rstoreMonospace({url: 'https://your-monospace-instance.com',workspace: 'your-workspace',schemaApiKey: process.env.MONOSPACE_API_KEY,scopeId: 'rstore-monospace',}),],})
Then create the store from the generated virtual module:
import { createStore, RstorePlugin } from '@rstore/vue'import { monospacePlugin, schema } from 'virtual:rstore-monospace'const store = await createStore({schema,plugins: [monospacePlugin],})app.use(RstorePlugin, { store })
Options
| Option | Purpose | |
|---|---|---|
url | Monospace API URL used for remote schema loading and runtime client code | |
workspace | Monospace workspace identifier (project is a deprecated alias) | |
schemaApiKey | Build-time key for remote schema loading (needs openApiSchema:read + dataModel:read) | |
input | Local OpenAPI JSON path, resolved from the Vite root | |
metadataInput | Local schema metadata snapshot JSON path, resolved from the Vite root | |
runtimeApiKey | Runtime API key emitted into generated client code | |
cacheControl | Cache-Control header ('no-cache' or 'no-store') sent by the generated runtime client | |
scopeId | rstore plugin scope id, defaulting to rstore-monospace | |
primaryKeys | Explicit primary key overrides by collection name | |
dts | Declaration output path, true/omitted for rstore-monospace.d.ts, or false to disable |
Virtual Modules
virtual:rstore-monospacere-exportsschema,monospace, andmonospacePlugin.virtual:rstore-monospace/schemaexports the generated rstore schema.virtual:rstore-monospace/pluginexports the Monospace REST client and rstore plugin.
Local Schema Mode
Use input plus metadataInput when the schema is checked into the project or generated separately. The metadata snapshot holds the Monospace schema meta collection items keyed by collection name; write it from loadRemoteSchemaMetadata (@rstore/monospace/schema):
rstoreMonospace({input: './openapi.json',metadataInput: './schema-metadata.json',})
With only one local file, the other schema source is loaded remotely and url/workspace are required.
Guardrails
- Keep
schemaApiKeybuild-time only; it must not appear in generated virtual modules. - Configure
runtimeApiKeyonly when the key is safe to emit into runtime/client code. - Do not hand-write replacement schema or plugin virtual modules; fix generator input/config instead.
- Use the generated
schemaandmonospacePlugintogether in the same store. - Use
rstore-monospacefor OpenAPI, REST, query, and mutation behavior. - Use
rstore-vuefor component query/form/cache patterns.