Complete installation and configuration guide for the MagPie Event Registration Platform.
- Prerequisites
- Backend Setup
- Frontend Setup
- Authentication Setup (Clerk)
- WhatsApp Integration (Optional)
- Running the Application
- Troubleshooting
Before you begin, ensure you have the following installed:
- Python 3.11 or higher
- Node.js 18 or higher
- npm or yarn
- Git (for cloning the repository)
cd backend# Create virtual environment
python -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the backend directory:
cp .env.example .envEdit .env and add your credentials:
# Database Configuration (Required for production)
TURSO_DATABASE_URL=libsql://b2lregistration-pandawhocodes.aws-ap-south-1.turso.io
TURSO_AUTH_TOKEN=your_turso_auth_token_here
# Local Development (as of now set to true for local sqlite without Turso)
IS_LOCAL=false
# CORS Configuration
FRONTEND_URL=http://localhost:3000
# Authentication (Required - see Authentication Setup section)
CLERK_SECRET_KEY=sk_test_your_clerk_secret_key_here
# WhatsApp Integration (Optional - see WHATSAPP_SETUP.md)
TWILIO_ACCOUNT_SID=your_account_sid_here
TWILIO_AUTH_TOKEN=your_auth_token_here
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886For local development without requiring Turso database setup:
- Set
IS_LOCAL=truein your.envfile - Leave Turso credentials empty
- The application will automatically use a local SQLite database
# For local development (no Turso required)
TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=
IS_LOCAL=trueBenefits:
- ✅ No external database setup required
- ✅ Full functionality for testing and development
- ✅ Automatic schema creation
- ✅ Data persists locally in
local-dev/magpie_local.db - ✅ Easy to switch between local and production databases
Note: Production deployments should use IS_LOCAL=false with proper Turso credentials.
# Test backend server
python -m app.mainBackend should start on http://localhost:8000
cd frontendnpm install
# or
yarn installCreate a .env file in the frontend directory:
cp .env.example .envEdit .env and add your configuration:
# Backend API URL
VITE_API_URL=http://localhost:8000
# Clerk Authentication (Required - see Authentication Setup section)
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_clerk_publishable_key_here# Test frontend server
npm run dev
# or
yarn devFrontend should start on http://localhost:3000
The dashboard is protected with Clerk authentication. You'll need a Clerk account to access admin features.
-
Sign up at Clerk
- Visit: https://clerk.com
- Click "Get Started for Free"
- Sign up with GitHub, Google, or email
-
Create a New Application
- Click "Create Application"
- Name it (e.g., "MagPie Events")
- Select authentication methods (Email, Google, etc.)
- Click "Create Application"
-
Copy your API keys from the Clerk dashboard:
- Publishable Key:
pk_test_...(starts withpk_) - Secret Key:
sk_test_...(starts withsk_)
- Publishable Key:
-
Add to Backend
.env:CLERK_SECRET_KEY=sk_test_your_actual_key_here
-
Add to Frontend
.env:VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_actual_key_here
-
Set Redirect URLs (in Clerk Dashboard):
- Development:
http://localhost:3000 - Add
/sign-in,/sign-up,/dashboardpaths if needed
- Development:
-
Add Test Users (Optional):
- Go to "Users" in Clerk dashboard
- Click "Create User"
- Add email and password for testing
- Restart both servers after adding keys
- Visit: http://localhost:3000/dashboard
- You should be redirected to sign-in page
- Sign up or sign in with your test user
- ✅ Free Tier: 10,000 monthly active users
- ✅ Pre-built UI: Beautiful sign-in/sign-up forms
- ✅ User Management: Add/remove users via dashboard (no code)
- ✅ Protected Dashboard: Only authenticated users can access
- ✅ Public Registration: Event registration forms remain public
Dashboard Features (Require Authentication):
- Create/edit/delete events
- View all registrations
- Generate QR codes
- Send WhatsApp messages
- Export CSV data
- Configure branding/themes
Public Features (No Authentication):
- Event registration form
- Thank you page
- QR code check-in
- Auto-fill functionality
The WhatsApp bulk messaging feature is optional. To enable it:
-
Sign up for Twilio
- Visit: https://www.twilio.com/try-twilio
- Get FREE trial credit ($15-20)
-
Get Credentials
- Account SID
- Auth Token
- From: Twilio Console Dashboard
-
Activate WhatsApp Sandbox
- Go to: https://console.twilio.com/us1/develop/sms/try-it-out/whatsapp-learn
- Follow activation steps
-
Add to .env
- Add credentials to
backend/.env
- Add credentials to
-
Complete Setup
- See WHATSAPP_SETUP.md for detailed instructions
Without Twilio credentials: All features work except WhatsApp messaging.
cd backend
source venv/bin/activate # On Windows: venv\Scripts\activate
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadcd frontend
npm run dev- Public Registration: http://localhost:3000
- Admin Dashboard: http://localhost:3000/dashboard (requires Clerk sign-in)
- Sign In/Up: http://localhost:3000/sign-in
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Error: "Turso credentials not found"
- Check
.envfile exists inbackend/directory - For production: Verify
TURSO_DATABASE_URLandTURSO_AUTH_TOKENare set - For local development if needed: Set
IS_LOCAL=trueand leave Turso credentials empty if you want to run it via local sqlite
Error: "CLERK_SECRET_KEY not found"
- Check
.envfile hasCLERK_SECRET_KEY=sk_test_... - Get your secret key from https://dashboard.clerk.com
- Restart backend server after adding the key
Error: "Module not found"
# Reinstall dependencies
pip install -r requirements.txtPort 8000 already in use
# Kill process on port 8000 (macOS/Linux)
lsof -ti:8000 | xargs kill -9
# Or use a different port
uvicorn app.main:app --port 8001 --reloadError: "Cannot find module"
# Delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm installPort 3000 already in use
# Kill process on port 3000 (macOS/Linux)
lsof -ti:3000 | xargs kill -9
# Vite will automatically suggest next available portBuild errors
# Clear cache and rebuild
rm -rf dist
npm run buildError: "Clerk publishable key not found"
- Check
frontend/.envhasVITE_CLERK_PUBLISHABLE_KEY=pk_test_... - Get your publishable key from https://dashboard.clerk.com
- Restart frontend server after adding the key
Redirected to sign-in but can't access
- Create a user in Clerk dashboard
- Or sign up with email on the sign-in page
- Make sure Clerk application is properly configured
Dashboard returns 403 Forbidden
- Check both frontend and backend have correct Clerk keys
- Verify you're signed in (check for user button in top-right)
- Try signing out and signing in again
Error: "Twilio credentials not found"
- This is normal if you haven't set up WhatsApp integration
- All other features will work fine
- See WHATSAPP_SETUP.md to enable
Messages not delivering
- Check recipients have joined Twilio sandbox
- Verify credentials are correct in
.env - Check Twilio console for error logs
After setup is complete:
-
Sign In to Dashboard
- Go to http://localhost:3000/dashboard
- Sign in with your Clerk account
- Or create a new account on the sign-in page
-
Create Your First Event
- Click "Create Event" in the dashboard
- Add event details
- Add custom registration fields
- Save and activate the event
-
Test Registration
- Go to http://localhost:3000 (public page)
- Complete the registration form
- You'll see the thank you page after successful registration
-
Explore Dashboard Features
- View registrations
- Export to CSV
- Generate QR codes
- Send WhatsApp messages (if configured)
- Manage message templates
- Configure branding and themes
- Check Troubleshooting section above
- Review SYSTEM_ARCHITECTURE.md
- Create an issue in the repository