본문으로 건너뛰기
cccskills
무료GitHub에 공개

elysia

Build high-performance APIs with Elysia on Bun. Use when someone asks to "create an API with Bun", "build a REST API with Elysia", "set up WebSocket server on Bun", "type-safe API with Eden Treaty", "Elysia plugin", or "fastest TypeScript HTTP framework". Covers REST routes, WebSocket, validation with TypeBox, Eden Treaty type-safe client, plugins, auth guards, and OpenAPI/Swagger generation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md7.6 KB
  • _scores.json2.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Elysia

Overview

Elysia is a Bun-native HTTP framework built for speed and developer experience. End-to-end type safety from server to client via Eden Treaty, schema validation baked in, and performance that rivals Go/Rust frameworks. Think Express but with types, on Bun.

When to Use

  • Building REST APIs on Bun (instead of Express/Fastify)
  • Need end-to-end type safety — server defines routes, client auto-infers types
  • WebSocket server with typed messages
  • High-performance API that needs to handle 100K+ req/sec
  • Rapid prototyping with auto-generated OpenAPI/Swagger docs

Instructions

Getting Started

bun create elysia my-api
cd my-api
bun run dev

Basic REST API

// src/index.ts — Elysia REST API with validation
/**
 * Type-safe REST API using Elysia.
 * Body/query/params are validated at runtime AND typed at compile time.
 * No separate type definitions needed — schema IS the type.
 */
import { Elysia, t } from "elysia";

const app = new Elysia()
  // GET with typed query params
  .get("/users", async ({ query }) => {
    const { page, limit } = query;
    // page and limit are typed as numbers
    return { users: [], page, limit };
  }, {
    query: t.Object({
      page: t.Number({ default: 1 }),
      limit: t.Number({ default: 20, maximum: 100 }),
    }),
  })

  // POST with body validation
  .post("/users", async ({ body }) => {
    // body is typed as { name: string, email: string }
    const user = { id: crypto.randomUUID(), ...body, createdAt: new Date() };
    return user;
  }, {
    body: t.Object({
      name: t.String({ minLength: 2, maxLength: 100 }),
      email: t.String({ format: "email" }),
    }),
  })

  // Path params + response schema
  .get("/users/:id", async ({ params, error }) => {
    const user = await findUser(params.id);
    if (!user) return error(404, { message: "User not found" });
    return user;
  }, {
    params: t.Object({
      id: t.String({ format: "uuid" }),
    }),
  })

  // DELETE with auth guard
  .delete("/users/:id", async ({ params }) => {
    await deleteUser(params.id);
    return { deleted: true };
  }, {
    params: t.Object({ id: t.String() }),
    beforeHandle: ({ headers, error }) => {
      if (headers.authorization !== `Bearer ${process.env.ADMIN_TOKEN}`) {
        return error(401, { message: "Unauthorized" });
      }
    },
  })

  .listen(3000);

console.log(`🦊 Elysia running at ${app.server?.url}`);

WebSocket

// src/ws.ts — Type-safe WebSocket with Elysia
import { Elysia, t } from "elysia";

const app = new Elysia()
  .ws("/chat", {
    body: t.Object({
      type: t.Union([t.Literal("message"), t.Literal("ping")]),
      content: t.Optional(t.String()),
      room: t.String(),
    }),
    open(ws) {
      const room = ws.data.query.room || "general";
      ws.subscribe(room);
      ws.publish(room, JSON.stringify({ type: "system", content: `User joined ${room}` }));
    },
    message(ws, { type, content, room }) {
      if (type === "message" && content) {
        ws.publish(room, JSON.stringify({ type: "message", content, from: ws.id }));
      }
      if (type === "ping") {
        ws.send(JSON.stringify({ type: "pong" }));
      }
    },
    close(ws) {
      ws.unsubscribeAll();
    },
  })
  .listen(3000);

Eden Treaty — Type-Safe Client

// client.ts — Auto-typed API client generated from Elysia server
/**
 * Eden Treaty creates a fully typed client from your Elysia app type.
 * No codegen, no OpenAPI parsing — just TypeScript inference.
 */
import { treaty } from "@elysiajs/eden";
import type { App } from "./src/index";  // Import the app TYPE

const api = treaty<App>("localhost:3000");

// All methods, params, body, and responses are fully typed
const { data: users } = await api.users.get({ query: { page: 1, limit: 10 } });
//    ^? { users: User[], page: number, limit: number }

const { data: newUser } = await api.users.post({
  name: "Kai",
  email: "kai@example.com",
});
//    ^? { id: string, name: string, email: string, createdAt: Date }

const { error } = await api.users({ id: "bad-id" }).delete();
//    ^? { message: string } | null

Plugins and Middleware

// src/app.ts — Elysia with plugins
import { Elysia } from "elysia";
import { cors } from "@elysiajs/cors";
import { swagger } from "@elysiajs/swagger";
import { jwt } from "@elysiajs/jwt";

