A React + TypeScript lease tracking application with Supabase backend and Clerk authentication.
Create a .env file in the root directory with the following variables:
# Supabase Configuration
VITE_SUPABASE_URL=https://your-project-ref.supabase.co
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key_here
# Clerk Configuration
VITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key_here
# Clerk Domain (required for Supabase + Clerk integration)
CLERK_DOMAIN=your-production-domain.clerk.accounts.dev-
Install dependencies:
pnpm install
-
Start Supabase locally (optional for local development):
pnpm run supabase:start
-
Start the development server:
pnpm run dev
The project uses Supabase with the following schema:
- projects: Main lease tracking projects (includes public sharing functionality)
- project_contacts: Client contacts for each project
- client_requirements: Categorized requirements per project
- project_roadmap: Project phases and milestones
- properties: Properties of interest for each project
- property_features: Features for each property
- project_documents: Documents associated with projects
- project_updates: Activity log for each project
Apply the complete schema using the consolidated migration file:
-
Using Supabase CLI (if available):
supabase db push
-
Using Supabase Dashboard:
- Go to your Supabase dashboard
- Navigate to the SQL Editor
- Copy and paste the contents of
supabase/migrations/00_complete_schema.sql - Execute the migration
The consolidated migration sets up:
- Core Tables: All lease tracking tables with proper relationships
- Row Level Security (RLS): Multi-tenant security policies
- Optimized Indexes: Performance-optimized database indexes
- Storage Setup: Document storage bucket with proper permissions
- Public Sharing: Functions and permissions for read-only project sharing
- Anonymous Access: Secure functions for public project viewing
The remote database has been linked and reset with migrations applied. To update seed data with correct user IDs:
- Connect to your remote database
- Update the
clerk_user_idin the projects table:UPDATE projects SET clerk_user_id = 'your_actual_clerk_user_id' WHERE clerk_user_id = 'user_2yHntOGKi6N4kXscdHcJrYjEpWN';
The system includes a public sharing feature that allows project owners to generate shareable links for read-only access.
-
For Project Owners:
- Navigate to any project page (
/projects/:id) - Click the "Copy Public Link" button in the header
- Share the generated URL with clients or stakeholders
- Navigate to any project page (
-
For Public Viewers:
- Visit the shared URL (e.g.,
https://yourapp.com/share/{shareId}) - View project details, updates, properties, roadmap, and documents in read-only mode
- Download documents (if available)
- Visit the shared URL (e.g.,
- Read-only Access: Public viewers cannot edit or modify any data
- Selective Sharing: Only projects with generated share IDs are accessible publicly
- Secure Functions: Database functions use
SECURITY DEFINERto bypass RLS safely - No Authentication Required: Public links work without user accounts
- Non-guessable URLs: Public URLs use UUIDs for security
To revoke public access to a project:
UPDATE projects
SET public_share_id = NULL
WHERE id = 'your-project-id';-
Build the project:
pnpm run build
-
Deploy the
distfolder to Netlify -
Set environment variables in Netlify dashboard
Important Notes for Production:
- CLERK_DOMAIN: Required for Supabase + Clerk integration. Use your production Clerk domain (e.g.,
your-app.clerk.accounts.devor your custom domain) - VITE_CLERK_PUBLISHABLE_KEY: Make sure to use your production Clerk publishable key (starts with
pk_live_instead ofpk_test_) - Supabase URLs: Use your remote Supabase project URL, not the local development URL
-
Build the project:
pnpm run build
-
Serve the
distfolder with any static hosting service
- Frontend: React + TypeScript + Vite
- Styling: Tailwind CSS
- Database: Supabase (PostgreSQL)
- Authentication: Clerk
- Deployment: Netlify
src/
├── components/ # React components
│ ├── PublicProjectPage.tsx # Main public sharing page
│ ├── PublicProjectHeader.tsx # Read-only header
│ ├── PublicRecentUpdates.tsx # Public updates view
│ ├── PublicPropertiesOfInterest.tsx
│ ├── PublicProjectRoadmap.tsx
│ └── PublicProjectDocuments.tsx
├── lib/ # Utility libraries (Supabase client, public API)
├── assets/ # Static assets
│ └── design/ # Logo and design assets
├── App.tsx # Main application component
└── main.tsx # Application entry point
supabase/
├── migrations/ # Database migrations
│ └── 00_complete_schema.sql # Consolidated migration file
├── seed.sql # Sample data
└── config.toml # Supabase configuration
Configuration files:
├── package.json # Dependencies and scripts
├── vite.config.ts # Vite configuration
├── tailwind.config.js # Tailwind CSS configuration
└── tsconfig.json # TypeScript configuration