Back to .md Directory

Phantom Equinox - Project Context

Documents a multi-tenant meeting room booking app built with Next.js 16, Supabase, and Tailwind CSS 4.

May 2, 2026
0 downloads
0 views
ai
View source

What this file does

Documents a multi-tenant meeting room booking app built with Next.js 16, Supabase, and Tailwind CSS 4.

When to use it

  • Onboarding new developers to the Phantom Equinox codebase
  • Reviewing the tech stack and directory structure before contributing
  • Setting up the admin backend and promoting the first admin user
  • Understanding the data model and RLS policies for the booking system

Assumes this stack

Next.js 16TypeScriptTailwind CSS 4SupabaseFramer MotionReact Hook Form

Phantom Equinox - Project Context

Overview

Phantom Equinox is a premium Meeting Room Booking Application built with modern web technologies. It is designed to handle multi-tenant corporate environments (Companies), allowing users to book meeting rooms across different buildings and floors.

Technology Stack

Core

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript
  • Style: Tailwind CSS 4
  • Animation: Framer Motion

Backend & Database

  • Platform: Supabase (PostgreSQL)
  • Auth: Supabase Auth (with Middleware protection)
  • Email: Resend (implied by dependencies)

UI Components

  • Icons: Lucide React
  • Forms: React Hook Form + Zod resolvers
  • Notifications: Sonner
  • Theming: next-themes (System, Light, Dark)

Architecture & Directory Structure

/
├── app/                  # Next.js App Router pages and layouts
│   ├── admin/            # Administrative interfaces
│   ├── bookings/         # Booking management
│   ├── login/            # Authentication pages
│   ├── rooms/            # Room browsing and details
│   ├── schedule/         # Calender/Schedule views
│   ├── settings/         # User settings
│   ├── api/              # API Routes (if any)
│   ├── globals.css       # Global styles and Tailwind directives
│   └── layout.tsx        # Root layout with Providers
├── components/           # Reusable UI components
├── db/                   # Database schemas and SQL scripts
│   └── schema.sql        # Main database definition
├── lib/                  # Utility functions and shared logic
│   └── supabase/         # Supabase client initialization
├── public/               # Static assets
└── types/                # TypeScript type definitions

Data Model

Core Entities

  1. Companies: Tenants of the system.
  2. Profiles: Users linked to auth.users, containing role (admin vs user) and company association.
  3. Buildings: Physical locations owned by companies.
  4. Floors: Levels within buildings.
  5. Rooms: Bookable entities with capacity and amenities.
  6. Bookings: Reservations linking Users and Rooms with time slots and status.

Authentication & Authorization

  • RLS (Row Level Security) is enabled on all tables.
  • Policies:
    • Public read access for Buildings, Floors, and Rooms.
    • Users can see all bookings (to avoid double booking) but only edit their own.
    • Admins can manage all bookings.

Development

Commands

  • `npm run dev`: Start development server
  • `npm run build`: Build for production
  • `npm run lint`: Run ESLint

Key Conventions

  • Styling: Utility-first with Tailwind.
  • State Management: Server Components for data fetching where possible; Client Components for interactivity.
  • Database Access: Direct Supabase calls or Server Actions (implied by typical Next.js 14+ patterns, though actions folder exists).

Current Status

  • Auth: Implemented via Supabase Middleware.
  • Database: Schemas defined for core entities.
  • Routing: Skeleton routes exist for Admin, Bookings, Login, Rooms, Schedule, Settings.

Admin Guide

1. Setup

To enable the Admin backend, you must run the following SQL scripts in your Supabase SQL Editor:

  1. db/01_auth_triggers.sql: Required. Creates a user profile automatically upon sign-up.
  2. db/02_admin_policies.sql: Required. Secures the database so only Admins can manage resources.

2. Creating an Admin

There is no UI to create the first admin. You must promote a user manually:

  1. Sign up in the application.
  2. Open db/03_promote_admin.sql.
  3. Replace the email with your email and run the script in Supabase.

3. Features

Once promoted, you can access /admin to:

  • Dashboard: Approve or Reject pending bookings.
  • Buildings: Manage office buildings (/admin/buildings).
  • Floors: Manage floors within buildings (/admin/floors).
  • Rooms: Manage meeting rooms (/admin/rooms).

What's inside

6 sections: Overview, Tech Stack, Architecture, Data Model, Development, Admin Guide. Lists 7 core entities and 3 SQL scripts.

Change this for your project

  • Replace Phantom Equinox with your own project name
  • Replace DefinitionGroup/booking-LPBC2026 with your repository name
  • Replace the email placeholder in db/03_promote_admin.sql with your own email

Where it goes

Keep it in your repository where the agent or team that needs it will read it.

Worth borrowing

  • Separating SQL scripts into numbered files (auth triggers, admin policies, promote admin) for step-by-step setup
  • Using RLS policies that grant public read access to buildings/floors/rooms while restricting booking edits to owners and admins

Related Documents