{"id":31162093,"url":"https://github.com/zephraph/better-auth-workers-qb","last_synced_at":"2025-09-19T04:51:37.380Z","repository":{"id":308006375,"uuid":"1031011720","full_name":"zephraph/better-auth-workers-qb","owner":"zephraph","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-03T15:58:19.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-03T16:24:39.131Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zephraph.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}},"created_at":"2025-08-02T20:15:16.000Z","updated_at":"2025-08-03T15:58:22.000Z","dependencies_parsed_at":"2025-08-03T16:24:42.584Z","dependency_job_id":"829da306-cbc1-4cd2-ac5d-ebe82b515cbf","html_url":"https://github.com/zephraph/better-auth-workers-qb","commit_stats":null,"previous_names":["zephraph/better-auth-workers-qb"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/zephraph/better-auth-workers-qb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fbetter-auth-workers-qb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fbetter-auth-workers-qb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fbetter-auth-workers-qb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fbetter-auth-workers-qb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zephraph","download_url":"https://codeload.github.com/zephraph/better-auth-workers-qb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zephraph%2Fbetter-auth-workers-qb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275883280,"owners_count":25545490,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-19T02:00:09.700Z","response_time":108,"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":[],"created_at":"2025-09-19T04:51:35.588Z","updated_at":"2025-09-19T04:51:37.344Z","avatar_url":"https://github.com/zephraph.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Better Auth Workers QB Adapter\n\nA database adapter for [Better Auth](https://www.better-auth.com/) that uses [Workers QB](https://workers-qb.massadas.com/) as the query builder, designed specifically for Cloudflare D1 and edge environments.\n\n## Features\n\n- Zero dependencies query building with Workers QB\n- Full TypeScript support\n- Compatible with Cloudflare D1\n- Supports all Better Auth adapter operations\n- Edge-optimized performance\n\n## Installation\n\n```bash\nnpm install better-auth-workers-qb\n# or\nyarn add better-auth-workers-qb\n# or\nbun add better-auth-workers-qb\n```\n\n## Usage\n\n### With Cloudflare D1\n\n```typescript\nimport { betterAuth } from \"better-auth\";\nimport { workersQBAdapter } from \"better-auth-workers-qb\";\n\n// In your Cloudflare Worker\nexport default {\n  async fetch(request: Request, env: Env) {\n    const auth = betterAuth({\n      database: workersQBAdapter({\n        database: env.D1_DATABASE, // Your D1 database binding\n        usePlural: false, // Optional: Use plural table names (default: false)\n        debugLogs: true, // Optional: Enable debug logging (default: false)\n      }),\n      // ... other Better Auth config\n    });\n\n    return auth.handler(request);\n  },\n};\n```\n\n### With QueryBuilder Instance\n\nYou can also pass a pre-configured QueryBuilder instance:\n\n```typescript\nimport { QueryBuilder } from \"workers-qb\";\nimport { workersQBAdapter } from \"better-auth-workers-qb\";\n\nconst qb = new QueryBuilder(env.D1_DATABASE);\n\nconst auth = betterAuth({\n  database: workersQBAdapter({\n    database: qb,\n  }),\n  // ... other Better Auth config\n});\n```\n\n## Configuration Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `database` | `D1Database \\| QueryBuilder` | required | The D1 database binding or QueryBuilder instance |\n| `usePlural` | `boolean` | `false` | Whether to use plural table names (e.g., \"users\" instead of \"user\") |\n| `debugLogs` | `boolean \\| object` | `false` | Enable debug logging for adapter operations |\n\n### Debug Logs Configuration\n\n```typescript\nworkersQBAdapter({\n  database: env.D1_DATABASE,\n  debugLogs: {\n    logCondition: () =\u003e process.env.NODE_ENV === \"development\",\n    create: true,\n    update: true,\n    updateMany: true,\n    findOne: true,\n    findMany: true,\n    delete: true,\n    deleteMany: true,\n    count: true,\n  },\n});\n```\n\n## Supported Operations\n\nThe adapter implements all required Better Auth database operations:\n\n- `create` - Insert new records\n- `update` - Update a single record\n- `updateMany` - Update multiple records\n- `delete` - Delete a single record\n- `deleteMany` - Delete multiple records\n- `findOne` - Find a single record\n- `findMany` - Find multiple records with pagination and sorting\n- `count` - Count records matching criteria\n\n## TypeScript Support\n\nThe adapter is fully typed and exports all necessary TypeScript interfaces:\n\n```typescript\nimport type { \n  WorkersQBAdapterConfig,\n  D1Database,\n  D1PreparedStatement,\n  D1Result,\n} from \"better-auth-workers-qb\";\n```\n\n## Testing\n\nRun tests with:\n\n```bash\nbun test\n```\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Run type checking\nbun run type-check\n\n# Build the package\nbun run build\n\n# Run tests\nbun test\n```\n\n## License\n\nMIT\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Links\n\n- [Better Auth Documentation](https://www.better-auth.com/)\n- [Workers QB Documentation](https://workers-qb.massadas.com/)\n- [Cloudflare D1 Documentation](https://developers.cloudflare.com/d1/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephraph%2Fbetter-auth-workers-qb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzephraph%2Fbetter-auth-workers-qb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzephraph%2Fbetter-auth-workers-qb/lists"}