Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
"Bash(git push:*)",
"Bash(cat:*)",
"Bash(git check-ignore:*)",
"Bash(git restore:*)"
"Bash(git restore:*)",
"Bash(supabase status:*)",
"Bash(supabase stop:*)",
"Bash(supabase start:*)"
],
"deny": []
}
},
"enableAllProjectMcpServers": false
}
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Supabase Local Development Configuration
# Copy this file to .env.local - these values are the same for all local Supabase instances

# Local Supabase instance (these are standard local development keys)
PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU

# Optional: Email service for production (not needed for local development)
EMAIL_SERVICE_KEY=your_email_service_key

# Production Database Configuration (for seeding test data in production)
# NOTE: For Vercel deployment, set these as environment variables in Vercel dashboard
# Get DATABASE_URL from your Supabase project settings > Database > Connection string
# Format: postgresql://[user]:[password]@[host]:[port]/[database]
DATABASE_URL=postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres

# Alternative: Individual database connection parameters (if not using DATABASE_URL)
# Set these in Vercel environment variables for production deployment
# DB_HOST=db.[project-ref].supabase.co
# DB_PORT=5432
# DB_USER=postgres
# DB_PASSWORD=your_production_password
# DB_NAME=postgres
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ lerna-debug.log*
.cache

# Supabase
/supabase/config.toml
/supabase/*.env
/supabase/dev.env
/supabase/prod.env
Expand Down
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"supabase.projectUrl": "http://127.0.0.1:54321",
"supabase.anonKey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
}
74 changes: 60 additions & 14 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A digital workplace passport application that helps neurodivergent employees doc
- Authentication: Supabase Magic Link
- Testing: Vitest
- Hosting: Vercel
- Development: Supabase environments (no local instances)
- Development: Local Supabase instance via Docker
- Database Management: Supabase CLI

## Code Style & Conventions
Expand Down Expand Up @@ -79,26 +79,40 @@ describe('MyComponent', () => {

## Environment Setup

- Required environment variables:
- `PUBLIC_SUPABASE_URL`
- `PUBLIC_SUPABASE_ANON_KEY`
- `SUPABASE_SERVICE_KEY` (server-only)
- Required environment variables (for local development):
- `PUBLIC_SUPABASE_URL=http://127.0.0.1:54321`
- `PUBLIC_SUPABASE_ANON_KEY` (from supabase status)
- `SUPABASE_SERVICE_KEY` (from supabase status, server-only)
- `EMAIL_SERVICE_KEY` (for sending emails)

- Supabase environments:
- Development, staging, and production projects in Supabase
- No local Supabase instance required
- Environment-specific database and auth settings
- **Development**: Local Supabase instance via Docker
- **Production**: Remote Supabase project
- Local instance provides full Supabase stack including Auth, Database, Storage, and Email testing

- Database seeding strategy:
- `supabase/seed.sql`: Real questions data (auto-runs with `supabase db reset`)
- `supabase/test_data_seed.sql`: Fake test data (run separately with script)
- `scripts/seed-test-data.sh`: Environment-aware script for adding test data

- Setup commands:
```bash
# Install dependencies
npm install

# Copy environment template
# Install Supabase CLI globally
npm install -g supabase

# Start local Supabase instance
supabase start

# Copy environment template and configure for local development
cp .env.example .env.local

# Fill in environment variables with appropriate Supabase project keys
# Set local environment variables:
# PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
# PUBLIC_SUPABASE_ANON_KEY=[anon key from supabase status]
# SUPABASE_SERVICE_KEY=[service_role key from supabase status]
```

## Common Commands
Expand All @@ -120,10 +134,17 @@ npm run check # TypeScript type checking
# Development server
npm run dev

# Database commands
./supabase/scripts/push-dev.sh # Push schema to development environment
./supabase/scripts/push-prod.sh # Push schema to production environment
npx supabase db reset # Reset and seed database
# Local Supabase commands
supabase start # Start local Supabase instance
supabase stop # Stop local Supabase instance
supabase status # Check status and get keys
supabase db reset # Reset and seed local database with questions
supabase db push # Push schema changes to production

# Database seeding commands
./scripts/seed-test-data.sh # Add test data (works local and production)
# Local: uses default postgres password
# Vercel: requires DATABASE_URL environment variable
```

## Project Structure
Expand Down Expand Up @@ -172,6 +193,31 @@ Before submitting any code, ensure the following steps are completed:
- [ ] Documentation updated
- [ ] Accessibility checked

## Deployment (Vercel)

### Environment Variables Setup

Set these environment variables in Vercel dashboard (Settings > Environment Variables):

**Required for application:**
- `PUBLIC_SUPABASE_URL` - Your production Supabase project URL
- `PUBLIC_SUPABASE_ANON_KEY` - Your production Supabase anon key
- `SUPABASE_SERVICE_KEY` - Your production Supabase service role key
- `EMAIL_SERVICE_KEY` - For sending emails

**Optional for test data seeding:**
- `DATABASE_URL` - Full PostgreSQL connection string (get from Supabase > Settings > Database)
- Format: `postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres`

### Seeding Test Data in Production

```bash
# After deploying to Vercel, if you want to add test data:
# 1. Set DATABASE_URL environment variable in Vercel
# 2. Run locally with production env vars, or
# 3. Use Vercel CLI: vercel env pull && ./scripts/seed-test-data.sh
```

## Known Issues & Workarounds

- Supabase has limited support for transactions - use client-side data validation as additional protection
Expand Down
11 changes: 6 additions & 5 deletions HITL_Docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@
- **Authentication**: Supabase Magic Link
- **API**: SvelteKit server routes + Supabase client
- **Testing**: Vitest with mocked Supabase client
- **Database Management**: Supabase CLI for schema migrations (via `./supabase/scripts/push-dev.sh` scripts) and seeding
- **Database Management**: Supabase CLI for schema migrations and local development

### Infrastructure

- **Hosting**: Vercel
- **Environments**:
- Development
- Production
- **Database**: Supabase environments (no local instances required)
- Separate Supabase projects for each environment
- **Development**: Local Supabase instance via Docker
- **Production**: Remote Supabase project
- **Database**:
- Local development uses Docker-based Supabase stack
- Production uses remote Supabase project
- Environment-specific configuration and credentials

## Project Structure
Expand Down
Loading