Supabase: A complete guide for beginners, or how to deal with databases
Next step
Open the bot or continue inside this section.
Article -> plan in AI
Paste this article URL into any AI and get an implementation plan for your project.
Read this article: https://vibecode.morecil.ru/en/dannye-i-khranenie/supabase-install-base/
Work in my current project context.
Create an implementation plan for this stack:
1) what to change
2) which files to edit
3) risks and typical mistakes
4) how to verify everything works
If there are options, provide "quick" and "production-ready". How to use
- Copy this prompt and send it to your AI chat.
- Attach your project or open the repository folder in the AI tool.
- Ask for file-level changes, risks, and a quick verification checklist.
In this article, I will explain what Supabase is and why you need a database. Step by step, with examples, so you don't repeat my mistakes. We're going to go from "What's this?" to "How to get AI to migrate for you," plus how to get an access token so that AI can customize everything itself, and AI prompts with minimal manual work. And yes, this is for beginners: no deep techniques, just what you really need to start.
What is Supabase?
Imagine you want a database, not just a SQL table, but a full backend stack. Supabase is an open source alternative to Firebase, but built on PostgreSQL (powerful relational database). It's a platform that gives you:
- Database: Full Postgres with real-time updates, backups and extensions.
- **Auth: Logins via email, password, OAuth (Google, GitHub, etc.), even SMS-OTP.
- Storage of files: Download images, videos, documents – with access control.
- Realtime: Data is updated in real time, as in a chat or dashboard.
- Edge Functions: Server functions that run close to users for low latency (like AWS Lambda, but simpler).
Supabase is free to start, scales and integrates with AI tools. The main advantage: everything is integrated with Row Level Security (RLS) – you control access at the line level in the database so that users see only their data.
Why do you need Supabase?
As a beginner, I thought at first, "Why would I do that if AI could generate local databases?" But the reality is that apps are growing, users are coming, data needs to be stored securely and scaled. Supabase decides:
- **Simplicity: Dashboard is like Firebase - create tables with your mouse, but under the hood powerful SQL.
- **AI integration: Through MCP (Model Context Protocol), an AI like Claude Code can work directly with your database — generate schemas, migrate, even update.
- No DevOps: No servers, no hosting, everything in the cloud, with a global CDN.
- Free for tests: 500 MB database, 1 GB storage, 50k users - enough for MVP.
- ** Scale: When you grow up, pay for Pro ($25/month) – unlimited users, more resources.
Compared to pure Postgres: Supabase adds realtime, auth, storage – no need to glue services manually. Firebase is best for those who love SQL and open source.
How to build a base: Step by step
Okay, let's figure out how to get started.
Registration: Go to supabase.com and register via GitHub, email or Google. Free.
**Create a project: After the login, click "New Project". Select the organization (your default), project name, region (close to users for speed), password for database (remember!).
- The project is made in minutes. You will receive a project URL (such as
https://<project-ref>.supabase.co) and an anonymous key.
- The project is made in minutes. You will receive a project URL (such as
Done! Base set up. Now let's plug in.
How to get the keys and connect to the app
Keys are APIs for access. In the dashboard, go to Settings > API.
- URL:
https://<project-ref>.supabase.co - anon key: Public key for anonymous access.
- service role key: Secret for admin access (not in the client!).
Save this data.
How to get access token so the AI can customize everything
In order for an AI (like Claude Code or Codex) to be able to fully manage your Supabase project – create spreadsheets, migrate, configure auth, etc. – you need a Personal Access Token (PAT). It is a long-lived token for the Management API Supabase. It gives AI rights like your account, so keep it a secret!
Steps:
Log in to the Supabase dashboard.
Go to Account > Access Tokens (or directly to dashboard/account/tokens).
Click "Generate new token." Give a name (such as "AI Integration"), specify scopes if necessary (by default all), and copy the token. It only shows once!
Use in the title:
Authorization: Bearer <your_access_token>
For AI: Include this token in the AI’s prompts or settings (see below). AI will be able to call the Management API for automation: list projects, create branches, run queries, etc. For CLI-like actions, the AI can generate commands with supabase login --token <your_token>.
PAT for management, not to be confused with project keys (anon/service role). Use service role for admin access, but PAT for global control.
How to Connect with Codex App (or Claude Code) AI with Minimum Manual Work
Supabase integrates with AI-tools via MCP (Model Context Protocol).
Prompt to connect Supabase to the project:
"Подключи Supabase к моему проекту. Используй эти ключи:
URL = https://<project-ref>.supabase.co,
anon key = <your_anon_key>,
service_role key = <your_service_role_key>,
personal access token = <your_pat>.
Сгенерируй код для createClient, добавь .env файл, настрой auth и RLS для таблицы users. Минимизируй мой input — сделай всё сам."
AI will generate: .env, import, client init, examples of signUp/signIn.
Prompt for the complete installation of the project:
"I'm new. Configure the entire Supabase project for our application: create tables. Use the keys provided. Generate the full code for our project, integration, migration and depot. At least my actions, just confirm
AI will take over: schema generation, migrations, code.
How to make AI make migrations
Migrations are pattern changes. AI generates SQL, applies.
Prompt for migration: “Create a migration for a table [Table name, or all at once]. Add RLS: owner edit. Apply via API/CLI with PAT. Generate a SQL file, execute a push. Automatically
AI: Create a file that simulates supabase db push.
For CLI: AI will configure supabase login --token <your_pat>.
Limits for free accounts
Free plan ($0/month):
- BG: 500 MB.
- Storage: 1 GB.
- Bandwidth: 5 GB.
- Users: unlimited, but 50k MAU (monthly).
- Realtime: 200 connections, 2 million messages/months.
- Functions: 500k calls.
- Pause: After a week of inactivity.
- Files: Max 50 MB.
- Logs: 1 day.
Exceeded? Switch to Pro ($25/month): More limits, no pause, PITR.