choosing & FAQ
Pick the right adapter for your stack and answer common questions about persistence, scoped roles, idempotency, and migration.
Quick comparison
| Adapter | Use case | Persistence | Peer dep | Idempotent assign | Native scoped roles |
|---|---|---|---|---|---|
| Memory | Dev, testing | None | None | yes (in-memory check) | yes |
| File | CLIs, dev fixtures, single-process | JSON on disk | node:fs/promises (pluggable) | yes (in-memory check) | yes |
| Prisma | Prisma apps | Any DB | @prisma/client | no (throws on dup) | yes |
| Drizzle | Drizzle apps | PG/MySQL/SQLite | drizzle-orm | yes (onConflictDoNothing) | yes |
| Redis | Distributed deploys | Redis | ioredis or redis | yes (set semantics) | yes |
| HTTP | Microservice split | Remote API | None | depends on backend | yes |
All adapters are interchangeable. Engine, builder, and middleware code stays the same - migration is data movement only.
Decision tree
Are you in production?
|
+- No
| +- Need persistence between runs? -> IamFileAdapter
| +- Otherwise -> IamMemoryAdapter
|
+- Yes
|
+- CLI / single-process daemon? -> IamFileAdapter
+- Already use Prisma? -> IamPrismaAdapter
+- Already use Drizzle? -> IamDrizzleAdapter
+- Need distributed cache + multi-instance? -> IamRedisAdapter
+- Splitting auth across services? -> IamHttpAdapter (consume centrally)
+- Custom backend? -> Implement IamAdapter.IAdapter (see "Custom" doc)