Skip to main content
Version: 0.7.6

Overview

The @abpjs/tenant-management package provides components for managing tenants in a multi-tenant SaaS application.

npm version

Installation

npm install @abpjs/tenant-management

Required peer dependencies:

npm install @abpjs/core @abpjs/theme-shared

Features

  • Tenant CRUD - Create, read, update, and delete tenants
  • Connection Strings - Manage per-tenant database connections
  • Feature Management - Enable/disable features per tenant

Main Exports

Components

ComponentDescription
TenantManagementModalModal for creating and editing tenants

Hooks

HookDescription
useTenantManagementFull tenant management operations

Services

ServiceDescription
TenantManagementServiceDirect API interaction

Required Permissions

PermissionDescription
AbpTenantManagement.TenantsView tenants
AbpTenantManagement.Tenants.CreateCreate tenants
AbpTenantManagement.Tenants.UpdateUpdate tenants
AbpTenantManagement.Tenants.DeleteDelete tenants
AbpTenantManagement.Tenants.ManageFeaturesManage tenant features
AbpTenantManagement.Tenants.ManageConnectionStringsManage connection strings

Quick Example

import { useTenantManagement, TenantManagementModal } from '@abpjs/tenant-management';
import { useState } from 'react';

function TenantManagementPage() {
const { tenants, loading, createTenant, deleteTenant } = useTenantManagement();
const [isModalOpen, setIsModalOpen] = useState(false);

return (
<div>
<button onClick={() => setIsModalOpen(true)}>Create Tenant</button>

<table>
<thead>
<tr>
<th>Name</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{tenants.map((tenant) => (
<tr key={tenant.id}>
<td>{tenant.name}</td>
<td>
<button onClick={() => deleteTenant(tenant.id)}>Delete</button>
</td>
</tr>
))}
</tbody>
</table>

<TenantManagementModal
isOpen={isModalOpen}
onClose={() => setIsModalOpen(false)}
onSave={() => setIsModalOpen(false)}
/>
</div>
);
}

NPM Package

View on npm: @abpjs/tenant-management

Documentation

  • Tenants - Tenant management operations