Skip to content

REST API

From data model to REST API, without writing the API

Dominik Strasser, Co-Founder of dcupl GmbH

Dominik Strasser
Co-Founder, dcupl

Once your data model is in dcupl, the REST API is not a project. It is a deployment. An instance on an app runner loads your application once and answers queries, facets, aggregations and pivots for every model over HTTP, with an OpenAPI document and an API key. Your own routes come from scripts.

  • REST API
  • RAPI
  • data model
The routes of a deployed dcupl REST API instance: query, facet, aggregate, pivot and suggest for the Product model, a status route and a scripted endpoint orders-summary.

Ask a backend team how long a read API over a product catalog takes and the honest answer is: it depends on how many questions the frontend will ask. Filter by category. Facet by brand with counts. Average price per material. A pivot of sizes against colors. Type-ahead on the name. Each question is a route, a query, a test and a deployment.

dcupl's REST API, RAPI for short, answers those questions for every model you have, from the data model alone.

What you get on deploy

A REST API template is a small JSON file in your project: a key, a name, an API key, and which application and environment of your project to load. You create it in the Console, or with dcupl generate api from the CLI. Then you deploy it to an app runner. The runner starts an instance, loads the application once and reports ready.

From that moment every model of the application has its endpoints: query for filtered lists, facet for the counts behind a filter sidebar, aggregate for sums, averages and ranges, pivot for two-dimensional tables, suggest for type-ahead, and metadata for the model itself. The instance also serves an OpenAPI document, so the frontend team can explore the API before the first line of client code exists.

The same model everywhere

The point is not that the routes are generated. It is that they answer against the same model your frontend uses with the SDK and your coding agent reads with the CLI. A query that works in the browser works against the REST API, because both run the same engine on the same data.

That is what makes the API cheap to trust. There is no second implementation of the filter logic in the backend that drifts from the first one.

Authentication, caching and status

One API key per template, sent as a header or a query parameter. A template without a key deploys an open instance, which is fine for a public catalog and wrong for everything else, so the docs say so twice.

The version guard is for caching. When it is on, every request carries the instance's current version. The version changes with every update of the instance, so a CDN or a browser can cache a response as long as it wants: an outdated version is refused, and the client fetches the new one.

The status route tells you what the instance loaded, which version it is on, and, when a start failed, why. It is the first thing to check when an answer looks wrong.

Your own routes, from scripts

The generated endpoints cover the questions a model can answer by itself. The ones it cannot, you write as scripts. A scripted endpoint is a route under the instance's endpoints/ prefix, declared in the template and answered by a JavaScript file in your project. The script runs inside the instance with read-only access to its data and returns the response body.

An order summary per customer, a price list in exactly the shape the ERP expects, a recommendation that combines three models: each is one script, tested in the Console's run panel against the loaded application before anything is deployed. The CLI scaffolds the script and the template entry in one command. Scripted endpoints are part of a paid plan.

What it leaves out on purpose

The REST API is read-only. It does not write to your data, and it does not pretend to be your system of record. Writes go through workflows, which stage changes and build them when someone approves, or through your own backend.

It also does not replace your existing API. Several customers put a dcupl REST API next to the API they already have and route the expensive read queries, the facets and the pivots, to the instance. The existing API keeps the writes and the business logic. Both read the same model.

Where it goes next

Where it is turned on, a deployed instance can also be an MCP server: one more route that lets a coding agent query the same data with the same API key, read-only. That is the subject of a later article. The REST API docs have the template format, the endpoints and the deploy steps.

Your data model already knows the answers. Deploy it.

Give your agent the real data.

npm install -g @dcupl/cli