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
userAdapter in 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
userAdapter object 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).
Add Multi-Database Support
Problem Description
authpoolis 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
userAdapterin config:Keep MongoDB as the default but fallback to adapter if provided.
Why this matter
Multi-database support makes
authpoola framework-agnostic, future-proof solution. It can then serve any stack, from MERN to PostgreSQL-based backends.Acceptance Criteria
userAdapterobject with required methods.