mcpField
E
elysia-architecture

elysia-architecture

github.com/dobroslavradosavljevicDevelopment341 installsUpdated 2d ago
Repository

About elysia-architecture

A portable architecture skill for organizing Elysia HTTP applications, defining file layout, naming, and ownership boundaries. It is intended for scaffolding, applying, or reviewing feature modules, while leaving framework API details to current Elysia documentation.

Key features

  1. 01Organize features under domain modules
  2. 02Separate routes, schemas, and domain logic
  3. 03Keep route files focused and thin
  4. 04Define imports and cross-feature boundaries
  5. 05Use extensions for matching stack components

Use cases

  1. 01Scaffold a new Elysia feature module
  2. 02Place endpoints and schemas consistently
  3. 03Review an application tree against architecture rules
  4. 04Set boundaries between routes and services

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/dobroslavradosavljevic/skills --skill elysia-architecture

After installing, type/elysia-architecturein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

agents/
openai.yaml
references/
checklist.md
examples.md
rules.md
tree.md
with-api-key-auth.md
with-capability-authz.md
with-cron.md
with-domain-packages.md
with-drizzle.md
with-effect.md
with-env.md
with-http-errors.md
with-observability.md
with-openapi.md
with-service-auth.md
with-session-auth.md
with-shared-plugins.md
with-vitest.md
with-webhooks.md

Details

From the project README

Elysia Architecture

Portable house style for Elysia HTTP apps. Use this skill alone — it does not depend on other skills.

Job: where code lives, how folders/files are named, and ownership boundaries.

Not this skill: Elysia API quirks, plugin lifecycle details, Eden, adapters, or latest framework docs. Prefer current Elysia docs for those.

If the target repo already documents architecture (e.g. AGENTS.md) and it conflicts, repo wins unless the user asks to migrate toward this skill.

Stack defaults (core)

PieceDefault
RuntimeBun (Node/adapters OK if the app already uses them)
HTTPElysia feature plugins under src/modules/<feature>/
VersionElysia 1.4 at ≥ 1.4.30 (security floor; never build route schemas from untrusted input). Elysia 2 is beta — keep house-style code on 1.4 until it ships stable
Module layoutroutes/ + schema/ + domain logic folder
TestsVitest under tests/ (unit / integration projects) when the repo uses Vitest

Domain logic may be plain TypeScript modules. Load matching with-* extensions when those stacks are present (see below).

Modes

  1. Scaffold — new feature module from checklist.md + tree.md.
  2. Apply — place new endpoints/schemas/services in the canonical spots.
  3. Review — compare the tree to rules.md; propose moves; do not invent a parallel layout.

Hard rules (core)

  1. Feature = src/modules/<feature>/. Group by domain (billing, users), not by technical layer at the app root.
  2. One route file = one exported const Elysia plugin with a stable name, and typically one HTTP verb (or a tight related group). Do not pack unrelated verbs into one file. Do not export function makeXRoutes(...).
  3. routes/index.ts is a mount table only — .use(child) (+ prefix). No handlers, no domain logic, no shared mappers.
  4. Schemas live under schema/ (body, response, query, params as needed). Do not dump DTOs into route files or invent parallel hand-written response interfaces when schemas already define the contract.
  5. Routes stay thin. HTTP concerns (auth guards, status mapping, request/response) in the route file; business rules in services (or plain domain modules).
  6. No route factories / shared HTTP wrappers. Do not invent makeSyncGet, mapXToHttp, or utils/*-http.ts that wrap handlers. Inline the edge in each route file.
  7. Import process resources. Do not inject them. Database, Effect runtime, env, queues: import { db } from "…", import { runtime } from "…". Forbidden: export function cmsRoutes(db: Db), .decorate("db", db) / .decorate("runtime", runtime) on feature routes, or passing those values through mount-table arguments. Shared-package plugins may take options (origins, prefix); apps still import their own singletons.
  8. Map failures at the HTTP edge only. Public bodies stay small (e.g. { error: string } + status). Do not leak internal causes.
  9. Do not grow utils/ for HTTP. Prefer schema/, services/domain, or inlined route edges.
  10. Naming: folder = noun/domain; file = action or aspect (create.ts, status.ts). Do not repeat the parent folder in the leaf name (billing/billing-status.ts → billing/routes/status.ts).
  11. Import direction: routes → schema + services; services must not import routes. Cross-feature deps go through services/shared packages, not route→route imports.
  12. Mount feature trees from the app entry (or a parent feature’s mount table).

Details, anti-patterns, and examples: rules.md, tree.md, examples.md.

Progressive disclosure

NeedRead
Canonical trees + namingreferences/tree.md
Enforce rules + anti-patternsreferences/rules.md
Scaffold / review checklistsreferences/checklist.md
Good vs bad layoutsreferences/examples.md
Optional stack overlaysExtensions below

Extensions

Load an extension only when the matching stack is present (or the user asks). Extensions add rules; they do not replace the core tree.

WhenExtension
Effect services / Layers / tagged errorswith-effect.md
T3 Env / packages must not read process.envwith-env.md
Session auth mount + { auth: true } macrowith-session-auth.md
Capabilities / grants / identity permissionswith-capability-authz.md
Bearer API keys on a jobs/public APIwith-api-key-auth.md
Drizzle schema package + DB in serviceswith-drizzle.md
OpenAPI derived from route schemaswith-openapi.md
Request logs + OTEL + Effect tracerwith-observability.md
Stable public error body + edge mappingwith-http-errors.md
Domain in packages/*, HTTP in app moduleswith-domain-packages.md
Shared vs app-local Elysia pluginswith-shared-plugins.md
In-process cron tickswith-cron.md
Provider webhookswith-webhooks.md
Internal shared-secret routeswith-service-auth.md
Vitest — Eden treaty(app) / what to testwith-vitest.md

Comments

Markdown supported