<p>
  Moving your project from Firebase to Appwrite?
  Appwrite Migrations can help you streamline the process.

  Here's what you need to know to get started.
</p>

<h2><a href="#notices" id="notices">Things to keep in mind</a></h2>

<ol class="margin-top margin-bottom-large text-size-normal">
  <li>Appwrite will not incur usage charges during migrations, but Firebase may still incur service charges.</li>
  <li>Appwrite Migrations only supports Firestore as a database source. Realtime Database is <b>currently not supported</b>.</li>
  <li>At the moment only top level document migration is supported. Nested documents will not be migrated automatically.</li>
  <li>OAuth users will not be migrated because the sessions are managed by the third-party OAuth provider. Users will need to re-authenticate with your OAuth provider after the migration is complete.</li>
  <li>Functions are not automatically migrated because of syntax and runtime differences.</li>
</ol>

<h2><a href="#migration-process" id="migration-process">Migrating to Appwrite from Firebase</a></h2>
<p>
  To begin migrating to Appwrite make sure to read the <a href="/docs/migrations">migration overview</a>
  and <a href="#notices">things to keep in mind</a> sections above.
</p>

<ol class="margin-top margin-bottom-large text-size-normal">
  <li>
    Create a new project and click on the <b>Migrations</b> tab in <b>Project Settings</b>.
  </li>
  <li>
    Click on the <b>Create Migration</b> button and select <b>Firebase</b> as your source.
  </li>
  <li>
    Navigate to your Firebase console.
  </li>
  <li>
    Click the gear icon to access your <b>Project Settings</b>.
  </li>
  <li>
    Click on <b>Service Accounts</b>, then click on the <b>Manage service account permissions</b> link redirecting you to the Google Cloud Console.
  </li>
  <li>
    Click on <b>Create Service Account</b>, give it a name, id and description you want, then click <b>Continue</b>.
  </li>
  <li>
    Next you'll be prompted to grant the service account roles. You need to grant the following roles.
  </li>
  <table class="full text-size-small">
    <thead>
      <tr>
        <th>Role</th>
        <th>Reason<br></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Firebase Viewer</td>
        <td>Read access to your entire Firebase project including Database and Storage.<br></td>
      </tr>
      <tr>
        <td>Identity Toolkit Viewer</td>
        <td>Read access to your users including their hash config.<br></td>
      </tr>
    </tbody>
  </table>
  <li>If you prefer to create a custom role, you can use the following permissions.</li>
  <table class="full text-size-small">
    <thead>
      <tr>
        <th>Permission</th>
        <th>Reason</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>datastore.databases.get</td>
        <td>Read access to your Firestore database.</td>
      </tr>
      <tr>
        <td>datastore.databases.list</td>
        <td>Read access to your Firestore database.</td>
      </tr>
      <tr>
        <td>datastore.entities.get</td>
        <td>Read access to your Firestore database's documents.</td>
      </tr>
      <tr>
        <td>datastore.entities.list</td>
        <td>Read access to your Firestore database's documents.</td>
      </tr>
      <tr>
        <td>datastore.indexes.get</td>
        <td>Read access to your Firestore database's indexes.</td>
      </tr>
      <tr>
        <td>datastore.indexes.list</td>
        <td>Read access to your Firestore database's indexes.</td>
      </tr>
      <tr>
        <td>firebaseauth.configs.get</td>
        <td>Read access to your Firebase project's authentication configs.</td>
      </tr>
      <tr>
        <td>firebaseauth.configs.getHashConfig</td>
        <td>Read access to your Firebase project's authentication configs including hash salt.</td>
      </tr>
      <tr>
        <td>firebaseauth.configs.getSecret</td>
        <td>Read access to your Firebase project's authentication configs including secret.</td>
      </tr>
      <tr>
        <td>firebaseauth.users.get</td>
        <td>Read access to your Firebase project's users.</td>
      </tr>
      <tr>
        <td>identitytoolkit.tenants.get</td>
        <td>Read access to your Firebase project's users.</td>
      </tr>
      <tr>
        <td>identitytoolkit.tenants.list</td>
        <td>Read access to your Firebase project's users.</td>
      </tr>
      <tr>
        <td>storage.buckets.get</td>
        <td>Read access to your Firebase project's storage buckets.</td>
      </tr>
      <tr>
        <td>storage.buckets.list</td>
        <td>Read access to your Firebase project's storage buckets.</td>
      </tr>
      <tr>
        <td>storage.objects.get</td>
        <td>Read access to your Firebase project's storage objects.</td>
      </tr>
      <tr>
        <td>storage.objects.list</td>
        <td>Read access to your Firebase project's storage objects.</td>
      </tr>
    </tbody>
  </table>
  <li>
    Click <b>Done</b> to create the service account. After that you'll be redirected back to the service accounts page. Select the service account you just created and click <b>Keys</b>.
  </li>
  <li>
    Click <b>Add Key</b> and select <b>Create new key</b>. Select <b>JSON</b> as the key type and click <b>Create</b>. This will download a JSON file to your computer.
  </li>
  <li>
    Upload the JSON file to Appwrite and follow the migration wizard to select which resource you need to migrate.
  </li>
  <li>
    After completing the migration wizard, migration will begin. This will run in the background, you can close the browser.</a>.
  </li>
  <li>
    Finally, add the platforms for your <a href="/docs/getting-started-for-web">Web</a>, <a href="getting-started-for-flutter/docs/getting-started-for-flutter">Flutter</a>, <a href="/docs/getting-started-for-android">Android</a>, and <a href="/docs/getting-started-for-apple">iOS</a> apps. 
    Also remember to <a href="/docs/permissions">add appropriate permissions</a></b> to the migrated resources to protect user data and privacy.
  </li>
</ol>