putnami / typescript

Full-stack TypeScript.
Nothing left to wire.

API, pages, data, auth, events and jobs in one app. It runs on Bun and renders pages with React. Built so a coding agent can write it, test it and run it.

$bun create @putnami my-app
Read the docs →
// the API route export const GET = endpoint() .query({ projectId: Optional(String), limit: Optional(Number) }) .inject({ taskService: TaskService }) .handle(async (ctx) => { const { taskService } = ctx.deps; const query = ctx.queryParams(); if (query.projectId) { return { tasks: await taskService.listTasks(query.projectId) }; } return { tasks: await taskService.listRecentTasks(query.limit ?? 100) }; });
// the page data, on the server only export default loader() .inject({ taskService: TaskService, projectService: ProjectService }) .handle(async ({ taskService, projectService }) => { const [tasks, projects] = await Promise.all([ taskService.listRecentTasks(100), projectService.listProjects(), ]); const projectNames = Object.fromEntries( projects.map((project) => [project.id, project.name]), ); return { tasks, projectNames }; });
// the page, rendered on the server; … marks a cut export default function TasksBoardPage() { const { tasks, projectNames } = useLoaderData<{ tasks: Task[]; projectNames: Record<string, string> }>(); return ( … <ul> {tasks.map((task) => ( <li key={task.id}> <strong>{task.title}</strong> … {projectNames[task.projectId] ?? task.projectId} … <Form method='post'> <CsrfInput /> <input type='hidden' name='taskId' value={task.id} /> <button type='submit'>{task.status.replace('_', ' ')}</button> </Form> </li> ))} </ul> ); }
one TaskService, injected in the API and the pagesamples/13-fullstack-app
built for agents

An agent writes it, tests it and runs it.

Each package says how to use it. The workspace says what a change touches and what is already decided. Typed contracts turn a wrong guess into a build error, before it reaches production.

measured: typescript/bench/dx times what a coding agent pays to ship an app, in tokens, iterations and success.

agent session
$ putnami context pack --project web # the files and AI.md to read, with a token estimate $ putnami test --impacted # only the projects the change touches $ putnami build # a caller of a changed contract fails here $ putnami serve web # serves web at http://localhost:3000
AI.md

In every framework package: the methods, one canonical example, the limits.

AGENTS.md + skills

How to build, test and add code here. Skills install with the extensions.

decisions/

Settled choices, one file each. An agent reads one before it changes it.

typed contracts

A changed endpoint fails the build of every caller, Go or TypeScript.

on by default

Decided once, on for every page.

Secure

  • CSP and security headers on every React route.
  • A CSRF check on every action.
  • .secure() on a layout protects its pages and their data endpoints.
  • Server data is escaped. No token reaches the HTML.
  • The page cache keys on the user and the query.

Designed

  • @putnami/ui: theme, dark mode, layout, forms, overlays.
  • Theme styles rendered on the server.
  • CSS Modules built in. Tailwind compiles at build when you add it.
  • The build fails on a missing translation.
  • putnami i18n translate drafts the rest.

Rendered your way

  • Server rendering by default, Suspense streamed.
  • .static() renders a page at build.
  • .static({ revalidate: 60 }) for incremental pages.
  • Islands for the interactive parts.
  • A failed hydration keeps the server HTML.
polyglot

Talk to any service, in any language.

A Putnami service publishes its contract as OpenAPI, and as Protobuf with the proto plugin. Go and TypeScript callers get a generated, typed client. Any other language reads the same contract.

An outside HTTP API extends the same client base, with retries, circuit breaker, tracing and auth.

Service clients →
your app · @putnami/clientcalls
goA Putnami Go servicegenerated client · json or proto
tsA Putnami TypeScript servicegenerated client · sse, websocket
openapiAny OpenAPI servicethird-party contract
connectAny Connect serviceconnect transport
the rest of the app

The API lives next to the pages.

API

Validation, OpenAPI, typed errors, file uploads.

Data

PostgreSQL repositories, migrations, storage.

Auth

Sessions, OAuth, signed cookies.

Realtime and jobs

WebSockets, SSE, events, recurring jobs.

Production

Health checks, telemetry, logs, a graceful stop.

start

Bun alone is enough.

Add the Putnami CLI when the app joins a workspace with other services.

$ bun create @putnami my-app $ cd my-app && bun install && bun dev # in a workspace: the app and the services it runs with $ putnami compose my-app