Project Structure
A Zuplo project is a standard Node.js-style project managed via Git. Here is the typical layout:
Code
Core files
config/routes.oas.json
This is an OpenAPI 3.1 specification that defines your API routes. Each route
specifies the HTTP method, path, handler, and which policies to apply. Zuplo
extends the OpenAPI spec with x-zuplo-route to attach handlers and policies to
each operation.
Code
You can have multiple OpenAPI files. They are processed in alphabetical order during route matching.
See OpenAPI and Routing for details.
config/policies.json
This file defines policy instances by name, type, and configuration. Routes
reference policies by name in their policies.inbound and policies.outbound
arrays.
Code
zuplo.jsonc
Project-level configuration including the runtime compatibility date and deployment type.
Code
The projectType can be managed-edge, managed-dedicated, or self-hosted.
The compatibilityDate locks runtime behavior so updates don't break your
project unexpectedly.
See Project Configuration for all options.
modules/
Contains your custom TypeScript code for handlers and policies. These modules
are referenced from routes.oas.json and policies.json using
$import(./modules/...).
Code
docs/ (optional)
If you use the Zuplo Developer Portal, this directory contains the portal configuration and custom pages. See Developer Portal for details.
How the files relate
zuplo.jsoncsets project-wide configuration (runtime version, deployment type)config/routes.oas.jsondefines API routes and wires each route to a handler and policies by nameconfig/policies.jsondefines the named policy instances with their configuration and points to either built-in modules (@zuplo/runtime) or custom modules in./modulesmodules/contains the TypeScript implementations for custom handlers and policies
All of this lives in Git and deploys automatically when you push.
The $import() syntax
JSON configuration files (routes.oas.json and policies.json) use the
$import() syntax to reference code modules. This is a Zuplo-specific syntax
that resolves module references at build time.
Code
References starting with @zuplo/runtime point to built-in Zuplo modules
(policies, handlers, and utilities).
Code
References starting with ./modules/ point to your custom TypeScript files in
the modules/ directory. The export field specifies which named export to use
from that module.