Dan Tech Academy
After this lesson you will
  • Create a Supabase dev project and run the setup SQL to create the tables
  • Put the Supabase and Google OAuth values in local.properties instead of hardcoding secrets
  • Register the Android app in Firebase and keep google-services.json out of Git
Duration18 min
DifficultyBeginner

Set Up Supabase SQL, Secrets And Firebase

Prepare the backend tables, auth configuration and Firebase Android project you need before the app's first serious run.

Video in production

Lesson video is on the way

While you wait, read the full text version below: complete theory, code samples and the hands-on checklist.

Recording is in post-production

Lesson Goal

You will set up the minimum backend the app needs before its first serious build: Supabase, Google OAuth values, the local.properties file and a Firebase Android project.

This lesson doesn't build any features. The goal is to clear away vague setup errors before you start reading the architecture.

Part 1: Create A Supabase Dev Project

Open the Supabase dashboard and create a dev project:

text
kotlin-accelerator-dev
ValueDoes Android need it?Notes
Project URLYesThe client calls Supabase through this URL
Publishable key (sb_publishable_...)YesClient-safe, but it identifies the project
Service role or secret keyNoBackend-only; never paste it into Android
Database passwordNoFor admin/server use only

Part 2: Run The Minimum Supabase SQL

Option 1: Run It Manually

Open the Supabase SQL Editor, then open scripts/sql/setup.sql in the kotlin-accelerator-ai repo and copy its contents. The repo also has scripts/sql/setup.vi.sql, the same SQL with Vietnamese comments. Run only one of the two files.

Paste it into the SQL Editor and run it. Then open the Database tab and you will see the tables that were created.

Option 2: Through The Supabase MCP

Go to your Supabase project, choose Connect > MCP > pick your AI client > leave Read-only unticked > Copy Prompt > paste it into the AI client > Run. The AI client installs the MCP server for you.

Then restart the AI client, call @scripts/sql/mcp-bootstrap-prompt.md so the MCP runs the setup, and call @scripts/sql/mcp-seed-prompt.md to seed sample data.

Part 3: Configure The Auth Secrets

The repo doesn't ship any key. You use your own Supabase project, the one you created in Part 1.

Open a terminal, cd into the root of the kotlin-accelerator-ai repo and create local.properties from the example file:

bash
cp local.properties.example local.properties

In the Windows Command Prompt, use copy local.properties.example local.properties.

local.properties is already in .gitignore. The example file, local.properties.example, is committed to the repo. Apart from its comment lines, it holds these keys, all with placeholder values:

properties
supabase.url=https://YOUR-PROJECT.supabase.co
supabase.publishable.key=sb_publishable_YOUR_KEY
google.server.clientId=YOUR_WEB_CLIENT_ID.apps.googleusercontent.com
revenuecat.api.key=goog_YOUR_KEY
premium.gate.enabled=false
daily.challenge.enabled=false

In the Supabase dashboard, click your project's Connect button to get the Project URL and the publishable key. The publishable key is also under Project Settings > API Keys. It's a short string that starts with sb_publishable_. Paste the two values into supabase.url and supabase.publishable.key in place of the placeholders.

The app only reads supabase.publishable.key, not the old name supabase.anon.key. The Android build stops if this key is empty, if you copied the long key that starts with eyJ by mistake (the legacy anon key Supabase will deprecate at the end of 2026), or if it's a secret key that starts with sb_secret_. The error message names the property to fix and doesn't print the value. The placeholder sb_publishable_YOUR_KEY passes this check, so if you forget to replace it, the app still builds but can't reach Supabase.

app/build.gradle.kts reads these keys and puts them into BuildConfig at build time, so the values never sit in the source code. Only supabase.publishable.key is required to build, and a missing key becomes an empty string. The three lines revenuecat.api.key, premium.gate.enabled and daily.challenge.enabled are optional. With premium.gate.enabled=false the app doesn't set up RevenueCat, so you don't need to touch those three lines yet.

The example file has no sdk.dir, because the Android SDK path is different on every machine. When Android Studio syncs Gradle, it writes sdk.dir into local.properties if the file doesn't have that line yet, and it keeps the other keys. If you build from the command line and the file has no sdk.dir, set the ANDROID_HOME environment variable to the Android SDK folder, the one Android Studio's SDK Manager shows (Settings, Languages & Frameworks, Android SDK). If you write sdk.dir yourself on Windows, the \ and : characters in the path must be escaped, for example sdk.dir=C\:\\Users\\<name>\\AppData\\Local\\Android\\Sdk.

With your own project's URL and publishable key, the app can use Supabase for practicing Login by Email. You still need app/google-services.json from Part 4 before the app builds. Google Sign-In also needs an OAuth web client in Google Cloud.

Go to the Google Cloud Console and follow these steps.

  • Create a project with any name, for example kotlin-accelerator-dev.
  • Create the credentials as shown in the video:

The client ID in the video is a web client. Paste it into google.server.clientId in local.properties. iOS needs its own iOS OAuth client as well, but only if you run the iOS build on a Mac.

Part 4: Create A Firebase Android Project

Open the Firebase Console, create kotlin-accelerator-dev, then add an Android app:

  1. Find the project's real Android package name: applicationId in app/build.gradle.kts, currently com.creative.kta.
  2. Register exactly that package name in Firebase.
  3. Add the debug SHA-1 if the app uses Google sign-in or Firebase Auth.
  4. Download google-services.json.
  5. Put the file at app/google-services.json.

To get the debug SHA-1:

bash
./scripts/get-sha1-fingerprint.sh

On Windows (Command Prompt or PowerShell), run scripts\get-sha1-fingerprint.bat.

Don't commit google-services.json to Git. The file doesn't hold much sensitive data, but it identifies your Firebase project. The repo already has an app/google-services.json line in .gitignore; don't remove it.

Firebase is only wired into the Android side. On iOS the app uses stand-in implementations for Analytics and Remote Config, so you don't need to create an iOS app in Firebase for this course.

Part 5: Fill In Local Config, Don't Hardcode

You now have every value local.properties needs. Paste each one under the right key, and don't hardcode any of them in a Kotlin file. iOS reads the same values from a separate file, iosApp/Configuration/Config.xcconfig, which Git also ignores. You only need that file when you run the iOS build on a Mac.

Verification Pass

  • Launch the app on a device or emulator
  • Go through Splash and Onboarding to the Menu
  • Choose Login with Email -> check login, logout, register, reset password
  • Choose Sign in with Google. If Google auth isn't set up yet, this step fails. Set it up with the video and check again

Checkpoint

You are done when the Supabase SQL is applied, Auth is configured, Firebase has an Android app, app/google-services.json is ignored, local.properties holds only client-safe values, and the sign-in flows work.

Sign in