Firebase

Getting Started

Setting up Firebase in your SwiftStruct project.


Create a Firebase project

  1. Go to the Firebase Console
  2. Sign in with your Google account
  3. Click "Add project" or "Create a project"
  4. Enter your project name
  5. Choose whether to enable Google Analytics (optional)
  6. Click "Create project" and wait for it to finish

Set up Firebase products

Authentication

  1. In the Firebase Console, go to Authentication in the left sidebar
  2. Click "Get started"
  3. Enable the sign-in methods you want to use:
    • Email/Password: Enable and save
    • Sign in with Apple: Enable and configure
    • Google: Enable and configure
    • GitHub: Enable and configure. To create a GitHub OAuth app:
      1. Go to GitHub Settings → Developer settings → OAuth Apps
      2. Click "New OAuth App"
      3. Enter an application name
      4. Set the Authorization callback URL to: https://YOUR_PROJECT_ID.firebaseapp.com/__/auth/handler
      5. Click "Register application"
      6. Copy the Client ID and Client secret
      7. Paste them into Firebase Authentication settings
    • Phone: Enable and configure

Firestore Database

  1. Go to Firestore Database in the left sidebar
  2. Click "Create database"
  3. Choose to start in production mode or test mode (the project comes with sensible defaults)
  4. Select a location for your database (choose the closest to your users)
  5. Click "Enable"

Storage

  1. Go to Storage in the left sidebar
  2. Click "Get started"
  3. Review the security rules (the project comes with sensible defaults)
  4. Choose a storage location
  5. Click "Done"

Hosting

  1. Go to Hosting in the left sidebar
  2. Click "Get started" (required for email link sign up)

Add an iOS app

  1. In your Firebase project, click the iOS icon to add an iOS app
  2. Enter your iOS bundle ID (use what you used during setup, found in your Xcode project settings)
  3. Register the app
  4. Download the GoogleService-Info.plist file
  5. Add the GoogleService-Info.plist file to Resources/GoogleService-Info.plist in your Xcode project

Deploy Firebase configuration

  1. Navigate to apps/firebase in your project
  2. Run firebase login if you haven't already authenticated
  3. Run firebase init and override the default config when prompted
  4. Run firebase deploy to deploy all rules and configuration
  5. Accept all prompts during the deployment process
Previous
Installation