How supabase/postgrest-js works
Main Components
a. Client Layer:
• PostgrestClient (core client class)
• Builder Classes:
• PostgrestQueryBuilder
• PostgrestFilterBuilder
• PostgrestTransformBuilder
• PostgrestBuilder (base class)
b. Query Processing Layer:
• Select Query Parser Component
• Parser
• Result Handler
• Type System
c. HTTP Communication Layer:
• Fetch Implementation (either cross-fetch or custom)
• Error Handling (PostgrestError)
Component Relationships
• Use a top-down approach showing data flow
• Client applications at the top
• PostgrestClient as the main entry point
• Builder classes branching from the client
• Query parser as a supporting component
Important Details
• Main operations (select, insert, update, delete)
• Isomorphic nature of the library
• Optional custom fetch implementation
• Type system integration