Skip to content

Repository files navigation

Apex SaaS Platform

Apex is a modern, high-performance, multi-tenant SaaS platform built with Next.js 16, PostgreSQL, and Clerk Authentication. It features a "Shared Database, Shared Schema" architecture with strict Row-Level Security (RLS) for enterprise-grade data isolation.

Features

  • Multi-Tenancy: Subdomain-based routing (tenant-a.localhost, admin.localhost).
  • Data Isolation: Secure PostgreSQL RLS ensuring tenants never see each other's data.
  • Enterprise Auth: Clerk Organization support mapped to database tenants.
  • Real-time Events: Pusher integration for live activity feeds.
  • Super Admin Dashboard: Centralized management for provisioning and analytics.
  • Premium UI: Glassmorphism, Framer Motion animations, and modern aesthetics.

Tech Stack

  • Framework: Next.js 16 (App Router)
  • Database: PostgreSQL (Dockerized)
  • ORM: Drizzle ORM
  • Auth: Clerk
  • Real-time: Pusher
  • Styling: Tailwind CSS v4, Framer Motion
  • Testing: Playwright

Getting Started

Prerequisites

  • Node.js 20+
  • Docker & Docker Compose
  • Clerk Account
  • Pusher Account

Environment Variables

Copy .env.example to .env.local (create it if missing) and populate:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
DATABASE_URL=postgres://postgres:password@localhost:5432/apex
NEXT_PUBLIC_PUSHER_KEY=...
NEXT_PUBLIC_PUSHER_CLUSTER=...
pusher_app_id=...
pusher_secret=...
NEXT_PUBLIC_ROOT_DOMAIN=localhost:3000

Installation

  1. Start the database:

    docker-compose up -d
  2. Install dependencies:

    npm install
  3. Run migrations:

    npm run db:push
  4. Start the development server:

    npm run dev

Usage

1. Landing Page

Visit http://localhost:3000 to see the public marketing page.

2. Tenant Dashboard

Visit http://tenant-a.localhost:3000 (or any subdomain) to access the isolated tenant environment.

3. Admin Dashboard

Visit http://admin.localhost:3000 to access the Super Admin Dashboard.

  • Manage Tenants (Create, Delete)
  • View Global Analytics

Architecture

See ARCHITECTURE.md for a deep dive into the system design, RLS policies, and request flow.

About

Apex is a modern, high-performance, multi-tenant SaaS platform built with Next.js 16, PostgreSQL, and Clerk Authentication. It features a "Shared Database, Shared Schema" architecture with strict Row-Level Security (RLS) for enterprise-grade data isolation.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages