https://github.com/alyldas/uniauth-drizzle
Drizzle/Postgres persistence adapter for UniAuth core contracts.
https://github.com/alyldas/uniauth-drizzle
adapter auth authentication drizzle postgres typescript uniauth
Last synced: 2 days ago
JSON representation
Drizzle/Postgres persistence adapter for UniAuth core contracts.
- Host: GitHub
- URL: https://github.com/alyldas/uniauth-drizzle
- Owner: alyldas
- License: other
- Created: 2026-05-26T15:12:41.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2026-05-27T14:13:17.000Z (about 1 month ago)
- Last Synced: 2026-05-27T15:05:07.634Z (about 1 month ago)
- Topics: adapter, auth, authentication, drizzle, postgres, typescript, uniauth
- Language: TypeScript
- Homepage: https://github.com/alyldas/uniauth-drizzle#readme
- Size: 49.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Security: SECURITY.md
- Notice: NOTICE
- Agents: AGENTS.md
Awesome Lists containing this project
README
# UniAuth Drizzle Adapter
[](https://github.com/users/alyldas/packages/npm/package/uniauth-drizzle)
Drizzle storage adapter for `@alyldas/uniauth-core`.
This package implements only the UniAuth storage contracts:
- `AuthServiceRepositories`;
- `UnitOfWork`;
- PostgreSQL tables for Drizzle.
It does not verify passwords, issue sessions, parse HTTP requests, send OTP messages, or duplicate
auth policy logic from `@alyldas/uniauth-core`.
## Runtime Boundary
Applications own Drizzle driver setup, connection lifecycle, migrations, retry policy, and database
operations outside the UniAuth repository contracts. This package owns only table definitions,
repository implementations, and transaction wiring for UniAuth.
## Install
Configure the GitHub Packages registry for the package scope before installing:
```ini
@alyldas:registry=https://npm.pkg.github.com
```
GitHub Packages can require authentication for package reads. Use a token with `read:packages` in local npm config or CI secrets; do not commit tokens.
```sh
npm install @alyldas/uniauth-core @alyldas/uniauth-drizzle drizzle-orm
```
## Usage
```ts
import { DefaultAuthService } from '@alyldas/uniauth-core'
import { createDrizzleAuthStore } from '@alyldas/uniauth-drizzle'
import { drizzle } from 'drizzle-orm/node-postgres'
import { Pool } from 'pg'
const db = drizzle(new Pool({ connectionString: process.env.DATABASE_URL }))
const store = createDrizzleAuthStore({ db })
const auth = new DefaultAuthService({
repos: store,
transaction: store,
})
```
Use the exported Drizzle tables in migrations:
```ts
import {
uniauthAuditEvents,
uniauthCredentials,
uniauthIdentities,
uniauthSessions,
uniauthUsers,
uniauthVerifications,
} from '@alyldas/uniauth-drizzle'
```
See [Postgres persistence](docs/postgres.md) for the schema parity notes, transaction boundary, and
runtime ownership split.
## Security Notes
- Verification secrets and session tokens must reach this adapter already hashed by UniAuth core.
- Metadata and trust payloads are stored as JSON, but provider SDK objects should be reduced before
they reach UniAuth.
- The adapter does not infer account ownership outside UniAuth policy.
## Local Checks
```sh
npm run check
```