Multi-tenancy & teams

The “teams” feature in SveltePak introduces multi-tenancy capabilities to your application, enabling users to form teams and collaboratively manage data within their respective teams.

Additionally, subscription plans are implemented at the team level for enhanced flexibility.

When a user sign up, a personal team is automatically created for them. This personal team is used to manage the user’s personal data and is distinct from other teams.

This team can’t be deleted, and the user can’t leave it. It’s used to manage the user’s personal data and is distinct from other teams.

This is similar to platforms like Vercel.

To opt-out of multi-tenancy

Should you decide against utilizing the teams feature, it can be seamlessly deactivated.

Given that a default team is automatically generated for each user, you shall not delete the Teams models from the database schema. Doing this would require you to remap the entire application to the new schema, which is not recommended.

Instead, you can simply remove the team-related UI components and server-side logic from your application.

A really simple solution would be to remove the TeamSwitcher from the header.

lib/components/header/header.svelte
// import TeamSwitcher from './team-switcher.svelte'

{#if $user}
  <span class="text-secondary ml-4 mr-2">/</span>
  <TeamSwitcher /> // Remove this line
{:else}
  <a href="/blog" class="ml-4">{$_("Blog")}</a>
  <a href="/pricing" class="ml-4">{$_("Pricing")}</a>
{/if}

Complementary you may also disable the teams from the tRPC routes.

trpc/routes/index.ts
// import { teams } from "./teams";

export const routes = {
  // ...teams
};

By doing this the user would not be allowed to switch or create teams, and the application would behave as a single-tenant application.