{"id":50851816,"url":"https://github.com/gloomweaver/effql","last_synced_at":"2026-06-14T14:03:41.541Z","repository":{"id":351765340,"uuid":"1212397750","full_name":"gloomweaver/effql","owner":"gloomweaver","description":"sqlc-style TypeScript code generation for Effect SQL using Postgres introspection","archived":false,"fork":false,"pushed_at":"2026-04-16T14:22:10.000Z","size":71,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-14T14:03:41.189Z","etag":null,"topics":["code-generator","effect-ts","postgresql","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gloomweaver.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-04-16T10:39:46.000Z","updated_at":"2026-04-28T16:24:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gloomweaver/effql","commit_stats":null,"previous_names":["gloomweaver/sqlf","gloomweaver/effql"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gloomweaver/effql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gloomweaver%2Feffql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gloomweaver%2Feffql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gloomweaver%2Feffql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gloomweaver%2Feffql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gloomweaver","download_url":"https://codeload.github.com/gloomweaver/effql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gloomweaver%2Feffql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34324004,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","effect-ts","postgresql","typescript"],"created_at":"2026-06-14T14:03:40.757Z","updated_at":"2026-06-14T14:03:41.533Z","avatar_url":"https://github.com/gloomweaver.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# effql\n\n[![CI](https://github.com/gloomweaver/effql/actions/workflows/ci.yml/badge.svg)](https://github.com/gloomweaver/effql/actions/workflows/ci.yml)\n[![npm: @effql/cli](https://img.shields.io/npm/v/%40effql%2Fcli?label=%40effql%2Fcli)](https://www.npmjs.com/package/@effql/cli)\n[![npm: @effql/core](https://img.shields.io/npm/v/%40effql%2Fcore?label=%40effql%2Fcore)](https://www.npmjs.com/package/@effql/core)\n\n`effql` is a `sqlc`-style TypeScript code generator for `effect` / `@effect/sql`.\n\nIt keeps a SQL-first workflow, uses Postgres introspection to infer types, and emits Effect-native code built around `Schema` and `SqlSchema.*`.\n\n## Packages\n\n- [`@effql/cli`](https://www.npmjs.com/package/@effql/cli) — CLI package providing the `effql` command\n- [`@effql/core`](https://www.npmjs.com/package/@effql/core) — config loading, SQL parsing, Postgres analysis, and code generation\n\n## Installation\n\n```bash\nnpm install -D @effql/cli @effql/core\n```\n\n```bash\npnpm add -D @effql/cli @effql/core\n```\n\n## CLI usage\n\nBootstrap a project:\n\n```bash\nnpx @effql/cli init\nnpx @effql/cli init --config ./effql.config.ts\n```\n\nThis creates:\n\n- `effql.config.ts`\n- `sql/queries.sql`\n- `package.json` if one does not already exist\n\nInstalled locally:\n\n```bash\nnpx effql init\nnpx effql generate\nnpx effql generate --config ./effql.config.ts\n```\n\nOne-off without installing:\n\n```bash\nnpx @effql/cli generate\nnpx @effql/cli generate --config ./effql.config.ts\n```\n\nAlso works with pnpm:\n\n```bash\npnpm dlx @effql/cli generate\n```\n\nYes — `npx` works because `@effql/cli` publishes the `effql` bin.\n\n## Quick start\n\nTry the example in two commands:\n\n```bash\nvp run -r build\nvp run @effql/example-basic#generate\n```\n\nThen start the example API:\n\n```bash\nvp run @effql/example-basic#start\n```\n\nOr run the full smoke test used by CI:\n\n```bash\npnpm run example:smoke\n```\n\n## Config\n\n`effql` uses code-based config:\n\n```ts\nimport { defineConfig } from \"@effql/core\";\n\nexport default defineConfig({\n  dialect: \"postgres\",\n  db: {\n    url: process.env.DATABASE_URL!,\n  },\n  queries: [\"./sql/**/*.sql\"],\n  outDir: \"./generated\",\n});\n```\n\nSupported config filenames:\n\n- `effql.config.ts`\n- `effql.config.mts`\n- `effql.config.js`\n- `effql.config.mjs`\n- `effql.config.cts`\n- `effql.config.cjs`\n\n## SQL example\n\n```sql\n-- name: CreateUser :one\nINSERT INTO users (id, email, created_at)\nVALUES (@id::uuid, @email::text, now())\nRETURNING id, email, created_at;\n\n-- name: GetUser :one\nSELECT id, email, created_at\nFROM users\nWHERE id = @id::uuid;\n```\n\n## Generated output shape\n\nStarter `sql/queries.sql` contains a simple `Healthcheck` query you can edit right away.\n\nGenerated modules export:\n\n- `*ParamsSchema`\n- `*ResultSchema`\n- `*Params` / `*Result` type aliases\n- raw `*Sql` strings\n- executable `SqlSchema.*` wrappers\n\n```ts\nexport const CreateUserResultSchema = Schema.Struct({\n  id: Schema.UUID,\n  email: Schema.String,\n  created_at: Schema.DateFromSelf,\n});\n\nexport const createUser = SqlSchema.single({\n  Request: CreateUserParamsSchema,\n  Result: CreateUserResultSchema,\n  execute: (request) =\u003e\n    Effect.flatMap(SqlClient.SqlClient, (sql) =\u003e\n      sql.unsafe(createUserSql, [request.id, request.email]),\n    ),\n});\n```\n\n## Example project\n\nSee `examples/basic` for the easiest end-to-end demo:\n\n- `compose.yaml` starts Postgres on `127.0.0.1:54329`\n- `schema.sql` creates and seeds `users`\n- `sql/queries.sql` defines CRUD queries\n- `generated/index.ts` is committed generated output\n- `src/httpApi.ts` and `src/server.ts` show runtime usage\n\n## Status\n\nThis is an early **Postgres-only MVP**.\n\nWhat works today:\n\n- TS / JS config via `defineConfig()`\n- query annotations: `:one`, `:maybeOne`, `:many`, `:exec`\n- named params via `@param`\n- Postgres-backed type inference\n- generated `Schema` exports and `SqlSchema.single/findOne/findAll/void` wrappers\n- self-contained CRUD example with Docker Compose and an Effect HTTP API\n\n## Known limitations\n\nCurrent MVP limitations:\n\n- Postgres only\n- generation requires a live database connection\n- named params currently work best with explicit casts, for example `@id::uuid`\n- nullability inference is intentionally conservative\n- output is currently a single generated module per target\n- API / config shape may still evolve before a stable release\n\n## Publishing\n\nA GitHub Actions release workflow publishes the npm packages when a GitHub release is marked as `published`.\n\nBefore using it:\n\n- add an `NPM_TOKEN` repository secret if you keep token-based publishing\n- make sure you own/publish to both `@effql/cli` and `@effql/core` on npm\n- create releases with tags that match the package versions, for example `v0.1.1`\n\nThe release workflow:\n\n- installs dependencies\n- verifies the release tag matches `packages/cli` and `packages/core` versions\n- builds, lints, formats, tests, and runs the example smoke test\n- publishes `@effql/core`\n- publishes `@effql/cli`\n\n## Development\n\n```bash\nvp install\nvp lint\nvp fmt\nvp test\nvp run -r build\npnpm run example:smoke\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgloomweaver%2Feffql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgloomweaver%2Feffql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgloomweaver%2Feffql/lists"}