const app = new Elysia()
  .use(cors())
  .use(swagger({
    documentation: {
      info: { title: "My API", version: "1.0.0" },
    },
  }))
  .use(jwt({
    name: "jwt",
    secret: process.env.JWT_SECRET!,
    exp: "7d",
  }))
  // Auth guard as derive
  .derive(async ({ jwt, headers, error }) => {
    const token = headers.authorization?.replace("Bearer ", "");
    if (!token) return { user: null };
    const payload = await jwt.verify(token);
    if (!payload) return { user: null };
    return { user: payload as { id: string; email: string } };
  })
  // Protected route
  .get("/me", ({ user, error }) => {
    if (!user) return error(401, { message: "Not authenticated" });
    return user;
  })
  .listen(3000);

export type App = typeof app;

Group Routes

// src/routes/users.ts — Route group with shared prefix and guards
import { Elysia, t } from "elysia";

export const usersRoutes = new Elysia({ prefix: "/users" })
  .get("/", () => listUsers())
  .get("/:id", ({ params }) => getUser(params.id), {
    params: t.Object({ id: t.String() }),
  })
  .post("/", ({ body }) => createUser(body), {
    body: t.Object({
      name: t.String(),
      email: t.String({ format: "email" }),
    }),
  });

// Main app
import { Elysia } from "elysia";
import { usersRoutes } from "./routes/users";

const app = new Elysia()
  .use(usersRoutes)
  .listen(3000);

Examples

Example 1: Build a CRUD API with auth

User prompt: "Create a REST API for a todo app with JWT auth, input validation, and Swagger docs using Elysia on Bun."

The agent will create an Elysia app with JWT plugin, CRUD routes for todos with TypeBox validation, auth guards on mutation routes, and auto-generated Swagger at /swagger.

Example 2: Real-time chat server

User prompt: "Build a WebSocket chat server with rooms using Elysia."

The agent will set up Elysia WebSocket with typed messages, room subscription via pub/sub, and a REST endpoint to list active rooms.

Guidelines

  • Use t.Object() for all inputs — runtime validation + compile-time types in one declaration
  • Export the app type — export type App = typeof app enables Eden Treaty client
  • Group routes with new Elysia({ prefix }) — keeps route files modular
  • derive for auth — compute user from JWT once, available in all routes
  • beforeHandle for guards — return an error to short-circuit the request
  • Bun is required — Elysia uses Bun-specific APIs; it won't work on Node.js
  • Performance: Elysia handles 100K+ req/s — benchmark before adding middleware that might slow it down
  • Swagger plugin at /swagger — auto-generated from your route schemas, zero config

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Scripts and configures production rendering in Autodesk 3ds Max with the V-Ray and Corona renderers: output size and files, render elements, denoising, light mix, batch and command-line rendering, and network rendering. Use when a user asks to set up a production render, render several cameras in one batch, render from the command line or on a render farm, add render passes for compositing, or cut render time for archviz and product shots.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

Covers scripting Autodesk 3ds Max, the 3D modeling and rendering application, with MAXScript and Python (pymxs): scene manipulation, object creation, material assignment, camera and light setup, batch operations, and file I/O. Use when tasks involve automating repetitive 3ds Max workflows, batch processing scenes, running scripts headless with 3dsmaxbatch, creating custom tools, or scripting scene setup for archviz, product visualization, or VFX.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

3proxy

무료

3proxy is a small open-source proxy server that runs HTTP/HTTPS, SOCKS4/5, SNI and TCP/UDP port-mapping proxies from one config file. Use when a user asks to set up an HTTP or SOCKS5 proxy, add proxy users and passwords, write 3proxy access rules, chain or rotate upstream (parent) proxies, limit bandwidth, connections or monthly traffic per user, run 3proxy in Docker, or fix a 3proxy.cfg that will not start.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

Builds Agent2Agent (A2A) servers and clients, the open protocol (originally from Google, now under the Linux Foundation) that lets AI agents from different frameworks call each other. Use when the user wants to create an A2A-compliant agent, build an Agent Card, implement task management, connect agents across frameworks, set up agent discovery, handle streaming responses, implement push notifications, or orchestrate multi-agent workflows. Trigger words: a2a, agent to agent, agent2agent, a2a protocol, a2a server, a2a client, agent card, agent interoperability, agent collaboration, multi-agent, agent discovery, a2a sdk, a2a task.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

Plans a controlled experiment (A/B test) so its result can be trusted: writes the hypothesis, picks one primary metric and the guardrails, computes sample size and run time, specifies how visitors are assigned and when exposure is logged, and reads out the result with a confidence interval. Use when someone says "set up an A/B test", "split test this page", "how many visitors do I need", "how long should the experiment run", "is this result significant", "can I stop the test early", or wants to test a headline, price, layout or onboarding change against the current version.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

ably

무료

Ably is a hosted realtime messaging service: clients publish and subscribe to named channels over WebSockets, see who is present, replay message history, and resume after a dropped connection. Use when a user asks to "add realtime updates", "push live notifications to the browser", "show who is online", "add a chat room with typing indicators", "publish from a serverless function", or "authenticate Ably clients without exposing the API key". Covers the ably 2.x JavaScript SDK (Realtime and REST), JWT token authentication, presence, history and rewind, batch publishing, and the @ably/chat 1.x SDK.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

TerminalSkills/skills1722026년 10월 14일 업데이트

TerminalSkills의 스킬 모두 보기

이 스킬의 문제 신고