# Railway CLI Deployment

Run these commands in your terminal (not through Claude):

## Step 1: Navigate to Project

```bash
cd /Users/lars/mycode/buzztrail/extension/apps/slide-system
```

## Step 2: Initialize Railway Project

```bash
railway init
```

This will:
- Create a new Railway project
- Link your local directory to it
- Prompt you for project name (e.g., "motia-step" or "slide-system")

## Step 3: Set Environment Variables

```bash
# Daily.co
railway variables set DAILY_API_KEY="d5d545965205921e0b71a5d5160b01ce8be558e6e2dfeb2961756ac31eac5528"

# Supabase
railway variables set SUPABASE_URL="https://dwdytxxqcvlrmyemonxz.supabase.co"

railway variables set SUPABASE_SERVICE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImR3ZHl0eHhxY3Zscm15ZW1vbnh6Iiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImlhdCI6MTc1OTg2NDU1MywiZXhwIjoyMDc1NDQwNTUzfQ.5Uf2zXKAqcxE3XQ4gxB8lbph7z4JZEXxtgINTPJnTMk"

# Node environment
railway variables set NODE_ENV="production"
```

## Step 4: Deploy

```bash
railway up
```

This will:
- Build your Docker container
- Deploy to Railway
- Show deployment progress

## Step 5: Get Your URL

```bash
railway domain
```

Or generate a new domain:

```bash
railway domain --generate
```

## Step 6: View Logs

```bash
railway logs
```

## Expected Output

After `railway up` succeeds, you should see:
- Build logs showing Docker build
- Deployment URL
- Service status: Running

## Next Steps

Once you get the Railway URL (e.g., `https://slide-system-production.railway.app`):

1. Test the endpoint:
   ```bash
   curl -X POST https://YOUR-APP.railway.app/steps/demo-session-orchestration/execute \
     -H "Content-Type: application/json" \
     -d '{"input": {"session_type": "test"}}'
   ```

2. Update Supabase Edge Function with the Railway URL

3. Test end-to-end flow

---

**Troubleshooting:**

If `railway up` fails:
- Check logs: `railway logs`
- Verify environment variables: `railway variables`
- Check build status in Railway dashboard

If domain generation fails:
- Go to Railway dashboard → Settings → Networking → Generate Domain
