Adds a sidecar folder - a source folder that builds a process you handle yourself.
sh
pnpm sidecar mailerIt is kosmo folder's counterpart: same scaffolding, none of the web questions.
What you get
txt
src/mailer/
├── kosmo.config.ts -> the sidecar block
├── tsconfig.json -> extends ../../var/lib/mailer/tsconfig.json
├── entry.ts -> defineService({ start, teardown })
└── run.ts -> imports the entry, starts it, stops it on a signalThe entry is the service; the runner is how it is supervised in production - the dev server imports the entry itself and never uses the runner.
Like any other folder it ships with a kosmo.config.ts file where you adjust the things:
ts
import { defineConfig } from "@kosmojs/dev";
export default defineConfig({
sidecar: {
entry: "./entry.ts",
run: "./run.ts",
serve: false,
},
typecheck: true,
});One sidecar per folder
That is what keeps the build output, the dev watcher and pnpm build <name> addressable per process. Mixing a sidecar into a HTTP folder is not recommended. Details ›