Resource configuration in the
nuxt-auto-crud stackmanages the serialization boundary between your Drizzle schema and the JSON API. While the Core Engine enforces data protection viagetZodSchema, the Template Implementation configures visibility tiers for Guests and Authenticated users.
The system categorizes field visibility into three distinct logical tiers.
| Tier | Logic Source | Target Audience |
|---|---|---|
| System Hidden | Core Engine (HIDDEN_FIELDS) | Never exposed (e.g., password, token). |
| Guest View | nuxt.config.ts (resources) | Public, unauthenticated users. |
| Global UI Hide | app.config.ts (globalHide) | Authenticated UI (e.g., id, updatedAt). |
Configure public field whitelists in nuxt.config.ts to prevent data leakage to guests.
For Guest access to work, ensure the public role has list permissions for the specific resource in the Admin Dashboard.
// nuxt.config.ts [Core Engine]
autoCrud: {
resources: {
// Whitelist: Only these columns are serialized for Guests
users: ['id', 'name', 'avatar'],
blog_posts: ['id', 'title', 'content', 'createdAt']
}
}
Use app.config.ts to manage how data is presented in the reference admin interface.
The globalHide array prevents specific system columns from cluttering the data tables.
// app.config.ts [Template Implementation]
crud: {
globalHide: ['updatedAt', 'deletedAt', 'createdBy', 'updatedBy', 'resetToken'],
}
Refine data extraction boundaries for PDF and Excel generation.
| Type | Config Path | Scope |
|---|---|---|
crud.exports.pdf | High-fidelity document generation. | |
| Excel | crud.exports.excel | Raw data analysis/spreadsheet. |
PROTECTED_FIELDS (e.g., id, createdAt) are stripped from POST/PATCH payloads by the engine.password, secret) are excluded from the SELECT result set via filterHiddenFields before the response is dispatched.