{
 "schema_version": 1,
 "generated": "2026-10-26",
 "id": "colinhacks-reylo--import-sql-files-into-typescript",
 "repo": "colinhacks/reylo",
 "repo_url": "https://github.com/colinhacks/reylo",
 "repo_slug": "colinhacks-reylo",
 "title": "Import .sql files into TypeScript with real types",
 "page_title": "How to import .sql files into TypeScript with real types with Reylo",
 "summary": "Write queries in .sql files, import them, and get row and parameter types from your database.",
 "who": "A TypeScript developer tired of hand-writing row types that drift out of sync with their raw SQL.",
 "problem": "Raw SQL means hand-written types that go stale; an ORM means giving up some of the power of SQL.",
 "outcome": "Typed query imports, like a row or null for a unique-key match, with no generated files and no watcher.",
 "steps": [
  "Install: `npm install reylo`, then `npm install -D @reylosql/postgres` (or mysql or sqlite) and `npm 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"
 ],
 "agent_prompt": "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.",
 "agents": [
  "claude-code",
  "codex",
  "cursor"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "It depends on TypeScript 7.1, which is still in beta, and needs a live dev database for type checks.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "rust",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/colinhacks-reylo/import-sql-files-into-typescript/",
 "md": "https://dedupedai.com/use-cases/colinhacks-reylo/import-sql-files-into-typescript/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/colinhacks-reylo--import-sql-files-into-typescript.json",
 "api_version": "v1"
}
