Free Tool

JSON to Supabase Types

Draft TypeScript Row, Insert, and Update shapes from a sample JSON object. Review the assumptions against your actual database schema.

Required for Insert?

export interface Database {
  public: {
    Tables: {
      users: {
        Row: {
            id: string
            email: string
            full_name: string
            avatar_url: string | null
            is_active: boolean
            role: string
            login_count: number
            metadata: { theme: string; notifications_enabled: boolean }
            tags: string[]
            created_at: string
            updated_at: string
        }
        Insert: {
            id?: string
            email: string
            full_name: string
            avatar_url?: string | null
            is_active: boolean
            role: string
            login_count: number
            metadata: { theme: string; notifications_enabled: boolean }
            tags: string[]
            created_at?: string
            updated_at?: string
        }
        Update: {
            id?: string
            email?: string
            full_name?: string
            avatar_url?: string | null
            is_active?: boolean
            role?: string
            login_count?: number
            metadata?: { theme: string; notifications_enabled: boolean }
            tags?: string[]
            created_at?: string
            updated_at?: string
        }
      }
    }
  }
}

// Convenience type aliases
export type UsersRow = Database["public"]["Tables"]["users"]["Row"]
export type UsersInsert = Database["public"]["Tables"]["users"]["Insert"]
export type UsersUpdate = Database["public"]["Tables"]["users"]["Update"]

Using this tool

Paste a sample JSON row, name the table, and adjust which fields are required for inserts. The tool drafts Row, Insert, and Update shapes from that sample.

What the output does not tell you

One JSON sample cannot reveal database constraints, relationships, defaults, or every possible value. Null values and mixed arrays need particular review. For authoritative project types, generate them from the actual database with Supabase’s tooling.

Supabase: generating database types

Need help applying this to your product?

Backend and database work with me