Skip to main content

Getting Started

This set of articles covers the core fundamentals of Pikku. To understand how Pikku operates, we'll go over the express-middleware setup.

Prerequisites

Ensure that Node.js (version >= 18) is installed on the operating system.

Setup

Begin by installing the starter project using npm create:

npm create pikku@latest

Which will then guide you through starting a project:

Core Files

Here's a brief overview of there core files:

FileDescription
start.tsuWebsocketServer / entry point
services.tsContains all the Pikku services management
channels.tsWebsockets
http.tsHTTP Endpoints
scheduled-tasks.tsCron Jobs
types/application-types.d.tsApplication types

The config file

The pikku.config.json file is used to drive the pikku CLI tool.

info

The pikku CLI tool is used to:

  • Index all your API routes.
  • Generate the route schemas.
  • Create typescript declaration files to aid developers.

For more info you can checkout the CLI documentation.

pikku.config.json
loading...

Generated Files

The two files we use within our code are pikku-bootstrap.gen.ts and pikku-types.gen.ts. The rest are generated in order to create types to improve your developer experience, as well as documentation and schemas to validate input against.

Core Files
FileDescription
pikku-schemas/Directory containing all validation schemas
pikku-bootstrap.gen.tsMain bootstrap file that imports all required files
pikku-types.gen.tsTypeScript type definitions for the application
pikku-functions.gen.tsGenerated function definitions
pikku-functions-meta.gen.tsMetadata for all functions
pikku-rpc-meta.gen.tsRPC metadata
pikku-rpc-map.gen.tsRPC mapping definitions
pikku-bootstrap-*.gen.tsEvent-specific bootstrap files
Transport Files
FileDescription
pikku-http-routes.gen.tsHTTP route definitions
pikku-http-routes-meta.gen.tsHTTP route metadata
pikku-http-routes-map.gen.d.tsTypeScript declarations for HTTP route mapping
pikku-channels.gen.tsWebSocket channel definitions
pikku-channels-meta.gen.tsChannel metadata
pikku-channels-map.gen.d.tsTypeScript declarations for channel mapping
pikku-schedules.gen.tsScheduled task definitions
pikku-schedules-meta.gen.tsScheduled task metadata