How It Works
Three flags. Infinite architectures.
The same source code becomes a monolith, microservices, or individual functions — just by changing CLI flags.
CLI scans destructuring
Pikku analyzes which services each function, middleware, and permission actually destructures from the services parameter.
Filter with CLI flags
Use --http-routes, --tags, or --types to include only the functions your deployment needs. Everything else is excluded.
Generates entry points
The CLI produces typed entry files with only the needed functions, routes, and services — ready to deploy.
--http-routes=/adminOnly include functions mapped to admin routes
--tags=paymentsOnly include functions tagged "payments"
--types=httpOnly include HTTP wire functions
Architectures
One codebase, three shapes.
No code changes. Just different CLI flags for different deployments.
Monolith
Run everything in one process
Microservices
Split by domain or feature
Functions
One function per deployment
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.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
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.