A digital workplace passport application that helps neurodivergent employees document and share their workplace needs with line managers, promoting a more inclusive workplace environment.
Caution
Documentation Accuracy
This documentation is not up to date with the latest feature set & build. Many dev tools have been packaged in scripts. Start with ./package.json
.
- 1. Technology Stack
- 2. Prerequisites
- 3. Development Setup
- 4. Database Management
- 5. Troubleshooting
- 6. Development Scripts
- 7. Project Structure
- 8. Documentation
Area | Technology |
---|---|
Frontend Framework | Svelte 5 |
Fullstack Framework | SvelteKit |
Utility Classes | TailwindCSS |
Component Classes | DaisyUI |
DB Query Language | PostgreSQL |
Database Hosting | Supabase |
Auth Provider | Supabase (Magic Link) |
Testing | Vitest |
@testing-library/svelte |
Before starting development, ensure you have the following installed:
# Check your version
node --version
Download from nodejs.org if needed.
- macOS: Docker Desktop for Mac
- Windows: Docker Desktop for Windows
- Linux: Docker Engine installation
# Verify Docker is running
docker --version
docker ps
# Check if installed
git --version
Required for Linux, particularly Ubuntu. This is needed for the seed scripts to work correctly with Supabase.
# Check if installed
psql --version
# If not installed (Ubuntu/Debian)
sudo apt-get update && sudo apt-get install postgresql-client
# If not installed (Fedora/RHEL)
sudo dnf install postgresql
git clone https://github.com/foundersandcoders/LIFT02.git
cd LIFT02
npm install
cp .env.example .env.local
Note: The .env.example
already contains the correct local development keys that Supabase always uses.
# Using npm
npm install supabase --save-dev
# Using Homebrew (macOS)
brew install supabase/tap/supabase
For other installation options, see the Supabase CLI docs.
supabase start
- If Supabase Docker containers are not already downloaded, this command will automatically download them (~2-3GB total)
- The download may take 5-15 minutes depending on your internet connection
- Docker Desktop must be running before executing this command
- All database migrations will be automatically applied
# Start the development server
npm run dev
# In another terminal, check Supabase Studio
open http://127.0.0.1:54323
Your local Supabase instance runs entirely in Docker containers. The database schema is automatically applied from the migrations when you start the instance.
# Start the local Supabase stack
supabase start
# Check status and get connection details
supabase status
# Reset local database (clears data and re-applies migrations + questions seed)
supabase db reset
# Stop the local instance
supabase stop
The project uses a two-tier seeding strategy to separate real data from test data:
- File:
supabase/seed.sql
- Content: Real workplace passport questions
- Auto-runs: Automatically applied when you run
supabase db reset
- Purpose: Contains the actual questions users will answer
- File:
supabase/test_data_seed.sql
- Content: Fake users, responses, actions, and sharing events
- Manual: Run separately when you need test data
- Purpose: Provides realistic test data for development and testing
After resetting your database, add test data for development:
# Reset database (includes questions)
supabase db reset
# Add test data (5 fake users with comprehensive responses)
# Make script executable first (if needed)
chmod +x ./scripts/local-seed-test-data.sh
./scripts/local-seed-test-data.sh
What the test data includes:
- 5 fake users with diverse profiles
- Multiple responses across all question categories
- Some questions answered multiple times (different versions)
- Mix of answered and skipped questions
- Workplace adjustments and actions linked to responses
- Sample sharing events with line managers
The prod-seed-test-data.sh
script automatically detects your environment:
Local Development:
- Detects local Supabase instance
- Uses default
postgres
password (no prompts) - Connects to
127.0.0.1:54322
Production/Vercel:
- Uses environment variables from Vercel dashboard
- Requires
DATABASE_URL
to be set - Connects to production Supabase instance
When ready to deploy schema changes to production:
If this is your first time pushing to production, you need to link your local project:
-
Login to Supabase CLI:
supabase login
This will open a browser window for authentication.
-
Link your local project to the remote Supabase project:
supabase link --project-ref YOUR_PROJECT_REF --password "YOUR_DB_PASSWORD"
Important: When prompted to "Enter your database password (or leave blank to skip):", press Enter to skip. This avoids IPv6 connection issues while still linking the project successfully.
-
Push schema changes:
supabase db push
Once linked, you can push schema changes using one of these methods:
# Push local schema changes to production Supabase project
npx supabase db push --password 'YOUR_DB_PASSWORD'
# Make script executable first (if needed)
chmod +x ./scripts/prod-run-migrations.sh
# Uses environment variables from .env.production
./scripts/prod-run-migrations.sh
# Push local schema changes to production Supabase project
npx supabase db push
If you need test data in your production environment (e.g., for demos or testing):
-
Set environment variables in Vercel dashboard:
- Go to your Vercel project → Settings → Environment Variables
- Add
DATABASE_URL
with your production Supabase connection string - Format:
postgresql://postgres:[password]@db.[project-ref].supabase.co:5432/postgres
-
Run the seeding script:
# Make script executable first (if needed) chmod +x ./scripts/prod-seed-test-data.sh # Option 1: Run locally with production env vars vercel env pull .env.production source .env.production ./scripts/prod-seed-test-data.sh # Option 2: Run with environment variables directly DATABASE_URL="your-production-url" ./scripts/prod-seed-test-data.sh
Generate TypeScript types from your local database schema:
supabase gen types typescript --local > src/lib/types/supabase.ts
When running locally, you can access:
- API:
http://127.0.0.1:54321
- Database:
postgresql://postgres:[email protected]:54322/postgres
- Studio:
http://127.0.0.1:54323
- Email Testing (Inbucket):
http://127.0.0.1:54324
-
"Docker not found" error
- Ensure Docker Desktop is installed and running
- Try restarting Docker Desktop
- On Windows: Make sure you're using PowerShell or Command Prompt as Administrator
-
Port conflicts (ports 54321-54327 already in use)
# Stop any existing Supabase instances supabase stop # If that doesn't work, find and kill processes using the ports lsof -ti:54321 | xargs kill -9
-
Migration errors or missing tables
# Reset and reapply all migrations supabase db reset
-
VS Code Supabase extension can't connect
- Use URL:
http://127.0.0.1:54321
(not https) - Get anon key from
supabase status
- Try reloading VS Code window
- Use URL:
-
Slow Docker image downloads
- Initial setup downloads ~2-3GB of Docker images
- Consider running setup during good internet connectivity
- Images are cached after first download
-
First time setup prompts
- When running
supabase start
for the first time, you may be prompted to runsupabase init
first - Run
supabase init
as instructed - When prompted if you want to set up Edge Functions with Deno, answer "No"
- After initialization is complete, run
supabase start
again
- When running
-
Docker Architecture Mismatch
- If you see errors like
exec /usr/bin/sh: exec format error
, it means you're trying to run Docker containers built for a different CPU architecture
For Apple Silicon (M1/M2) users:
# Force pull ARM64 images docker pull --platform=linux/arm64 supabase/postgres:15.1.0 docker pull --platform=linux/arm64 supabase/edge-runtime:v1 # (add other images as needed)
For Intel/AMD users:
# Force pull AMD64 images docker pull --platform=linux/amd64 supabase/postgres:15.1.0 docker pull --platform=linux/amd64 supabase/edge-runtime:v1 # (add other images as needed)
You may need to specify the platform in your Docker configuration:
# Example adding platform to supabase start DOCKER_DEFAULT_PLATFORM=linux/amd64 supabase start # For Intel/AMD # or DOCKER_DEFAULT_PLATFORM=linux/arm64 supabase start # For Apple Silicon
If you continue having issues, try:
- Remove existing containers:
supabase stop && docker system prune -a
- Set the default platform before starting:
export DOCKER_DEFAULT_PLATFORM=linux/[your-arch]
- Restart Supabase:
supabase start
- If you see errors like
If you encounter issues not covered here:
- Check
supabase status
for service health - Check
docker ps
to see running containers - Check the Supabase CLI docs
Start the development server:
npm run dev
# or open in a new browser tab
npm run dev -- --open
Run tests with Vitest:
# Run all tests
npm run test
# Run tests in watch mode
npm run test:unit
# Run with coverage
npm run test -- --coverage
# Format code
npm run format
# Lint code
npm run lint
# Type checking
npm run check
npm run build
npm run preview
The project follows a standard SvelteKit structure:
.
├── docs
├── scripts
├── src
│ ├── lib
│ │ ├── components
│ │ │ ├── cards
│ │ │ ├── layouts
│ │ │ ├── logic
│ │ │ ├── ui
│ │ │ └── views
│ │ ├── services
│ │ │ └── database
│ │ ├── types
│ │ └── utils
│ └── routes
├── static
│ └── logo
└── supabase
├── data
├── generated
└── migrations
[!WARNING] WIP