npm.io
0.1.0 • Published 5d ago

@ghentcdh/crouton-api

Licence
MIT
Version
0.1.0
Deps
6
Size
15.5 MB
Vulns
0
Weekly
0
Stars
1
crouton

wrap your CRUD in one neat package.

Configure Resources Once, Use Them Over and Over, Naturally

Build Publish Publish Docs crouton-api crouton-vue crouton-cli create-crouton crouton-auth crouton-core crouton-prisma

Documentation · llms.txt · llms-full.txt


0.x release — crouton follows semver: within 0.x, patch releases don't break you, minor releases may, and every breaking change is listed in the migration guide (0.1 → 0.2, alpha → 0.1) with before/after examples. See Versioning.

A schema-driven CRUD framework for NestJS + Vue. Define your resources once in JSON — crouton handles the rest: API endpoints, data tables, forms, and filters.

Configure resources once. Use them over and over. No boilerplate, just filling.

Packages

Package Description Status
@ghentcdh/crouton-api NestJS library — generates controllers, repositories, and /schemas endpoints from a resource.json released
@ghentcdh/crouton-vue Vue 3 component library — renders data tables, forms, filters, and views driven by the schemas released
@ghentcdh/crouton-forms-vue Standalone <CroutonForm> component — embed a crouton form anywhere without the full admin UI bundled in crouton-vue
@ghentcdh/crouton-ui-vue Vue 3 UI primitives — shell, buttons, tables, modals, drawers, toasts, form controls bundled in crouton-vue
@ghentcdh/crouton-editor-vue Dev-mode resource editor UI — visual builder and ResourceJsonEditor component bundled in crouton-vue
@ghentcdh/crouton-core Shared browser-safe foundation — schema builders, filter models, request/response types released
@ghentcdh/crouton-codegen Shared Node-only codegen tooling — Prisma introspection, scaffolding, shell wrappers bundled in crouton-api / crouton-cli
@ghentcdh/crouton-prisma Prisma data-source adapter and Prisma-specific utilities released
@ghentcdh/crouton-auth Auth-provider definitions (defineAuthProvider, role guards, auth-provider.json schema) released
@ghentcdh/crouton-cli crouton CLI — update, create, init, validate, migrate released
@ghentcdh/create-crouton npm create @ghentcdh/crouton scaffolder — bootstraps a new project (crouton create project adds more) released
@ghentcdh/add-crouton npx @ghentcdh/add-crouton — adds crouton to an existing project not published yet
@ghentcdh/crouton-mcp MCP server — lets LLM agents query resources, validate configs, and search the docs not published yet

How it works

  1. Define your resource in a resource.json file — columns, operations, layout, relations
  2. Register it with crouton-api — fully typed NestJS routes appear automatically
  3. Connect the Vue components — tables, forms, and filters render from the schema with no extra config
{
  "$schema": "https://ghentcdh.github.io/crouton/schema/v1/resource.schema.json",
  "schemaVersion": 1,
  "name": "author",
  "route": "authors",
  "source": {
    "model": "Author"
  },
  "columns": {
    "id": {
      "idField": true,
      "hiddenInForm": true
    },
    "name": {},
    "bio": {
      "fieldInput": {
        "type": "textarea"
      }
    }
  },
  "operations": {
    "findAll": {
      "search": ["name"]
    },
    "findOne": true,
    "create": true,
    "update": true,
    "delete": false
  },
  "layout": {
    "table": {
      "filterFields": ["name"]
    }
  }
}

That's it. You get a searchable, paginated list endpoint, a detail endpoint, create/update with Zod validation, a /schemas response the Vue components consume, and a full admin UI with a filterable table — all from that one file.

The quickest way to start is the scaffolder — see Getting started:

npm create @ghentcdh/crouton my-app

Installation

# API (NestJS)
pnpm add @ghentcdh/crouton-api

# Vue
pnpm add @ghentcdh/crouton-vue

Development

This is an Nx monorepo with pnpm workspaces.

# Install dependencies
pnpm install

# Build all packages
pnpm nx run-many -t build

# Test, lint, typecheck
pnpm nx run-many -t test
pnpm nx run-many -t lint
pnpm nx run-many -t typecheck

A full example app lives in examples/book-collection.

Packages
packages/
  crouton-api/        — NestJS CRUD framework (@ghentcdh/crouton-api)
  crouton-vue/        — Vue 3 admin UI components (@ghentcdh/crouton-vue)
  crouton-forms-vue/  — standalone CroutonForm component (@ghentcdh/crouton-forms-vue)
  crouton-ui-vue/     — Vue 3 UI primitives (@ghentcdh/crouton-ui-vue)
  crouton-editor-vue/ — dev-mode visual resource editor (@ghentcdh/crouton-editor-vue)
  crouton-core/       — shared browser-safe types & builders (@ghentcdh/crouton-core)
  crouton-codegen/    — shared Node-only codegen/Prisma tooling (@ghentcdh/crouton-codegen)
  crouton-prisma/     — Prisma data-source adapter (@ghentcdh/crouton-prisma)
  crouton-cli/        — crouton CLI (@ghentcdh/crouton-cli)
  create-crouton/     — npm create scaffolder (@ghentcdh/create-crouton)
  add-crouton/        — npx add-crouton for existing projects (@ghentcdh/add-crouton)
  crouton-mcp/        — MCP server for LLM agents (@ghentcdh/crouton-mcp)
Documentation

The docs site is built with VuePress. Guides live in docs/guide/; the JSON Schema and the field-input reference under docs/guide/2.resources/field-inputs/_generated/ are generated by pnpm nx run crouton-core:build.

# Serve the docs locally
pnpm docs:serve

# Build the docs site
pnpm docs:build

Contributing

Contributions are welcome — please read CONTRIBUTING.md and our Code of Conduct. Found a security issue? See SECURITY.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Credits

Bo Vandersteene, Ghent University.

Development by Ghent Centre for Digital Humanities - Ghent University. Funded by the GhentCDH research projects.

GhentCDH