Skip to content

Conversation

@thruflo
Copy link
Contributor

@thruflo thruflo commented Dec 22, 2025

This is a blocker for the new Quickstart, because we link to the deployed example.

Summary of Code Changes

The following files have been created or modified:

Created

  • examples/tanstack-db-web-starter/sst.config.ts - SST configuration for deployment

Modified

  • examples/tanstack-db-web-starter/vite.config.ts - Added aws-lambda preset for Nitro (conditional on CI)
  • .github/workflows/deploy_examples.yml - Added quickstart to deployment workflow
  • .github/workflows/deploy_all_examples.yml - Added quickstart to full deployment workflow
  • .github/workflows/teardown_examples_pr_stack.yml - Added quickstart to teardown workflow

Manual Steps for Production Setup

These steps need to be performed once before the first production deployment.

1. Create Neon Database

# Set your Neon API key and project ID
export NEON_API_KEY="your-neon-api-key"
export NEON_PROJECT_ID="your-project-id"

# Get the default branch ID
BRANCH_ID=$(curl -s -H "Authorization: Bearer $NEON_API_KEY" \
  "https://console.neon.tech/api/v2/projects/$NEON_PROJECT_ID/branches" \
  | jq -r '.branches[] | select(.default==true) | .id')

echo "Branch ID: $BRANCH_ID"

# Create the database
curl -X POST "https://console.neon.tech/api/v2/projects/$NEON_PROJECT_ID/branches/$BRANCH_ID/databases" \
  -H "Authorization: Bearer $NEON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"database": {"name": "quickstart-production", "owner_name": "neondb_owner"}}'

2. Get Connection Strings

From the Neon console (https://console.neon.tech):

  1. Navigate to your project
  2. Go to the "quickstart-production" database
  3. Copy both connection strings:
    • Direct: postgresql://neondb_owner:[email protected]/quickstart-production?sslmode=require
    • Pooled: postgresql://neondb_owner:[email protected]/quickstart-production?sslmode=require

3. Apply Migrations

cd examples/tanstack-db-web-starter
DATABASE_URL="postgresql://neondb_owner:[email protected]/quickstart-production?sslmode=require" pnpm drizzle-kit migrate

4. Register with Electric Cloud

# Set your Electric Cloud credentials
export ELECTRIC_ADMIN_API="https://admin-api.electric-sql.com"  # or your admin API URL
export ELECTRIC_ADMIN_API_AUTH_TOKEN="your-token"
export ELECTRIC_TEAM_ID="your-team-id"

# Register the database (replace connection strings with your actual values)
curl -X PUT "$ELECTRIC_ADMIN_API/v1/sources" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ELECTRIC_ADMIN_API_AUTH_TOKEN" \
  -d '{
    "database_url": "postgresql://neondb_owner:[email protected]/quickstart-production?sslmode=require",
    "options": {
      "db_pool_size": 5,
      "pooled_database_url": "postgresql://neondb_owner:[email protected]/quickstart-production?sslmode=require"
    },
    "region": "us-east-1",
    "team_id": "'"$ELECTRIC_TEAM_ID"'"
  }'

Save the response! You'll need:

  • id → This becomes QUICKSTART_SOURCE_ID
  • source_secret → This becomes QUICKSTART_SOURCE_SECRET

5. Generate Better Auth Secret

openssl rand -base64 32

Save this value for BETTER_AUTH_SECRET.

6. Add GitHub Secrets and Variables

Go to GitHub repository settings → Secrets and variables → Actions

Secrets (Add these):

Secret Value
QUICKSTART_DATABASE_URI Direct Neon connection string from step 2
QUICKSTART_POOLED_DATABASE_URI Pooled Neon connection string from step 2
QUICKSTART_SOURCE_SECRET source_secret from Electric API response (step 4)
BETTER_AUTH_SECRET Generated secret from step 5

Variables (Add these):

Variable Value
QUICKSTART_SOURCE_ID id from Electric API response (step 4)

Verification

After deployment, verify:

  1. Site loads: https://quickstart.examples.electric-sql.com
  2. User signup works: Create a new account
  3. Project creation works: Create a new project
  4. Todo creation with sync works: Add todos and verify they sync

@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.91%. Comparing base (ebda858) to head (4d95374).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3634   +/-   ##
=======================================
  Coverage   87.91%   87.91%           
=======================================
  Files          22       22           
  Lines        1820     1820           
  Branches      462      461    -1     
=======================================
  Hits         1600     1600           
  Misses        218      218           
  Partials        2        2           
Flag Coverage Δ
packages/experimental 87.73% <ø> (ø)
packages/react-hooks 86.48% <ø> (ø)
packages/start 89.58% <ø> (ø)
packages/typescript-client 93.66% <ø> (ø)
packages/y-electric 56.05% <ø> (ø)
typescript 87.91% <ø> (ø)
unit-tests 87.91% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thruflo thruflo requested a review from balegas December 22, 2025 21:21
thruflo added a commit that referenced this pull request Dec 24, 2025
A simpler Quickstart based on the tanstack-db.web-starter and
@electric-sql/start package:
https://deploy-preview-3114--electric-next.netlify.app/docs/quickstart

Relies on #3595 being finished and published and #3634 being merged and
used to deploy the Quickstart demo.
@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for electric-next ready!

Name Link
🔨 Latest commit 4d95374
🔍 Latest deploy log https://app.netlify.com/projects/electric-next/deploys/694c2bcfb8a31f00089ed631
😎 Deploy Preview https://deploy-preview-3634--electric-next.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@thruflo thruflo force-pushed the thruflo/deploy-starter-example branch from 6aa15c1 to 4d95374 Compare December 24, 2025 18:07
@blacksmith-sh
Copy link
Contributor

blacksmith-sh bot commented Dec 24, 2025

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
at line 9:226 in shell otel_collector/at line 9:226 in shell otel_collector View Logs

Fix in Cursor

@thruflo thruflo merged commit 325bc44 into main Dec 24, 2025
38 of 39 checks passed
@thruflo thruflo deleted the thruflo/deploy-starter-example branch December 24, 2025 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants