[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115398":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":26,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},115398,"reylo","reylosql\u002Freylo","reylosql","Import .sql files into TypeScript with full type inference and zero codegen.","https:\u002F\u002Freylo.dev",null,"Rust",1634,18,3,6,0,4,17,16,70.04,"MIT License",false,"main",true,[],"2026-11-23 20:49:40","2026-11-23 20:40:56","\u003Ch1 align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"site\u002Fpublic\u002Freadme-logo-dark.svg\" \u002F>\n    \u003Cimg src=\"site\u002Fpublic\u002Freadme-logo-light.svg\" width=\"160\" alt=\"Reylo\" \u002F>\n  \u003C\u002Fpicture>\n\u003C\u002Fh1>\n\n\u003Cp align=\"center\">Import \u003Ccode>.sql\u003C\u002Fcode> files into your TypeScript code with full type inference\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Freylosql\u002Freylo\u002Factions\u002Fworkflows\u002Ftest.yml\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Freylosql\u002Freylo\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg?branch=main\" alt=\"test status\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002Freylosql\u002Freylo?style=flat\" alt=\"License: MIT\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Freylo\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fv\u002Frelease\u002Freylosql\u002Freylo?label=npm\" alt=\"npm version\" \u002F>\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Freylosql\u002Freylo\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Freylosql\u002Freylo\" alt=\"GitHub stars\" \u002F>\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cdiv align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Freylo.dev\">Read the docs →\u003C\u002Fa>\n\u003C\u002Fdiv>\n\n\u003Cbr\u002F>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"site\u002Fpublic\u002Freadme-demo.gif\" alt=\"An editor: hovering a query's result shows its type, which follows the SQL as the SQL changes\" \u002F>\n\u003C\u002Fp>\n\n\u003Cbr\u002F>\n\nIf you have a file like this:\n\n```sql\n-- get_author.sql\nselect u.id, u.name, count(p.id)::int as post_count\nfrom users u\nleft join posts p on p.user_id = u.id\nwhere u.id = :id::int\ngroup by u.id\n```\n\nYou can import it directly from a TypeScript file like this:\n\n```ts\n\u002F\u002F main.ts\nimport postgres from \"postgres\";\nimport getAuthor from \".\u002Fget_author.sql\";\n\nconst db = postgres(process.env.DATABASE_URL);\n\nconst author = await getAuthor.run(db, { id: 1 });\n\u002F\u002F { id: number; name: string; post_count: number } | null\n```\n\nReylo is powered by TypeScript [content mappers](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-go\u002Fpull\u002F4712), introduced in TypeScript 7.1 (currently [in beta](https:\u002F\u002Fdevblogs.microsoft.com\u002Ftypescript\u002Fannouncing-typescript-7-1-beta\u002F)), which let you dynamically define static types for external file types and integrate them directly into TypeScript compilation.\n\nReylo is the perfect option for the agent era:\n\n- 💪 **The full power of SQL** — any syntax, function or operator your database supports\n- 🌵 **DRY** — no redundant hand-written types\n- 🎯 **Checked against your database** — a misspelled column is a type error\n- 🤖 **Agent-friendly** — DRY code is more maintainable for agents\n- 🧩 **Postgres, MySQL and SQLite** — Neon, PlanetScale, Cloudflare D1, Turso and more\n- 🔌 **Bring your own driver** — `pg`, postgres.js, `mysql2`, `better-sqlite3` and [more](#supported-drivers)\n- ⚡ **No codegen** — no generated files, no watcher\n\n## Setup\n\nTo install Reylo, you'll need:\n\n- **TypeScript 7.1 (currently in beta).** The first release with content mappers.\n- **Node 24 or later.**\n- **A running dev database.** Postgres, MySQL 8.0.22 or later, or a SQLite file: Reylo reads your current schema from it.\n\nInstall Reylo, which brings its engine for your machine, and TypeScript 7.1:\n\n```sh\nnpm install reylo\nnpm install -D typescript@beta\n```\n\nAdd Reylo to `tsconfig.json`, for `.sql` files and for its project file, `.reylo.yaml` or `.reylo.yml`:\n\n```jsonc\n\u002F\u002F tsconfig.json\n{\n  \"compilerOptions\": { \u002F* ... *\u002F },\n  \"contentMappers\": [\n    { \"package\": \"reylo\", \"extensions\": [\".sql\", \".reylo.yaml\", \".reylo.yml\"] }\n  ]\n}\n```\n\nThen type-check with `--runExternalCode`, which lets `tsc` run content mappers:\n\n```jsonc\n\u002F\u002F package.json\n{\n  \"scripts\": {\n    \"typecheck\": \"tsc --noEmit --runExternalCode\"\n  }\n}\n```\n\nPoint Reylo at your dev database with `DATABASE_URL`, in your environment or in `.env`. Its scheme tells Reylo which database you use:\n\n```sh\n# .env\nDATABASE_URL=postgres:\u002F\u002Flocalhost:5432\u002Fapp  # or mysql:\u002F\u002F… or sqlite:.\u002Fpath\u002Fto\u002Fyour.db, etc\n```\n\nTo make `.sql` imports work at run time too, load Reylo where your code runs. On Node:\n\n```sh\nnode --env-file=.env --import reylo\u002Fregister main.ts\n```\n\nFor Bun, Nub, Vite, Next.js, esbuild, webpack, Rspack, Cloudflare Workers and Jest, add [the plugin for your setup](https:\u002F\u002Freylo.dev\u002F#plugins), or copy its complete [example project](https:\u002F\u002Fgithub.com\u002Freylosql\u002Freylo\u002Ftree\u002Fmain\u002Fexamples). To see the types as you type, set up [your editor](https:\u002F\u002Freylo.dev\u002F#editors).\n\nTo give your coding agent Reylo's rules for writing and running queries, install its skill:\n\n```sh\nnpx skills add reylosql\u002Freylo --skill reylo\n```\n\n## Usage\n\nWrite a query in a `.sql` file, import it, and run it with your database driver:\n\n```sql\n-- get_user.sql\nselect id, name, email from users where id = :id::int\n```\n\n```ts\nimport getUser from \".\u002Fget_user.sql\";\n\nconst user = await getUser.run(db, { id: 1 });\n\u002F\u002F { id: number; name: string; email: string | null } | null\n```\n\nName each parameter with a colon, and give it a type with a cast where the query doesn't pin one down. Pass `.run()` your driver's client: a pool, a client, or a connection or transaction taken from one.\n\nIt resolves to the rows, shaped by how many the query can return:\n\n| The query | Resolves to |\n| --- | --- |\n| A match on a primary or unique key, or `limit 1` | `Row \\| null` |\n| An aggregate without `group by`, a one-row `insert … returning` | `Row` |\n| An `insert`, `update` or `delete` without `returning` | `void` |\n| Anything else | `Row[]` |\n\nAn imported query also has `.runSync()`, `.try()`, `.with()`, `.sql`, `.raw` and `.source` ([Usage](https:\u002F\u002Freylo.dev\u002F#usage)). Every query Reylo runs is published on Node's tracing channel `reylo:query`, for a tracer or a logger to subscribe to ([Tracing](https:\u002F\u002Freylo.dev\u002F#tracing)).\n\n## What Reylo infers\n\nTo type a query, Reylo has your dev database prepare it, without running it, and reads back the type of every column and parameter. On top of that, it infers:\n\n- **Nulls** — a column is nullable unless its schema, a join or a `where` test rules null out.\n- **Cardinality** — a match on a unique key is one row or `null`, and an aggregate is exactly one row.\n- **Unions** — an enum, or a column whose check constraint lists its values, is a union of them.\n- **JSON** — JSON the query builds, and a JSON column with a JSON Schema check, keep their shape.\n\nEach has examples in [Inference](https:\u002F\u002Freylo.dev\u002F#inference).\n\n## Supported drivers\n\nReylo is bring-your-own-driver. Pass `.run()` a client from any of these, or a Drizzle database or Knex instance over one:\n\n- **Postgres** — `pg`, postgres.js, `Bun.sql`, PGlite, Neon, `pg-promise`, `slonik`, `@vercel\u002Fpostgres`\n- **MySQL** — `mysql2`, `mariadb`, PlanetScale, `Bun.sql`\n- **SQLite** — `better-sqlite3`, `node:sqlite`, `Bun.sql`, libSQL, Turso, SQLite Wasm, Cloudflare D1 and Durable Objects, `sqlite3`, `sqlite`\n\n## Documentation\n\n[reylo.dev](https:\u002F\u002Freylo.dev) covers the rest: every plugin and editor, configuration, errors, each database's data types and edge cases, and advanced examples. Agents can read it all as Markdown at [reylo.dev\u002Fllms.txt](https:\u002F\u002Freylo.dev\u002Fllms.txt). To move a Prisma project's queries to Reylo, see [Migrating from Prisma](https:\u002F\u002Freylo.dev\u002Fprisma).\n\n## License\n\n[MIT](LICENSE)\n","Reylo 是一个 TypeScript 插件，支持直接导入 .sql 文件并实现全自动、零代码生成的类型推导。它基于 TypeScript 7.1 新增的 content mappers 机制，通过连接真实数据库（PostgreSQL\u002FMySQL\u002FSQLite）动态解析 SQL 查询结构，为参数和返回结果生成精确的 TypeScript 类型。无需手写类型定义或运行代码生成器，类型随 SQL 变更实时更新，并在拼写错误、列名不匹配等场景下提供编译期报错。适用于注重类型安全、追求 DRY 原则的数据库驱动型应用开发，尤其适合使用现代 TypeScript 的全栈或服务端项目。",2,"2026-11-24 04:50:53","CREATED_QUERY"]