superbase

As explained by

Supabase provides

  • database: postgres

  • auth: row level security

  • edge functions: server-side typescript functions

  • file storage

  • auto-generated APIs

  • observability

With React

  • npm install @supabase/supabase-js

import { createClient } from '@supabase/supabase-js'
// Create a single supabase client for interacting with your database
const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
  const [posts, setPosts] = useState([])
  const [post, setPost] = useState({title: "", content: ""})
  const {title,content} = post

  async function fetchPosts(){
    const {data} =  await supabase.from('posts').select()
    setPosts(data)
    console.log("data: ", data)
  }

  async function createPost() {
    await supabase.from('posts').insert(
      [{title, content}]
    ).single()
    setPost({title: "", content: ""})
    fetchPosts()
  }

  // on first render
  useEffect(() => {
    fetchPosts()
  }, []);