Repolode
instant-dev

instant-dev/api

A JavaScript framework for building type-safe web APIs, generating OpenAPI specs from JSDoc comments, with built-in SSE streaming for LLM responses.

Stars
254
Forks
9
Open issues
2
Last commit
2 months ago

What is it?

Instant API is a JavaScript framework for building web APIs where type checking happens at the HTTP interface. Developers document an exported endpoint function with a JSDoc-style comment, and parameter validation, sanitization and response checks are derived from those types, so separate schema validation libraries are not needed. An OpenAPI specification in JSON and YAML, along with a JSON schema for LLM function calling, is generated automatically under the server's /.well-known/ path.

Endpoints map file paths in a functions/ directory to HTTP routes, with each exported GET, POST, PUT or DELETE function handling its method. The framework also serves static files from a www/ directory, supports form-urlencoded and multipart and JSON request bodies, and sets permissive CORS headers by default with an @origin directive for restriction.

For AI and chat integrations, endpoints can stream Server-Sent Events via a context.stream() method and an @stream schema, and can return a 200 response immediately while continuing work in the background, which suits Slack or Discord webhooks. The project is distributed on npm as @instant.dev/api and is also used with the instant.dev command line tool for project setup, endpoint generation and deployment.

Key features

  • 01Generates OpenAPI specs in JSON and YAML from JSDoc comments.
  • 02Validates parameters and return values by declared types, sizes and ranges.
  • 03Produces JSON schema for LLM function calling.
  • 04Streams responses as text/event-stream using @stream and context.stream().
  • 05Runs endpoint work in the background to return immediate responses for webhooks.
  • 06Serves static files from a www/ directory alongside API routes.

Use cases

  • Building a JSON API where request validation should come from function comments rather than a separate schema library.
  • Exposing an LLM-backed endpoint that streams tokens to a browser client.
  • Creating a Slack or Discord webhook handler that must reply quickly and process work afterward.
  • Publishing an OpenAPI spec and function-calling schema for an existing set of endpoints.

Quick start

  1. 1

    Install the instant.dev command line tools globally

    npm i instant.dev -g
  2. 2

    Create a new project folder and enter it

    cd ~/projects && mkdir my-new-project && cd my-new-project
  3. 3

    Initialize the project

    instant init
  4. 4

    Start the server

    instant serve

Things to know

  • Requires Node.js and the instant.dev CLI for the quickest setup.
  • The README calls it an early release, so expect changes.

In collections

Topics

FAQ

What is api?
A JavaScript framework for building type-safe web APIs, generating OpenAPI specs from JSDoc comments, with built-in SSE streaming for LLM responses. Instant API is a JavaScript framework for building web APIs where type checking happens at the HTTP interface. Developers document an exported endpoint function with a JSDoc-style comment, and parameter validation, sanitization and response checks are derived from those types, so separate schema validation libraries are not needed. An OpenAPI specification in JSON and YAML, along with a JSON schema for LLM function calling, is generated automatically under the server's /.well-known/ path.
Is api free to use? What license does it have?
api is open source under the MIT license. Check the license terms before using it in commercial products.
Is api still maintained?
Updated within 6 months. The last commit to api was on Sep 14, 2026.
What can I use api for?
Building a JSON API where request validation should come from function comments rather than a separate schema library. Exposing an LLM-backed endpoint that streams tokens to a browser client. Creating a Slack or Discord webhook handler that must reply quickly and process work afterward. Publishing an OpenAPI spec and function-calling schema for an existing set of endpoints.
How do I install api?
Install the instant.dev command line tools globally: npm i instant.dev -g Create a new project folder and enter it: cd ~/projects && mkdir my-new-project && cd my-new-project Initialize the project: instant init Start the server: instant serve
Where can I get api?
The source code and installation instructions are on GitHub: https://github.com/instant-dev/api

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects