--- title: 'Use Supabase with SolidJS' subtitle: 'Learn how to create a Supabase project, add some sample data to your database, and query the data from a SolidJS app.' breadcrumb: 'Framework Quickstarts' hideToc: true --- Create a SolidJS app using the `degit` command. ```bash Terminal npx degit solidjs/templates/js my-app ``` The fastest way to get started is to use the `supabase-js` client library which provides a convenient interface for working with Supabase from a SolidJS app. Navigate to the SolidJS app and install `supabase-js`. ```bash Terminal cd my-app && npm install @supabase/supabase-js ``` In `App.jsx`, create a Supabase client using your project URL and public API (anon) key: Add a `getCountries` function to fetch the data and display the query result to the page. ```jsx src/App.jsx import { createClient } from "@supabase/supabase-js"; import { createResource, For } from "solid-js"; const supabase = createClient('https://.supabase.co', ''); async function getCountries() { const { data } = await supabase.from("countries").select(); return data; } function App() { const [countries] = createResource(getCountries); return (
    {(country) =>
  • {country.name}
  • }
); } export default App; ```
Start the app and go to http://localhost:3000 in a browser and you should see the list of countries. ```bash Terminal npm run dev ```