-
Notifications
You must be signed in to change notification settings - Fork 1
Add Multi-Database Support #12
Copy link
Copy link
Open
Labels
db-supportWork on dynamic or multi‑database user modelsWork on dynamic or multi‑database user models
Description
Add Multi-Database Support
Problem Description
authpool is tightly coupled with MongoDB and Mongoose. Developers using other databases (e.g., PostgreSQL with Prisma, MySQL with Sequelize) cannot use this package without rewriting significant parts.
Proposed Solution
- Abstract database logic via an adapter pattern.
- Allow injecting a
userAdapterin config:
startAuthServer({
userAdapter: {
findOrCreateUser: async (googleProfile) => {...},
findUserById: async (id) => {...},
}
});
Keep MongoDB as the default but fallback to adapter if provided.
Why this matter
Multi-database support makes authpool a framework-agnostic, future-proof solution. It can then serve any stack, from MERN to PostgreSQL-based backends.
Acceptance Criteria
- Supports a custom
userAdapterobject with required methods. - MongoDB fallback works as default if adapter is not passed.
- Proper validation and error-handling if adapter is misconfigured.
- Examples included in README (e.g., Prisma + PostgreSQL usage).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
db-supportWork on dynamic or multi‑database user modelsWork on dynamic or multi‑database user models