crystal-supabase

Supabase client for Crystal lang

Supabase Crystal Client

License Crystal Last Commit
Crystal client for Supabase REST API supporting basic CRUD operations with query building.

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      crystal-supabase:
        github: Skrebnevf/crystal-supabase
    
  2. Run shards install

Usage

require "crystal-supabase"

Select

response = client
  .from("users")
  .select("*")
  .eq("active", "true")
  .execute()
puts response

Insert

payload = %({"name": "Alice", "age": 30})
response = client
  .from("users")
  .insert(payload)
  .execute()
puts response

Update

payload = %({"name": "Charlie"})
response = client
  .from("users")
  .eq("id", "1")
  .update(payload)
  .execute()
puts response

Upsert

payload = %({"id": 1, "name": "Bob"})
response = client
  .from("users")
  .upsert(payload, ["id"])
  .execute()
puts response

Delete

response = client
  .from("users")
  .eq("id", "1")
  .delete()
  .execute()
puts response

Query Filters Examples

response = client
  .from("products")
  .select("id,name,price")
  .gt("price", "100")
  .lt("price", "500")
  .like("name", "%book%")
  .order_desc("price")
  .limit(10)
  .execute()
puts response

RPC

response = client.rpc("hello_world")
puts response

TODO

  • Add basic CRUD
  • Add filters
  • Implement bulk for multiple rows
  • Add call of Postgres functions
  • Add modifiers

Contributing

  1. Fork it (https://github.com/Skrebnevf/crystal-supabase/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

crystal-supabase

Owner
Statistic
  • 3
  • 1
  • 0
  • 0
  • 2
  • about 4 hours ago
  • June 10, 2025
License

MIT License

Links
Synced at

Mon, 16 Jun 2025 20:21:09 GMT

Languages