Supabase - Open Source Firebase Alternative

Supabase - Open Source Firebase Alternative



Supabase is an open-source Firebase alternative providing PostgreSQL database, authentication, storage, and real-time subscriptions.

GitHub


https://github.com/supabase/supabase

What is Supabase?



Supabase provides:
  • PostgreSQL database
  • Authentication & Authorization
  • Storage (files, images)
  • Real-time subscriptions
  • Edge functions


  • Key Features



    1. PostgreSQL Database

  • Full SQL support
  • Row-level security
  • Database backups
  • Point-in-time recovery


  • 2. Authentication

  • Email/password login
  • OAuth providers (Google, GitHub, etc.)
  • Phone authentication
  • Social logins


  • 3. Real-time

  • Listen to database changes
  • Broadcast messages
  • Presence tracking
  • Multiplayer features


  • 4. Storage

  • File uploads
  • Image transformations
  • CDN integration
  • Public/private buckets


  • Getting Started



    1. Create Project



    Go to https://supabase.com and create a free project.

    2. Initialize in Your Code



    ash
    npm install @supabase/supabase-js


    javascript
    import { createClient } from '@supabase/supabase-js'

    const supabase = createClient(
    'YOUR_SUPABASE_URL',
    'YOUR_SUPABASE_KEY'
    )


    3. Query Data



    javascript
    // Fetch data
    const { data, error } = await supabase
    .from('users')
    .select('*')

    // Insert data
    const { data, error } = await supabase
    .from('users')
    .insert([{ name: 'John', email: 'john@example.com' }])

    // Update data
    const { data, error } = await supabase
    .from('users')
    .update({ name: 'Jane' })
    .eq('id', 1)


    4. Real-time Subscriptions



    javascript
    const subscription = supabase
    .from('users')
    .on('INSERT', payload => {
    console.log('New user:', payload.new)
    })
    .subscribe()


    5. Authentication



    javascript
    // Sign up
    const { data, error } = await supabase.auth.signUp({
    email: 'user@example.com',
    password: 'password123'
    })

    // Sign in
    const { data, error } = await supabase.auth.signInWithPassword({
    email: 'user@example.com',
    password: 'password123'
    })


    Advantages Over Firebase



    | Feature | Firebase | Supabase |
    |---------|----------|----------|
    | Database | NoSQL | PostgreSQL |
    | Query Language | Custom | SQL |
    | Pricing | Usage-based | Generous free tier |
    | Open Source | No | Yes |
    | Self-hosting | No | Yes |
    | Export Data | Limited | Full access |

    Free Tier

  • 500MB database
  • 1GB storage
  • 50,000 monthly active users
  • 2GB bandwidth


  • Why Supabase?

  • SQL Power: Use the power of PostgreSQL
  • Portability: Export your data anytime
  • Open Source: No vendor lock-in
  • Generous Free Tier: Great for MVPs and side projects
  • Community: Active and helpful community


  • Use Cases

  • SaaS applications
  • Real-time dashboards
  • Mobile apps backend
  • Authentication system
  • File management system


  • Summary



    Supabase gives you the simplicity of Firebase with the power of PostgreSQL. Excellent for web and mobile applications.




    Rating: 猸愨瓙猸愨瓙猸?
    Best for: Web apps, mobile apps, SaaS
    Learning curve: 猸愨瓙猸?
    Free tier: Yes
    标签:

    💬 评论区 (0)

    暂无评论,快来抢沙发吧!