Backend Platform Migration from Firebase to Supabase by Devakumar N MBackend Platform Migration from Firebase to Supabase by Devakumar N M

Backend Platform Migration from Firebase to Supabase

Devakumar N M

Devakumar N M

Backend Platform Migration (Firebase → Supabase)

Led the backend migration of a production IoT platform from Firebase/Firestore to a self-hosted Supabase (PostgreSQL) stack, replacing a loosely structured NoSQL backend with a normalized relational architecture secured through row-level security policies.
Designed a relational schema of 30+ tables with indexed queries, auth-scoped access policies, and Prisma-managed migrations to support multi-tenant organizations, device lifecycle management, licensing, and real-time device control.
Built 70+ REST APIs as Supabase Edge Functions powering device provisioning, deployments, org management, and remote device workflows.
To ensure zero-downtime migration, I maintained a parallel Firebase API layer while incrementally transitioning clients to Supabase, allowing production traffic to move gradually without service disruption.
The platform runs within a Turborepo monorepo spanning 5 applications (Next.js portal, Expo mobile apps, and device interfaces) alongside multiple backend services and shared packages.

Engineering Details

For engineers interested in the architecture:
Database & Security
Migrated Firestore collections into a normalized PostgreSQL schema (20+ tables) with relational constraints and indexed access paths.
Implemented row-level security policies to enforce tenant isolation and role-scoped access across organizations.
API Layer
Built 70+ REST endpoints using Supabase Edge Functions (Express on Deno).
APIs supported device lifecycle management, deployments, licensing, and real-time control flows.
Authentication
Replaced Firebase Auth with a custom JWT flow: short-lived access tokens + refresh tokens.
Built role-aware authorization middleware resolving user type, org context, and permissions from a single bearer token.
Migration Strategy
Maintained dual Firebase + Supabase auth paths across backend services to enable incremental client migration without downtime.
Monorepo Architecture
Architected a Turborepo containing 5 applications and multiple backend services with shared packages.
Implemented a type-safe localization system serving 6 languages across web and mobile clients.
Self-Hosted Supabase Infrastructure
Ran a fully self-hosted Supabase stack using Docker Compose with 12+ services including Postgres, Kong, GoTrue, PostgREST, Realtime, Edge Runtime, Storage, and Analytics.
Built a local development environment mirroring the production stack to guarantee dev/prod parity and simplify debugging of realtime and auth flows.
Like this project

Posted Mar 11, 2026

Migrated IoT platform backend from Firebase to Supabase with zero downtime.