Who it is forA TypeScript developer tired of hand-writing row types that drift out of sync with their raw SQL.
The problemRaw SQL means hand-written types that go stale; an ORM means giving up some of the power of SQL.
The outcomeTyped query imports, like a row or null for a unique-key match, with no generated files and no watcher.
What you need first
- TypeScript 7.1 (currently in beta), the first release with content mappers
- Node 24 or later
- A running dev database: Postgres, MySQL 8.0.22 or later, or a SQLite file
- A supported driver such as pg, postgres.js, mysql2, better-sqlite3, Bun.sql or Cloudflare D1
Steps
- Install:
npm install reylo, thennpm install -D @reylosql/postgres(or mysql or sqlite) andnpm install -D typescript@beta - Add a contentMappers entry for Reylo to tsconfig.json covering .sql, .reylo.yaml and .reylo.yml
- Set DATABASE_URL in your environment or .env; its scheme tells Reylo which database you use
- Write a query in a .sql file with named parameters such as :id::int, import it and call
.run(db, { id: 1 })with your driver's client - Load Reylo at run time on Node with
node --env-file=.env --import reylo/register main.ts, or add the plugin for Bun, Vite, Next.js or your setup
Prompt for your agent
Add colinhacks/reylo to <project> using <database> and <driver>. Move the query in <file> into a .sql file, import it, and show me the inferred return type. Use TypeScript 7.1 beta and keep the existing behavior identical.
Caveat. It depends on TypeScript 7.1, which is still in beta, and needs a live dev database for type checks.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for colinhacks/reylo and "Import .sql files into TypeScript with real types"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer