Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to supabase #35

Open
20 tasks
mzayem opened this issue Feb 20, 2025 · 0 comments
Open
20 tasks

Migrate to supabase #35

mzayem opened this issue Feb 20, 2025 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mzayem
Copy link
Collaborator

mzayem commented Feb 20, 2025

📝 Supabase Migration Plan

📌 1. Database Migration

  • Schema Conversion: Convert existing SQLite schema to PostgreSQL-compatible schema.
  • Migrations Setup:
    • Install and configure Supabase CLI.
    • Create a structured migration directory.
    • Split schema.sql into:
      • Table definitions
      • Security policies
      • Seed data
  • Set Up Row-Level Security (RLS) Policies to enforce data access rules.
  • Data Migration: Export SQLite data and import it into Supabase PostgreSQL.
  • Update Application Connection Strings to use Supabase PostgreSQL.

🚀 2. GitHub Integration & Deployment

  • Set Up Supabase Project and connect it to the GitHub repository.
  • Configure CI/CD Pipelines for automated deployments and migrations.
  • Migrate Existing Data into the new database.

🔐 3. Authentication Migration

Current Token Flow

  1. Magic provides a DID token.
  2. Backend validates DID and issues a JWT.
  3. JWT is stored in an HTTP-only cookie.
  4. API validates JWT on each request.

Supabase Authentication Options

  • Option 1: Cookie-based authentication (Similar to current implementation).
  • Option 2: localStorage-based authentication (Supabase default).

Token Management Comparison

Feature Current Implementation Supabase Implementation
Token Type Single JWT token Access + Refresh token pair
Token Refresh Manual refresh needed Automatic refresh
Claims Handling Custom claims management Built-in claims support
Storage Cookie-only Flexible (cookie/localStorage)
  • Implement Supabase Authentication with a choice of cookie-based or localStorage-based tokens.
  • Ensure JWT validation on API requests.
  • Session Management: Enable built-in session tracking and automatic session recovery.
  • Set up Security Features: Automatic session invalidation and token revocation if needed.

References


@mzayem mzayem added the enhancement New feature or request label Feb 20, 2025
@elliotBraem elliotBraem changed the title Migrations Steps Migrate to supabase Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants