Skip to content

Implement Multi-Tenant Database Structure for EnrollNow #24

@agaesh

Description

@agaesh

Title:

Description:
We need to enhance EnrollNow’s architecture by introducing a multi-tenant database structure to ensure proper data isolation and scalability for multiple organizations (tenants).

Currently, all tenant data resides in a shared schema without strict isolation. This poses risks in terms of data security, performance, and customization.

Proposed Approach:

  1. Architecture Choice:

    • Database-per-tenant: Each tenant gets its own database.
    • OR Schema-per-tenant: Shared database but separate schemas per tenant.
    • Evaluate trade-offs for performance, cost, and ease of maintenance.
  2. Tenant Identification:

    • Implement tenant resolution logic based on subdomain, custom domain, or authentication metadata.
  3. Automated Provisioning:

    • On new tenant signup, automatically create the database/schema and run migrations.
  4. Connection Management:

    • Implement dynamic connection handling in Sequelize based on the resolved tenant.
  5. Data Security:

    • Ensure strict separation so that no tenant can access another tenant’s data.
  6. Migration Strategy:

    • Create a robust migration script to handle new tenant database initialization and updates.

Acceptance Criteria:

  • ✅ System should automatically provision a database/schema for a new tenant.
  • ✅ Tenant isolation must be enforced at the database level.
  • ✅ No downtime when onboarding a new tenant.
  • ✅ Document the multi-tenant structure in README.md.

References:

Priority: High
Type: Enhancement

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions