Terminal
Terminal/Skill
Guides wiring Monospace into a Nuxt app through the rstore Nuxt module, generated collections, runtime API keys, and primary keys.
By Directus
Works with
npx skills add directus/rstore --skill rstore-nuxt-monospaceUse @rstore/nuxt-monospace to generate Monospace-backed rstore collections and register the runtime REST plugin in Nuxt.
Register the Nuxt module:
export default defineNuxtConfig({
modules: [
'@rstore/nuxt-monospace',
],
rstoreMonospace: {
url: 'https://your-monospace-instance.com',
project: 'your-project',
schemaApiKey: process.env.MONOSPACE_API_KEY,
scopeId: 'rstore-monospace',
},
})
Use generated collections through useStore():
const store = useStore()
const { data } = await store.Todos.query(q => q.many({
fields: ['id', 'title'],
limit: 20,
}))
Use the auto-imported REST client when direct Monospace access is intentional:
const monospace = useMonospace()
const todos = await monospace.readMany('Todos', { limit: 10 })
| Option | Purpose |
|---|---|
url | Monospace API URL |
project | Monospace project identifier |
schemaApiKey | Build-time key for remote schema loading (needs openApiSchema:read + dataModel:read) |
input | Local OpenAPI JSON path, resolved from Nuxt root |
metadataInput | Local schema metadata snapshot JSON path, resolved from Nuxt root |
runtimeApiKey | Runtime API key emitted into generated config |
scopeId | rstore plugin scope id, defaulting to rstore-monospace |
primaryKeys | Explicit primary key overrides by collection name |
$rstore-monospace-collections.js contains runtime collection definitions.$rstore-monospace-items.d.ts contains generated item interfaces.$rstore-monospace-collections.d.ts contains typed collection declarations.$rstore-monospace-config.js contains runtime URL, project, optional API key, and scope id.@rstore/nuxt.addCollectionImport.addPluginImport.useMonospace().url or project skips collection generation with a warning.schemaApiKey server-side/build-time.runtimeApiKey only when the value is safe to expose through generated runtime config.input plus metadataInput for checked-in or separately generated schemas; generation needs both the OpenAPI document and the schema metadata.rstore-monospace for shared OpenAPI, REST, query, and mutation behavior.rstore-nuxt for base Nuxt rstore module behavior and rstore-vue for query/form/cache semantics.