npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nuxt-multi-tenancy

v1.2.3

Published

Nuxt Multi-tenancy module

Downloads

698

Readme

Nuxt 3 Multi-tenancy

Nuxt 3 Multi-tenancy module for building multi-tenant applications on Nuxt 3

Features

⛰  Multi-tenancy Nuxt dynamic tenant sites support by subdomains

🌻  Multiple Nuxt app sites in pages folder

🦄  Custom domain for each tenant route in pages folder

✨  A fully functional sample playground deployed on Vercel

Quick Setup

  1. Add nuxt-multi-tenancy dependency to your project
# Using pnpm
pnpm add -D nuxt-multi-tenancy

# Using yarn
yarn add --dev nuxt-multi-tenancy

# Using npm
npm install --save-dev nuxt-multi-tenancy
  1. Add nuxt-multi-tenancy to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'nuxt-multi-tenancy'
  ]
})
  1. If you want to use dynamic tenants, create [site] folder under your Nuxt pages 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 ✨

  1. If you want to have some additional system sites to be serving as a sub domain, for example: jobs page to be serving as https://jobs.nuxtdev.xyz/

Configure the sites property to add the list of tenant you want to be serving as system sites.

export default defineNuxtConfig({
  modules: ['nuxt-multi-tenancy'],
  multiTenancy: {
    tenantDynamicRoute: 'site',
    rootDomains: ["nuxtdev.local", "nuxtdev.xyz"],
    sites: ['jobs']
  },
})
  1. If you want to custom domain for each tenant route, configure the customDomains property a map with key of domain and value of mapping tenant route. For example: nuxtnews.com to news route.
export default defineNuxtConfig({
  modules: ['nuxt-multi-tenancy'],
  multiTenancy: {
    tenantDynamicRoute: 'site',
    rootDomains: ["nuxtdev.local", "nuxtdev.xyz"],
    customDomains: {
      "nuxtnews.com": "news"
    }
  },
})

Options

Configure Nuxt Multi-tenancy module with the multiTenancy property.

export default defineNuxtConfig({
  modules: ['nuxt-multi-tenancy'],
  // default options
  multiTenancy: {
    tenantDynamicRoute: 'site',
    rootDomains: ["nuxtdev.local", "nuxtdev.xyz"],
    sites: [],
    customDomains: {},
  },
})

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

Demo

You can view the demo at nuxtdev.xyz

Features:

  • A home page to list top first 30 articles from dev.to
  • Tenant detail page. For example: The Dev Team organization
  • A custom static tenant page. For example: VueJobs
  • An article detail page

Contributing

  • Open an issue if you believe you've encountered a bug with the module.

License

MIT License