Skip to content
File = API
V8 Isolates
Zero Config
Magic Comments
Auto-Install Deps
WebSocket Support
TypeScript Native
300+ AI Models
File = API
V8 Isolates
Zero Config
Magic Comments
Auto-Install Deps
WebSocket Support
TypeScript Native
300+ AI Models
File = API
V8 Isolates
Zero Config
Magic Comments
Auto-Install Deps
WebSocket Support
TypeScript Native
300+ AI Models
File = API
V8 Isolates
Zero Config
Magic Comments
Auto-Install Deps
WebSocket Support
TypeScript Native
300+ AI Models
home / kit / exec
ExecHOODY EXEC

Your Files Are APIs. One Comment Changes Everything.

Write a TypeScript function and it is instantly a live HTTP endpoint, powered by Bun. Add one comment to control the execution mode, CORS, timeout, auth, or AI. No frameworks. No servers. No config.

exec / hello.ts

// @mode serverless

// @cors reflective

// @timeout 5000

return { message: 'Hello from Hoody Exec!', time: Date.now() };

# Live at:

https://abc123-def456-exec-1.node-us-1.containers.hoody.com/hello

Instant HTTP endpoint — no imports, no exports, no config
home / kit / exec / modes
EXECUTION MODES

Two Modes. One Comment.

Every script declares an execution mode, and that one decision changes everything about how it runs. Worker for stateful real-time servers. Serverless for isolated, fresh-per-request execution.

Worker Mode

// @mode worker
  • Persistent V8 isolate — created once, stays warm forever
  • Shared state persists across every request
  • WebSocket support for real-time connections
  • Zero cold start after the first request

Serverless Mode

// @mode serverless // @concurrent 5
  • Brand new V8 isolate for every single request
  • Complete isolation — zero state leakage
  • Concurrency control via @concurrent
  • Safer for untrusted code, webhooks, and sporadic traffic
home / kit / exec / magic-carousel
MAGIC COMMENTS

Every Behavior. One Line.

Drop a comment at the very top of your file. No code changes, no config files, no middleware. Change the comment and the behavior changes instantly at load time.

EXECUTION
// @mode worker

Execution Mode

Choose a persistent Worker VM or a fresh Serverless isolate per request. Determines state, WebSocket support, and cold start. Defaults to serverless.

NETWORK
// @cors reflective

CORS Control

Mirror the request origin with reflective, open everything with *, lock to a specific URL, or disable with none. Default is none — zero middleware required.

LIMITS
// @timeout 60000

Request Timeout

Set the request timeout in milliseconds. Defaults to one hour (3600000ms). Use 0 or unlimited to remove the limit entirely.

LIMITS
// @concurrent false

Concurrency Cap

Serverless-only. Cap simultaneous executions with a number, allow unlimited with true (the default), or set false for serial processing — essential for webhook ordering.

AUTH
// @token my-secret-key-123

Endpoint Auth

Protect any endpoint with a shared secret. Clients authenticate via Bearer, Basic password, X-Token header, or query param. Constant-time SHA-256 comparison, redacted in every log.

REALTIME
// @websocket

WebSocket Support

Enable real-time bidirectional connections. Requires worker mode. The ws.open, ws.message, and ws.close handlers are injected automatically.

AI
// @ai true

AI Helpers

Injects model, openai, ai, generateText, streamText, and generateObject from the Vercel AI SDK. No imports, no API key setup, model pre-configured.

AI
// @ai-model anthropic/claude-sonnet-4.5

AI Model Selection

Override the model per script. Defaults to google/gemini-2.5-flash-lite, with access to 300+ models from 15+ inference providers through Hoody AI.

LOGGING
// @log-level full

Log Verbosity

Tune logging from none and minimal up through standard (the default), full, and debug. No external logging stack to wire up.

home / kit / exec / accordion
REFERENCE

Magic Comment Reference.

Every comment, every value, every default — parsed at script load time, taking precedence over the defaults.

@modeEXECUTION

Sets the execution mode. worker creates a persistent VM with shared state; serverless (the default) creates a fresh VM per request. Always declare it first.

SYNTAX

// @mode worker // @mode serverless
home / kit / exec / use-cases
USE CASES

From Webhook to WebSocket in Minutes.

Patterns that span the full range — from instant HTTP APIs to real-time AI interception — each just a file with the right magic comments.

Instant APIs

Skip Express and Fastify setup entirely. Write a function in a file and it is a live HTTP endpoint. Worker mode for high traffic, serverless for isolation.

Webhook Receivers

Stripe, GitHub, and Slack webhooks with serverless isolation that prevents cross-contamination. Use @concurrent false for strict serial ordering.

WebSocket Servers

Chat servers, live dashboards, and SSE streams. Worker mode keeps persistent connections alive with shared room state and broadcast helpers.

AI Interception

Intercept and control AI requests with a worker-mode MITM proxy. Add safety checks, modify prompts, block sensitive data, and track usage in one script.

Rate Limiting

Track per-IP request counts in the shared object across requests. Worker mode makes in-memory rate limiting and session management trivial.

Script Composition

Every script is an HTTP endpoint, so scripts call each other with fetch(). Compose microservices from simple functions — no queues, no service discovery.

home / kit / exec / endpoints
API REFERENCE

Every API Surface, One Place.

