Welcome to the PMF App Template

About This Template

This is a production-ready multi-tenant application template with comprehensive authentication and role-based access control. The system supports multiple organizations, each with their own isolated data and user management, making it ideal for B2B SaaS applications.

The multi-tenancy structure operates on two levels: system-level and organization-level. At the system level, developers and platform maintainers have sysadmin privileges with full access across all organizations. At the organization level, each organization has its own admins who manage their team members and resources. Regular users belong to one or more organizations with either admin or member roles, determining their permissions within that organization's scope.

To access the platform, system administrators should use the Internal Login button, while organization admins and members use the standard Login button. Guest users can also access the platform with limited permissions as granted by organization or system administrators.

Getting Started

Run Local Environment

pnpm dev

Initialize Codebase

pnpm run init

This sets up SSH, creates Dokku apps, databases, runs migrations, creates admin user, and seeds test data.

Init Options

  • pnpm run init:ssh- Setup SSH keys
  • pnpm run init:seed- Seed test data
  • pnpm run init:sysadmin- Create sysadmin
Documentation

Detailed documentation for each layer of the application:

Main Documentation

README.md

Project overview, quick start, and technology stack

Database Layer

src/lib/db/README.md

Kysely setup, connection pooling, migrations, and type generation

Additional documentation referenced in main README:
  • scripts/init/README.md (initialization)
  • scripts/migrate/README.md (migrations)
  • scripts/destroy/README.md (cleanup)