TurboKit
Backend

Elysia.js

Backend API with Elysia.js

Elysia.js Backend

TurboKit uses Elysia.js - a high-performance TypeScript web framework for Bun.

Features

  • Type Safety - End-to-end type inference
  • Performance - Fast execution with Bun runtime
  • OpenAPI - Auto-generated API documentation
  • Validation - Built-in request validation

Directory Structure

apps/api/
├── src/
│   ├── index.ts          # Main entry point
│   └── routes/
│       ├── auth.ts       # Authentication routes
│       ├── health.ts     # Health check routes
│       └── users.ts      # User CRUD routes
├── tsconfig.json
└── package.json

Development

# Start only the API
cd apps/api && bun run dev

The API runs on http://localhost:4101.

Main Entry Point

// src/index.ts
import { Elysia } from "elysia";
import { openapi } from "@elysiajs/openapi";
import { cors } from "@elysiajs/cors";

const app = new Elysia()
  .use(cors({ origin: "http://localhost:4100" }))
  .use(
    openapi({
      documentation: {
        info: { title: "TurboKit API", version: "1.0.0" },
      },
    })
  )
  .get("/", () => ({ message: "Welcome to TurboKit API" }))
  .listen(4101);

export type App = typeof app;

API Endpoints

MethodEndpointDescription
GET/API info
GET/healthHealth check
GET/openapiSwagger UI
POST/auth/loginUser login
POST/auth/registerUser registration
GET/usersList users
GET/users/:idGet user by ID

Tip: Visit localhost:4101/openapi for interactive API documentation.

On this page