Script execution, management, validation, templates, routing, dependencies, logs, monitoring, schedules, and magic comment control — every endpoint relative to your Exec instance.

67 documented endpointshttps://abc123-def456-exec-1.node-us-1.containers.hoody.com

Script Execution

1 endpoint
POST
/{path}Execute any script via its file-based route

Script Management

6 endpoints
GET
/api/v1/exec/scripts/readRead script content
POST
/api/v1/exec/scripts/writeCreate or update a script
DELETE
/api/v1/exec/scripts/deleteDelete a script
GET
/api/v1/exec/scripts/listList all scripts
POST
/api/v1/exec/scripts/treeGet the directory tree
POST
/api/v1/exec/scripts/moveMove or rename a script

Validation

6 endpoints
POST
/api/v1/exec/validate/scriptComprehensive script validation
POST
/api/v1/exec/validate/typescriptTypeScript type checking
POST
/api/v1/exec/validate/syntaxSyntax validation
POST
/api/v1/exec/validate/dependenciesDependency validation
POST
/api/v1/exec/validate/return-typeReturn type validation
POST
/api/v1/exec/validate/magic-commentsParse and validate magic comments

Templates

6 endpoints
GET
/api/v1/exec/templates/listList templates
GET
/api/v1/exec/templates/previewPreview a template
POST
/api/v1/exec/templates/generateGenerate a script from a template
POST
/api/v1/exec/templates/create-customCreate a custom template
PUT
/api/v1/exec/templates/update-custom/{name}Update a custom template
DELETE
/api/v1/exec/templates/delete-custom/{name}Delete a custom template

Magic Comments

4 endpoints
GET
/api/v1/exec/magic-comments/schemaGet the magic comments schema
GET
/api/v1/exec/magic-comments/readRead a script's magic comments
PUT
/api/v1/exec/magic-comments/updateUpdate magic comments
POST
/api/v1/exec/magic-comments/bulk-updateBulk update across scripts

Dependencies & Packages

9 endpoints
GET
/api/v1/exec/dependencies/bundledList pre-bundled dependencies
POST
/api/v1/exec/dependencies/checkCheck for missing packages
POST
/api/v1/exec/dependencies/installInstall npm modules
GET
/api/v1/exec/package/readRead package.json
POST
/api/v1/exec/package/updateUpdate package.json
POST
/api/v1/exec/package/installInstall packages
POST
/api/v1/exec/package/compareCompare packages
POST
/api/v1/exec/package/pinPin versions
POST
/api/v1/exec/package/initInitialize package.json

Routing

3 endpoints
POST
/api/v1/exec/route/resolveResolve which script a URL maps to
POST
/api/v1/exec/route/discoverDiscover all routes
POST
/api/v1/exec/route/testTest route matching

Cache & Shared State

4 endpoints
POST
/api/v1/exec/cache/clearClear the execution cache
POST
/api/v1/exec/shared-state/getRead shared state
POST
/api/v1/exec/shared-state/setWrite shared state
POST
/api/v1/exec/shared-state/clearClear shared state

Logs

5 endpoints
GET
/api/v1/exec/logs/listList logs
POST
/api/v1/exec/logs/readRead a log
GET
/api/v1/exec/logs/streamStream logs over SSE
POST
/api/v1/exec/logs/searchSearch logs
DELETE
/api/v1/exec/logs/clearClear logs

Monitoring & Health

6 endpoints
GET
/api/v1/exec/monitor/statsPerformance metrics
GET
/api/v1/exec/monitor/active-requestsActive requests
GET
/api/v1/exec/monitor/scriptsList monitored scripts
POST
/api/v1/exec/monitor/script-performancePer-script performance
GET
/api/v1/exec/monitor/metricsPrometheus metrics export
GET
/api/v1/exec/healthHealth check

Schedules

4 endpoints
GET
/api/v1/exec/schedules/listList schedules
POST
/api/v1/exec/schedules/triggerTrigger a schedule
POST
/api/v1/exec/schedules/reloadReload schedules
GET
/api/v1/exec/schedules/historySchedule run history

SDK Management

4 endpoints
POST
/api/v1/exec/sdk/importImport an SDK
GET
/api/v1/exec/sdk/listList imported SDKs
GET
/api/v1/exec/sdk/{id}Get SDK details
DELETE
/api/v1/exec/sdk/{id}Delete an imported SDK

User OpenAPI

6 endpoints
POST
/api/v1/exec/user-openapi/generateGenerate an OpenAPI spec
GET
/api/v1/exec/user-openapi/listList user scripts
POST
/api/v1/exec/user-openapi/validateValidate a user schema
GET
/api/v1/exec/user-openapi/schemaServe the schema file
GET
/api/v1/exec/user-openapi/specServe the generated spec
POST
/api/v1/exec/user-openapi/mergeMerge OpenAPI specs

Instances & System

3 endpoints
GET
/api/v1/exec/listList all exec instance IDs
POST
/api/v1/exec/system/restartRestart the server
GET
/api/v1/exec/system/restart-statusGet restart status
home / kit / exec / start

Write a Function. Get an API.

Your code is the API. Drop a file into your Exec instance and it is instantly a live HTTP endpoint — routing, JSON serialization, dependency installation, and production-grade execution included.

Read the Docs