Convert CRM to Multi-Tenant
Description
Budget: ₹1500 - ₹12500
I already have a working Node.js + MongoDB CRM that authenticates customers through JWT tokens. What I now need is true multi-tenancy: every query, write, and report must be transparently scoped to a tenantId so data never leaks across tenants.
Scope of work • Refactor the current MongoDB schema by adding a tenantId field. The Users collection is the immediate priority, but I want the pattern established so it can be applied to any existing or future collection with minimal effort. • Build Express / Mongoose (or equivalent) middleware that automatically injects the tenantId filter on all CRUD operations and attaches the tenantId to new documents on save. • Make sure the tenantId is pulled from the decoded JWT payload, then propagate it through the request life-cycle. • Validate that queries without an explicit tenantId are impossible, guaranteeing isolation. No additional role-based or user-level permissions are required right now. • Provide a concise README or in-code comments explaining how to add the same protection to new models.
Acceptance criteria
- Seeding two sample tenants shows complete data separation when hitting the same endpoints.
- Unit or integration tests demonstrate that cross-tenant access attempts fail.
- Code merges cleanly into my existing repository and runs with my current package versions (Node.js & MongoDB versions used in the project).
If you have implemented tenantId-based isolation before, I’d love to see a quick note or repo link. Looking forward to a robust, clean solution.
Skills
Want AI to find more roles like this?
Upload your CV once. Get matched to relevant assignments automatically.