npm.io
0.0.1-alpha.7 • Published 4 months ago

@ghentcdh/crouton-api

Licence
—
Version
0.0.1-alpha.7
Deps
0
Size
900 kB
Vulns
0
Weekly
0
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-forms-vue crouton-cli create-crouton

Documentation · llms.txt · llms-full.txt


Work in progress — crouton is still in active development. APIs, schemas, and components may change without notice; use at your own risk until a stable release is published.

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 in development
@ghentcdh/crouton-vue Vue 3 component library — renders data tables, forms, filters, and views driven by the schemas in development
@ghentcdh/crouton-forms-vue Standalone <CroutonForm> component — embed a crouton form anywhere without the full admin UI in development
@ghentcdh/crouton-editor-vue Dev-mode resource editor UI — visual builder and ResourceJsonEditor component in development
@ghentcdh/crouton-core Shared browser-safe foundation — schema builders, filter models, request/response types in development
@ghentcdh/crouton-codegen Shared Node-only codegen tooling — Prisma introspection, scaffolding, shell wrappers in development
@ghentcdh/crouton-prisma Prisma data-source adapter and Prisma-specific utilities in development
@ghentcdh/crouton-cli crouton CLI — create-datasource, update resources, and dev server commands in development
@ghentcdh/create-crouton npm create @ghentcdh/crouton scaffolder — bootstraps a new project in development
@ghentcdh/add-crouton npx @ghentcdh/add-crouton — adds crouton to an existing project in development

How it works

  1. Define your resource in a resource.json file — columns, operations, filters, 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
{
  "name": "author",
  "route": "authors",
  "model": "author",
  "operations": {
    "findAll": true,
    "findOne": true,
    "create": true,
    "update": true
  },
  "columns": {
    "id": {
      "hiddenInForm": true,
      "idField": true
    },
    "name": {
      "searchable": true,
      "filterable": true
    },
    "bio": {
      "fieldInput": {
        "type": "textarea"
      }
    }
  }
}

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

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
npx nx run-many -t build

# Typecheck
npx nx run-many -t typecheck
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-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)
Documentation

The docs site is built with VuePress. Each package documents itself in packages/<name>/docs/; the site is assembled from those files.

# Serve the docs locally
pnpm docs:serve

# Build the docs site
pnpm docs:build


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