Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.refactkit.com/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through getting RefactKit running on your machine for the first time. By the end you will have a fully functional multi-tenant app with authentication, organizations, and role-based access running at http://localhost:3000.
RefactKit requires a PostgreSQL database. The recommended option is Supabase, which provides a free-tier hosted PostgreSQL instance with connection pooling pre-configured. Create a Supabase project before continuing — you will need the database connection string and your project URL in the next steps.
1

Clone the repository

Clone RefactKit and move into the project directory.
git clone https://github.com/devh2t/RefactKit-multitenancy.git my-app
cd my-app
2

Install dependencies

RefactKit uses pnpm as its package manager. Install it if you don’t have it, then install all project dependencies.
npm install -g pnpm
pnpm install
3

Configure your environment

Copy the example environment file to .env and fill in your values.
cp .env.example .env
At minimum, set these four variables to get the app running:
DATABASE_URL="postgresql://postgres.your-project-id:your_db_password@aws-0-region.pooler.supabase.com:6543/postgres"
BETTER_AUTH_SECRET="your_random_32_character_secret_string"
BETTER_AUTH_URL="http://localhost:3000"
VITE_APP_URL="http://localhost:3000"
You can generate a secure value for BETTER_AUTH_SECRET with:
openssl rand -base64 32
For a full explanation of every environment variable — including Supabase storage, SMTP email, and production settings — see the environment setup guide.
4

Push the database schema

RefactKit uses Drizzle ORM. Run drizzle-kit push to create all required tables in your PostgreSQL database. This reads your DATABASE_URL from .env and applies the schema defined in db/schema.ts.
npx drizzle-kit push
You should see output confirming that each table — user, session, account, verification, organization, member, invitation, and gallery_image — was created successfully.
After pushing your schema you can explore and edit your data visually by running npx drizzle-kit studio.
5

Start the development server

Start the Vite development server. RefactKit runs on port 3000 by default.
pnpm dev
Open http://localhost:3000 in your browser. You will be redirected to the login page. Create an account using the sign-up form, verify your email, and you will land on the onboarding flow where you can create your first organization.

What you can do next

Once your dev server is running, here are the most common next steps:

Add your first route

Learn how to create organization-scoped pages using TanStack Router’s file-based routing.

Extend the database schema

Add new tables to db/schema.ts and push changes with npx drizzle-kit push.

Configure email sending

Set up your Resend API key so invitation and verification emails are delivered.

Enable file uploads

Configure Supabase Storage so users can upload avatars and organization logos.

Available scripts

CommandDescription
pnpm devStart the development server at http://localhost:3000
pnpm buildBuild for production (Vercel/Nitro preset)
pnpm startRun the production build locally
pnpm testRun Biome checks and Vitest unit tests
pnpm test:e2eRun Playwright end-to-end tests
pnpm test:coverageGenerate a coverage report in the coverage/ directory
pnpm formatFormat all files with Biome
npx drizzle-kit pushSync your schema to the database
npx drizzle-kit studioOpen the Drizzle Studio database UI