This tutorial shows how to set up a Node.js project in Replit and connect it to a Supabase database using the Supabase JavaScript client.
Notes:
- You need a Replit account and a Supabase account with an existing project to follow this tutorial. If you haven't connected Supabase to Replit yet, see How to Integrate Replit with Supabase first.
- Replit is phasing out Developer Frameworks. If replit.com/developer-frameworks is unavailable, go to your dashboard, click + Create Something New, and describe your project in the Agent prompt - for example, "Create a Node.js project that connects to Supabase." The Agent will set up the environment automatically.
- Your Supabase URL and anon key are stored in the Secrets pane. The Agent can reference them directly without you hard-coding credentials in your files.
- Sign in to your account at replit.com and go to replit.com/developer-frameworks. Choose Node.js from the list.
- Click Remix, choose the default privacy setting (Public), and click Use Framework.
- Wait for Replit to set up the environment, then click the Open Files icon in the top-right corner and click File tree.
- Review the generated project structure:
- index.js
- package.json
- In the Agent tab, ask it to install the Supabase client - for example: "Add the Supabase JavaScript client to this project and connect it using my stored credentials." The Agent installs the package and updates your package.json automatically.
- Click index.js to open it in the editor. Write a query to fetch data from your Supabase database - for example, retrieving a list of active clients from a clients table for NEPS Corp.
- Click the Run button at the top of the workspace. Replit starts the Node.js server and displays the query results in the Console panel.
- To expand functionality, ask the Agent - for example: “Create an Express route that returns this data as JSON.”
.gif)
