nuxt3-multi-tenancy
v1.1.0
Published
Nuxt Multi-tenancy module
Downloads
3
Readme
Nuxt 3 Multi-tenancy
Nuxt 3 Multi-tenancy module for building multi-tenant applications on Nuxt 3
Features
⛰ Multi-tenancy Nuxt sites support by sub-domains
✨ A fully functional sample playground deployed on Vercel
Quick Setup
- Add
nuxt3-multi-tenancy
dependency to your project
# Using pnpm
pnpm add -D nuxt3-multi-tenancy
# Using yarn
yarn add --dev nuxt3-multi-tenancy
# Using npm
npm install --save-dev nuxt3-multi-tenancy
- Add
nuxt3-multi-tenancy
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: ["nuxt3-multi-tenancy"],
});
- Create
[site]
folder under your Nuxtpages
directory, you can check the playground's pages folder for referencing.
That's it! You can now use Nuxt Multi-tenancy in your Nuxt app ✨
Options
Configure Nuxt Multi-tenancy module with the multiTenancy
property.
export default defineNuxtConfig({
modules: ["nuxt3-multi-tenancy"],
// default options
multiTenancy: {
tenantDynamicRoute: "site",
rootDomains: ["nuxtdev.local", "nuxtdev.xyz"],
},
});
useTenant composition API
Use useTenant() to get the tenant ID
import { useTenant } from "#imports";
const tenant = useTenant();
Development
# Install dependencies
yarn install
# Generate type stubs
yarn dev:prepare
# Develop with the playground
yarn dev
# Build the playground
yarn dev:build
# Run ESLint
yarn lint
# Run Vitest
yarn test
yarn test:watch
# Release new version
yarn release