Three flags. Infinite architectures.
The same source code becomes a monolith, microservices, or individual functions — just by changing CLI flags.
Pikku analyzes which services each function, middleware, and permission actually destructures from the services parameter.
Use --http-routes, --tags, or --types to include only the functions your deployment needs. Everything else is excluded.
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
One codebase, three shapes.
No code changes. Just different CLI flags for different deployments.
Run everything in one process
Split by domain or feature
One function per deployment
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 }
}
)
Deploy your way.
One codebase, any architecture. Start building with tree-shaking from day one.