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.d.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.

The generated files, not needed for quick start.
FileDescription
pikku-schemas/The directory that contains all the schemas we'll validate calls against
pikku-schemas/register.tsImports all the schemas and adds them to pikku
pikku-bootstrap.tsImports the required files into our runtime
pikku-routes.tsImports all the files with routes in them
pikku-types.d.tsProvides types to be used in the application