Skip to content

The config file

Use seampact.config.yaml (an app’s config) to tell seampact where your contracts are, what to generate and what to check. Run the commands in the app folder. This page shows the three keys you set first; every key is in the Config reference.

Put seampact.config.yaml in the root of your app, next to its build file: package.json, build.gradle.kts or pom.xml, composer.json or pyproject.toml. Every path in it is relative to that file. The command reads it from the folder you run it in.

outDir is the one folder for all generated code. Without it, seampact writes to __generated__ beside the config.

outDir: src/__generated__

Each target writes to a subfolder named after its id. Set out on a target to rename it. Each stack uses its own folder: see Generated files.

A source is a name and a place. A local folder:

sources:
notes:
path: ./contract

notes here is the name of the source. A target’s apis lists api names, the name: under api: in the contract. In this guide both are notes.

A contract published by another team, pinned to a version (see sharing contracts). integrity is optional and starts with sha256-.

sources:
notes:
package: "@acme/notes-contract"
version: 1.2.0
integrity: sha256-...

Where the files go, whether you commit them and who runs generate depends on the stack.

Stack outDir Commit it? Who runs generate
Node servers and clients src/__generated__ Yes You, or a script: seampact generate
Spring Boot, Gradle A folder under build/, such as build/generated/sources/seampact/main No The build: ./gradlew build
Spring Boot, Maven target/generated-sources/seampact No The build: ./mvnw verify
Laravel app/Generated Yes You: vendor/bin/seampact generate
Symfony src/Generated Yes You: vendor/bin/seampact generate
FastAPI, Django REST Framework, Django Ninja generated Yes You: seampact generate

A folder you commit is the one seampact check compares with the contract in CI: Check in CI. Never edit it by hand. The Gradle check skips an outDir under build/, since nobody commits it. outDir is __generated__ when you do not set it.

A Node entry lists the apis in apis: [notes]. Every other entry names one api in api: notes and has no link.

Stack use Apis
NestJS, Express, Fastify, Hono, AdonisJS "@seampact/codegen-nestjs", -express, -fastify, -hono, -adonis apis: [notes]
Spring Boot io.github.jubasse:seampact-spring-boot api: notes
Laravel seampact/laravel api: notes
Symfony seampact/symfony api: notes
FastAPI, DRF, Ninja pypi:seampact-fastapi, pypi:seampact-drf, pypi:seampact-ninja api: notes

The full entry of each server is in its guide: server guides.

outDir: src/__generated__
sources:
notes:
path: ./contract
targets:
- { id: server, use: "@seampact/codegen-nestjs", apis: [notes] }
checks:
generated: error