Skip to content

Quickstart

wasita edited this page Nov 1, 2023 · 1 revision

Initialize Firebase

Firebase Project ID: jspsych-firebase-template

  • Dartmouth previously allowed you to make Firebase projects with your Dartmouth.edu email, but I recently tried to do so and it seems that they removed permissions. Now, you must make a Firebase project with a Gmail.com account.

  • Once you've successfully created a Firebase project through the console/website GUI, you can add the project-specific SDK information to your index.html:

<script type="module">
  // Import the functions you need from the SDKs you need
  import { initializeApp } from "https://www.gstatic.com/firebasejs/10.5.2/firebase-app.js";
  // TODO: Add SDKs for Firebase products that you want to use
  // https://firebase.google.com/docs/web/setup#available-libraries

  // Your web app's Firebase configuration
  const firebaseConfig = {
    apiKey: "AIzaSyDVRPEkqZVRCZGaf0TkP6PsYBKbEdumIgc",
    authDomain: "jspsych-firebase-template.firebaseapp.com",
    projectId: "jspsych-firebase-template",
    storageBucket: "jspsych-firebase-template.appspot.com",
    messagingSenderId: "471080365978",
    appId: "1:471080365978:web:e67e5176c690ada9631423"
  };

  // Initialize Firebase
  const app = initializeApp(firebaseConfig);
</script>

UNDER CONSTRUCTION: Firebase user auth

UNDER CONSTRUCTION: Saving task data to Firebase

Deploy your site using Firebase

  1. npm install firebase-tools
  2. firebase login
    • Make sure you’re logged into the Gmail account that the Firebase project was made under
  3. firebase init — follow the command instructions
    1. Select hosting
    2. You pretty much safely press enter and accept the default options. However, when it comes to the question of where you want to deploy files from and the default option given to you is a public folder, override this default with . This specifies you want to deploy from the repo root directory. That is, the index.html task file should be in the 'uppermost' directory in the GitHub repo.
  4. firebase deploy
    1. Once you want to update and/or push any changes you’ve made to your task site, so it can be accessible online, you can run this command
    2. For me, the hosting URL is: https://jspsych-firebase-template.web.app/