Overview

Quick Start

Teakit is optimized for Bun which is a JavaScript runtime that aims to be a drop-in replacement for Node.js.

You can install Bun with the command below:

curl https://bun.sh/install | bash

System Requirements

  • Bun
  • MacOS, Windows (including WSL), and Linux are supported.
  • TypeScript > 5.0 (for language server)

Automatic Installation

We recommend starting a new Teakit Application using bun create teakit, which sets up everything automatically.

bun create teakit service

Once done, you should see the folder name app in your directory.

cd service

Start a development server by:

bun dev

Navigate to localhost:3000 should greet you with "Hello World".

Manual Installation

To manually create a new Teakit Application, install @teakit/core as a package:

bun add @teakit/core

Open your package.json file and add the following scripts:

{
"scripts": {
"dev": "bun --watch src/index.ts",
"build": "bun build src/index.ts",
"start": "NODE_ENV=production bun src/index.ts",
"test": "bun test"
}
}

These scripts refer to the different stages of developing an application:

  • dev - Start Teakit in development mode with auto-reload on code change.
  • build - Build the application for production usage.
  • start - Start an Teakit production server.

If you are using TypeScript, make sure to create, and update tsconfig.json to include compilerOptions.strict to true:

{
"compilerOptions": {
"strict": true
}
}

Service Structure

Here's the recommended file structure for Teakit project if you don't strictly prefer a specific convention:

  • src - Any file that associate with development of Teakit server.
    • index.ts - Entry point for your Teakit server, ideal place for setting global plugin
    • setup.ts - Composed of various plugins to be used as a Service Locator
    • controllers - Instances which encapsulate multiple endpoints
    • utils - Utility functions
    • models - Data Type Objects (DTOs) for Teakit instance
    • types - Shared TypeScript type if needed
  • tests - Test file for Teakit server

Congrats! You've just created a new web server with teakit.