@mr-aftab-ahmad-khan/tenantforge
v0.1.0
Published
Tenant resolution from headers, scoped filters for Express and Mongo-style stacks.
Maintainers
Readme
tenantforge
Multi-tenant guard for Express: reads x-tenant-id (configurable), supports an optional allow-list, attaches req.tenantId, and ships tenantScope() for Mongo filters.
import { tenantforge, tenantScope } from "@mr-aftab-ahmad-khan/tenantforge";
app.use(tenantforge({ allowList: new Set(process.env.TENANT_ALLOWLIST!.split(",")) }));
app.get("/items", async (req, res) => {
const items = await Item.find(tenantScope(req.tenantId));
res.json(items);
});License
MIT
