Pikku
Pikku - meaning tiny ð in Finnish - is a minimalistic batteries included framework built around simple functions. It works with any event driven design (currently http, websockets and scheduled tasks) and can be run on any Javascript runtime, currently Cloudflare Workers, Fastify, Bun, AWS Lambda, Express, uWS, WS and others.
- HTTP
- Scheduled Task
- Channel
const helloWorld: APIFunction<
{ language: 'en' | 'es' },
string
> = async (
services, data, session
) => {
if (language === 'en') {
return `Hey ${session.username}!`
} else {
return `Ola ${session.username}!`
}
}
// Register it as a HTTP Route
addRoute({
method: 'get',
route: '/',
func: helloWorld
})
const cronJob: APIFunctionSessionless = async (
services
) => {
services.logger.info(`Crob job ran!`)
}
// Register it as a Scheduled Task
addScheduledTask({
name: 'helloWorld',
schedule: '* * * * 1',
func: cronJob,
})
const cronJob: APIFunctionSessionless = async (services) => {
services.logger.info(
`Crob job ran!`
)
}
// Register it as a Scheduled Task
addScheduledTask({
name: 'helloWorld',
schedule: '* * * * 1',
func: cronJob,
})
const onMessage: ChannelMessage<
'hello', 'hey'
> = async (
services, channel
) => {
services.logger.info(
`Hello from ${channel.id}`
)
channel.send('hey')
}
// Register it as a channel
addChannel({
name: 'events',
route: '/',
onMessage
})
export const onMessage: ChannelMessage<'hello', 'hey'> = async (
services, channel
) => {
services.logger.info(`Hello from ${channel.id}`)
channel.send('hey')
}
// Register it as a channel
addChannel({
name: 'events',
route: '/',
onMessage
})
Quick Startâ
- npm
- Yarn
- pnpm
- Bun
npm create pikku
npm create pikku
# couldn't auto-convert command
npm create pikku
# couldn't auto-convert command
bunx create-pikku
Featuresâ
- Tiny ð - The Pikku footprint is minimal. It currently relies on two small dependencies cookie and path-to-regex.
- Deploy Anywhere ð - Run your functions anywhere, as long as it's event based. Currently supporting HTTP, WebSockets and Scheduled Tasks with more coming soon.
- Batteries Included ð - Services, session management, auth, docs, it's all here..
- Zero Boilerplate ðŠķ - Only write business logic in Typescript, Pikku automatically optimizes, validates and generates everything needed in a powerful framework.