Generated Files
When you run pikku, the CLI writes a set of generated files into your outDir (default: .pikku/). These files wire everything together β types, metadata, schemas, registration, and service maps. You import from them via the #pikku alias and never edit them by hand.
The #pikku Import Aliasβ
Your package.json maps #pikku to the generated output directory:
{
"imports": {
"#pikku/*": "./.pikku/*"
}
}
This lets you write clean imports throughout your code:
import { pikkuFunc, wireHTTP } from '#pikku'
Instead of fragile relative paths like ../../.pikku/function/pikku-function-types.gen.js.
Directory Structureβ
.pikku/
βββ pikku-bootstrap.gen.ts # Master import β registers everything
βββ pikku-types.gen.ts # Re-exports all wiring-specific types
βββ pikku-services.gen.ts # Service dependency map
βββ pikku-meta-service.gen.ts # Meta service for Console
β
βββ function/
β βββ pikku-function-types.gen.ts # pikkuFunc, pikkuSessionlessFunc, etc.
β βββ pikku-functions.gen.ts # Function registration calls
β βββ pikku-functions-meta.gen.ts # Function metadata (runtime)
β βββ pikku-functions-meta.gen.json # Function metadata (static)
β
βββ http/
β βββ pikku-http-types.gen.ts # wireHTTP and related types
β βββ pikku-http-wirings.gen.ts # HTTP route registration
β βββ pikku-http-wirings-meta.gen.ts
β βββ pikku-http-wirings-map.gen.d.ts # Typed route map
β
βββ channel/
β βββ pikku-channel-types.gen.ts # wireChannel types
β βββ pikku-channels.gen.ts # Channel registration
β βββ pikku-channels-meta.gen.ts
β βββ pikku-channels-map.gen.d.ts # Typed channel map
β
βββ rpc/
β βββ pikku-rpc-wirings-map.gen.d.ts # Public RPC type map
β βββ pikku-rpc-wirings-map.internal.gen.d.ts # Internal RPC type map
β βββ pikku-rpc-wirings-meta.internal.gen.ts # RPC metadata
β βββ pikku-rpc-wirings-meta.internal.gen.json
β
βββ queue/
β βββ pikku-queue-types.gen.ts # wireQueueWorker types
β βββ pikku-queue-workers-wirings.gen.ts
β βββ pikku-queue-workers-wirings-meta.gen.ts
β βββ pikku-queue-workers-wirings-map.gen.d.ts
β
βββ scheduler/
β βββ pikku-scheduler-types.gen.ts # wireScheduler types
β
βββ workflow/
β βββ pikku-workflow-types.gen.ts # Typed workflow definitions
β βββ pikku-workflow-wirings.gen.ts # Workflow registration
β βββ pikku-workflow-wirings-meta.gen.ts
β βββ pikku-workflow-map.gen.d.ts # Typed workflow map
β βββ meta/ # Per-workflow JSON metadata
β βββ myWorkflow.gen.json
β βββ myWorkflow-verbose.gen.json
β
βββ agent/
β βββ pikku-agent-types.gen.ts # pikkuAIAgent type helper
β βββ pikku-agent-wirings.gen.ts # Agent registration
β βββ pikku-agent-wirings-meta.gen.ts
β βββ pikku-agent-wirings-meta.gen.json
β βββ pikku-agent-map.gen.d.ts # Typed agent map
β
βββ mcp/
β βββ pikku-mcp-types.gen.ts # MCP wiring types
β βββ pikku-mcp-wirings.gen.ts
β βββ pikku-mcp-wirings-meta.gen.ts
β
βββ cli/
β βββ pikku-cli-types.gen.ts # wireCLI, pikkuCLICommand types
β βββ pikku-cli-wirings.gen.ts
β βββ pikku-cli-wirings-meta.gen.ts
β βββ pikku-cli-bootstrap.gen.ts
β
βββ trigger/
β βββ pikku-trigger-types.gen.ts # wireTrigger types
β βββ pikku-trigger-wirings.gen.ts
β βββ pikku-trigger-wirings-meta.gen.ts
β
βββ gateway/
β βββ pikku-gateway-wirings.gen.ts # Gateway registration
β
βββ middleware/
β βββ pikku-middleware.gen.ts # Middleware registration
β βββ pikku-middleware-groups-meta.gen.json
β
βββ permissions/
β βββ pikku-permissions.gen.ts
β βββ pikku-permissions-groups-meta.gen.json
β
βββ schemas/
β βββ register.gen.ts # Schema registration
β βββ schemas/ # Individual JSON schema files
β
βββ secrets/
β βββ pikku-secret-types.gen.ts # Typed secret definitions
β βββ pikku-secrets.gen.ts # Typed SecretService wrapper
β βββ pikku-secrets-meta.gen.json
β
βββ variables/
β βββ pikku-variable-types.gen.ts # Typed variable definitions
β βββ pikku-variables.gen.ts # Typed VariablesService wrapper
β βββ pikku-variables-meta.gen.json
β
βββ credentials/
β βββ pikku-credentials.gen.ts # Typed credential wrappers
β βββ pikku-credentials-meta.gen.json
β
βββ addon/
β βββ pikku-package.gen.ts # Addon package registration
β βββ pikku-addon-types.gen.ts # Addon config/service types
β
βββ console/
βββ pikku-node-types.gen.ts # Console node types
βββ pikku-addon-meta.gen.json # Addon metadata for Console
Not every directory is generated for every project β only the ones relevant to your wirings. If you don't use workflows, there's no workflow/ directory.
Key Filesβ
pikku-bootstrap.gen.tsβ
The master entry point. Importing this file registers all your functions, wirings, metadata, middleware, schemas, and addon bootstraps. Your runtime entry point should import it before doing anything else:
import './.pikku/pikku-bootstrap.gen.js'
pikku-types.gen.tsβ
Re-exports all the type helpers you use in your code β pikkuFunc, pikkuSessionlessFunc, wireHTTP, wireChannel, pikkuAIAgent, etc. This is what #pikku resolves to when you write:
import { pikkuFunc } from '#pikku'
pikku-services.gen.tsβ
Maps which singleton and wire services your project actually uses. The CLI detects this by analyzing which services your functions destructure. This powers:
- Type narrowing β
RequiredSingletonServicesonly requires the services you use - Deploy analysis β the deploy pipeline knows what infrastructure each function needs
- Validation β the Console warns if a required service isn't provided
Function Types (function/pikku-function-types.gen.ts)β
This is the big one. It generates type-safe function constructors that are parameterized with your project's specific UserSession, SingletonServices, Services, and Config types:
// These come from your application-types.d.ts
import type { UserSession } from '../../src/application-types.d.js'
import type { SingletonServices } from '../../src/application-types.d.js'
import type { Services } from '../../src/application-types.d.js'
// The generated pikkuFunc knows your exact types
export function pikkuFunc<In, Out>(config: {
func: (services: SingletonServices, data: In, wire: PikkuWire<In, Out, true, UserSession>) => Promise<Out>
// ...
}): { func: CorePikkuFunction<In, Out, SingletonServices, UserSession> }
This is why pikkuFunc "just works" with autocomplete for your services and session β the types are generated from your actual code.
Metadata Filesβ
Files ending in .gen.json contain static metadata used by:
- The Console β displays functions, routes, agents, workflows visually
- The deploy pipeline β analyzes what needs to be deployed
- OpenAPI generation β builds API specs from HTTP metadata
- MCP servers β exposes tool/resource/prompt catalogs
The .gen.ts counterparts register the same metadata at runtime.
Regenerationβ
Generated files are fully deterministic β same source code always produces the same output. You should:
- Add
.pikku/to.gitignoreβ regenerate in CI, don't commit - Run
pikkuin your build step β"prebuild": "pikku"inpackage.json - Use
pikku watchin development β files stay in sync as you edit
Next Stepsβ
- Configuration β Override output paths for any generated file
- Tree-Shaking β How filtering reduces generated output