npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cra-template-autora-firebase

v0.1.29

Published

A template to set up a website with an AutoRA experiment via [Firebase](https://firebase.google.com/).

Downloads

13

Readme

CRA Template For Firebase

A template to set up a website with an AutoRA experiment via Firebase.

This template can be installed via NPM:

npx create-react-app my-autora-experiment --template autora-firebase

Quickstart Guide

Installation

To make sure that node is installed on your system, run the following command.

node -v

If you don't see a version number or the version number is below 16.0, install or update node following the instruction on the node.js website.

When node is available on your system, you can use create-react-app by running the following command.

npx create-react-app path/to/react/pp --template autora-firebase

If you want to use cookiecutter, run the following command and follow the instructions.

cookiecutter https://github.com/AutoResearch/autora-user-cookiecutter

This creates your project folder. Before writing code for your website, you also need to set up a Firebase project.

Firebase Project Setup

Initialize Firebase Account And Project

  • Create and log in to a Firebase account on the Firebase website.
  • Create a Firebase project by clicking add project and enter a project name.
  • You can choose to disable google analytics in the next page if you are not planning on using it for your project.

Copy Web App Credentials

  • Navigate to the Firebase console and select the project
  • To create a new web app, click on Add App or the <> symbol and follow the prompts
  • Enter a name for the Firebase app (could be the same as the project name)
  • Check Also set up Firebase Hosting for this app
  • Click Register App. This auto-generates a script with several values that you need to copy for the next step.
  • Copy the auto-generated values from the Firebase console to the corresponding variables in the .env file in the project folder that was created on your system using create-react-app or cookiecutter
REACT_APP_apiKey=
REACT_APP_authDomain=
REACT_APP_projectId=
REACT_APP_storageBucket=
REACT_APP_messagingSenderId=
REACT_APP_appId=
REACT_APP_devNoDb="True"
REACT_APP_useProlificId="False"
REACT_APP_completionCode="complete"
  • Click on Next
  • You will not need to run the command that is displayed after first clicking Next, so click Next again
  • Click Continue to console

Firestore Setup

AutoRA includes cloud storage for task data using Firestore. Follow these steps to initialize Firestore:

  • Navigate to the current project in the developer console and select Firestore Database from the sidebar under Build.
  • Click Create Database
  • Select production mode and click Next
  • Choose the current location and click Enable

Configure Your Project For Firebase

In the project folder, enter the following commands in your terminal: First log in to your Firebase account using

firebase login

Then initialize the Firebase project in this folder by running:

firebase init

An interactive initialization process will now run in your command line. For the first question, select these options:

  • Firestore: Configure security rules and indexes files for Firestore
  • Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
  • For a Firebase project, use the one you created earlier
  • Use the default options for the Firestore rules and the Firestore indexes.
  • !!! IMPORTANT !!! Use the build directory instead of the public directory here.
  • When asked for the directory, write build and press Enter.
  • Configure as a single-page app; don't set up automatic builds and deploys with GitHub.
  • Don't overwrite the index.html file if the question pops up.

Write Code For Your Experiment

To write code for your experiment, use the main.js file in the src/design folder. For example, you can use jsPsych and install packages using npm. The main function should return an observation (the data created by a participant).

You can test the experiment locally using

npm start

During development, the Firestore database will not be used. If you want to load conditions from the database, you need to upload them first (for example using the AutoRA Firebase Experimentation Manager) and set REACT_APP_devNoDb="False" in the .env file.

Using Prolific Id's

If you want to recruit participants via Prolific, we highly recommend setting REACT_APP_useProlificId="True" in the .env file. This will speed up the recruitment of participants.

Build And Deploy To Firebase

To serve the website on the internet, you must build and deploy it to Firebase. To build the project, run

npm run build

To deploy to Firebase, run

firebase deploy

This will make the website available on the web. You can find the URL of the website in the command line or on the Firebase console of your project under Hosting.