Skip to main content

Configuration

The pikku.config.json file configures how the Pikku CLI scans your codebase and generates files.

Minimal Configuration

{
"tsconfig": "./tsconfig.json",
"srcDirectories": ["src"],
"outDir": ".pikku"
}

Configuration Options

Core Options

OptionTypeRequiredDescription
tsconfigstringPath to TypeScript configuration file
srcDirectoriesstring[]Directories to scan for Pikku functions and wirings
outDirstringWhere generated files are written (default: .pikku)
rootDirstringRoot directory for resolving paths (default: config file directory)
$schemastringJSON schema URL for editor autocomplete

Client Generation

OptionTypeDescription
fetchFilestringGenerate type-safe HTTP client (fetch-based)
websocketFilestringGenerate type-safe WebSocket client
queueFilestringGenerate type-safe queue client
rpcWiringsFilestringGenerate type-safe RPC client
nextBackendFilestringGenerate Next.js backend integration
nextHTTPFilestringGenerate Next.js HTTP route handler

Example:

{
"fetchFile": "sdk/pikku-fetch.gen.ts",
"websocketFile": "sdk/pikku-websocket.gen.ts",
"queueFile": "sdk/pikku-queue.gen.ts",
"rpcWiringsFile": "sdk/pikku-rpc.gen.ts"
}

Workflows

Configure workflow execution mode and queue settings.

Single Queue Mode:

OptionTypeDescription
workflows.singleQueuetrueUse single queue for all workflows
workflows.pathstringOutput path for generated workflow types
workflows.orchestratorQueuestringOptional custom orchestrator queue name
workflows.workerQueuestringOptional custom worker queue name

Example (Single Queue):

{
"workflows": {
"singleQueue": true,
"path": "src/workflows/pikku.workflows.gen.ts",
"orchestratorQueue": "pikku-workflow-orchestrator",
"workerQueue": "pikku-workflow-worker"
}
}

CLI

Configure CLI entrypoints. Each CLI can have multiple execution modes: local (direct command-line), channel (remote via WebSocket), or a simple string path.

OptionTypeDescription
cli.entrypointsobjectMap of CLI names to their configuration(s)

Entrypoint types:

  • string - Simple path to wiring file
  • { type: 'local', path: string } - Local CLI execution
  • { type: 'channel', wirePath: string, name?: string, route?: string, path?: string } - Remote CLI via WebSocket
  • Array of any above types - Multiple execution modes for one CLI

Example:

{
"cli": {
"entrypoints": {
"my-cli": [
{
"type": "local",
"path": "src/cli-local.ts"
},
{
"type": "channel",
"wirePath": "src/cli-channel.ts",
"name": "cli",
"route": "/cli",
"path": "src/cli-remote.ts"
}
],
"simple-cli": "src/simple-cli.ts"
}
}
}

Filtering

OptionTypeDescription
filters.tagsstring[]Only include functions/wirings with these tags
filters.typesstring[]Only include these wiring types: http, channel, queue, scheduler, rpc, mcp, cli
filters.directoriesstring[]Only scan these directories

Example:

{
"filters": {
"tags": ["api", "public"],
"types": ["http", "rpc"],
"directories": ["src/api"]
}
}

Monorepo Support

OptionTypeDescription
packageMappingsobjectMap local paths to published package names

Example:

{
"packageMappings": {
"packages/sdk": "@my-app/sdk",
"packages/functions": "@my-app/functions"
}
}

This ensures generated imports use @my-app/sdk instead of relative paths like ../../packages/sdk.

OpenAPI Generation

OptionTypeDescription
openAPI.outputFilestringWhere to write OpenAPI spec (.yml or .json)
openAPI.additionalInfo.infoobjectAPI metadata (title, version, description)
openAPI.additionalInfo.serversarrayServer URLs
openAPI.additionalInfo.tagsarrayTag descriptions
openAPI.additionalInfo.securitySchemesobjectSecurity scheme definitions
openAPI.additionalInfo.securityarrayGlobal security requirements

Example:

{
"openAPI": {
"outputFile": "openapi.yml",
"additionalInfo": {
"info": {
"title": "My API",
"version": "1.0.0",
"description": "API documentation"
},
"servers": [
{ "url": "https://api.example.com", "description": "Production" },
{ "url": "http://localhost:3000", "description": "Development" }
]
}
}
}

Advanced Options

OptionTypeDescription
extendsstringExtend another Pikku config file
supportsImportAttributesbooleanEnable import attributes for schema imports (TypeScript 5.3+)

Example Configurations

Monorepo with Shared SDK

{
"tsconfig": "./tsconfig.json",
"srcDirectories": ["packages/functions/src"],
"outDir": "packages/functions/.pikku",
"fetchFile": "packages/sdk/.pikku/pikku-fetch.gen.ts",
"websocketFile": "packages/sdk/.pikku/pikku-websocket.gen.ts",
"packageMappings": {
"packages/sdk": "@my-app/sdk",
"packages/functions": "@my-app/functions"
}
}

Next.js Application

{
"tsconfig": "./tsconfig.json",
"srcDirectories": ["./backend"],
"outDir": "./backend/.pikku",
"nextBackendFile": "./pikku-nextjs.ts"
}

Filtered Build (Public API Only)

{
"tsconfig": "./tsconfig.json",
"srcDirectories": ["src"],
"outDir": ".pikku",
"filters": {
"tags": ["public"],
"types": ["http"]
}
}

Next Steps