Skip to main content
Deployment

Same codebase.
Any deployment.

Pikku's CLI scans your function signatures and filters by routes, tags, or types — generating entry points with only the functions and services each deployment needs.

How It Works

Three flags. Infinite architectures.

The same source code becomes a monolith, microservices, or individual functions — just by changing CLI flags.

1

CLI scans destructuring

Pikku analyzes which services each function, middleware, and permission actually destructures from the services parameter.

2

Filter with CLI flags

Use --http-routes, --tags, or --types to include only the functions your deployment needs. Everything else is excluded.

3

Generates entry points

The CLI produces typed entry files with only the needed functions, routes, and services — ready to deploy.

--http-routes=/admin

Only include functions mapped to admin routes

$ pikku --http-routes=/admin --http-routes=/auth
--tags=payments

Only include functions tagged "payments"

$ pikku --tags=payments --tags=billing
--types=http

Only include HTTP wire functions

$ pikku --types=http --types=cron

Architectures

One codebase, three shapes.

No code changes. Just different CLI flags for different deployments.

Monolith

Run everything in one process

$ pikku
~2.8 MB
All functions, all protocols

Microservices

Split by domain or feature

$ pikku --http-routes=/admin
$ pikku --tags=admin
~180 KB
Only admin routes + dependencies

Functions

One function per deployment

$ pikku --http-routes=/users/:id --types=http
~50 KB
Single endpoint + minimal runtime

Service Loading

Only load what you actually use.

The CLI generates a requiredSingletonServices map. Guard heavy imports with dynamic import() — unused services never load.

.pikku/pikku-services.gen.tsauto-generated
// .pikku/pikku-services.gen.ts  (auto-generated)
export const requiredSingletonServices = {
'database': true, // used by getUser, deleteUser
'audit': true, // used by deleteUser
'cache': false, // not used by any wired function
'jwt': true, // used by auth middleware
} as const
services.tsyour code
import { requiredSingletonServices } from '.pikku/pikku-services.gen.js'

export const createSingletonServices = pikkuServices(
async (config) => {
const logger = new ConsoleLogger()

// Only create JWT if wired functions actually need it
let jwt: JWTService | undefined
if (requiredSingletonServices.jwt) {
const { JoseJWTService } = await import('@pikku/jose')
jwt = new JoseJWTService(keys, logger)
}

return { config, logger, jwt }
}
)

Faster cold starts

Health-check endpoints don't load your database driver. Payment endpoints don't load your email SDK.

Same codebase

Deploy as monolith, microservices, or individual functions — filter with CLI flags, no code changes.

Type-safe

RequiredSingletonServices narrows your factory return type so TypeScript catches missing services at compile time.

Deploy your way

One codebase, any architecture. Start building with tree-shaking from day one.

$ npm create pikku@latest