How to create firebase’s web site

2018-07-17 - Firebase


npm install -g firebase-tools;
mkdir -p skensaku/public_html;
cd skensaku/public_html;
firebase login;
firebase init;
firebase deploy;

Use different environment

You should do it by creating multiple environment.
For example, in the case of stg environment

firebase use stg;

firebase use;

firebase deploy -p stg;

You also have to change the config’s content based on the localhost.hostname.

Add functions

npm install -g firebase-tools;
firebase login;
firebase init functions;
firebase deploy --only functions;

Worked rule memo

service cloud.firestore {
  match /databases/{database}/documents {
    match /favorites/{favorite} {
      allow read: if true;
      allow write: if true;

Get auth user list

firebase auth:export /tmp/userlist.json --format=json

If you want to create code by yourself, please refer to h

Import user into firebase

You have to got to web console’ s auth screen and have to get necessary information like hash key

firebase auth:import /tmp/userlist.json --rounds=8 --mem-cost=14 --hash-key= --salt-separator=


Export firestore table’s content

git clone
ln -s firestore-import-export.git bin;

to include credential which you can get from web console’s setting of the project.

node bin/export.js vpsCourses;perl -e 'use FileHandle;my $fh=new FileHandle("firestore-export.json");local $/=undef;my $con=<$fh>;$fh->close();$con=~ s!,"!,\n"!gs;my $wfh=new FileHandle("> /tmp/write.txt");print $wfh $con;$wfh->close();rename("/tmp/write.txt", "firestore-export.json");';mv firestore-export.json data/`date +%Y%m%d`.json;

Import json into firestore


node bin/import.js data/edited_20181026.json