- Side Projects
- Cron-jobs
- Raspberry Pi event logging
- Fork this Repo.
- Create a new project on vercel.com (guide)
- Before deploying, add the environment variables defined in the environment variables section
- Create a Firestore database and paste the following security rules in the "Rules" tab
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
function hasAccount() {
return request.auth != null && exists(/databases/$(database)/documents/users/$(request.auth.uid));
}
match /{document=**} {
allow read, write: if false; // other requests are handled by the admin sdk
}
match /events/{eventId} {
allow read: if hasAccount();
}
match /projects/{projectId} {
allow read, write: if hasAccount();
}
match /users/{userId} {
allow read, write: if hasAccount();
}
match /pending_users/{userId} {
allow read: if hasAccount();
}
}
}
- Complete your vercel deployment!
- Auth Setup
- Go to the
Authentication
tab in your Firebase dashboard and enableGoogle
sign-in provider from the "Sign-in method" tab - In the Authentication Settings page, add your newly deployed vercel project's domain (something.vercel.app) to the "Authorized domains" secion
- Go to the
- Grab a cookie
You can find these values from your Firebase Console. Instructions on how to get these values are below.
These values are from your Firebase Config
PUBLIC_FIREBASE_APIKEY
PUBLIC_FIREBASE_AUTHDOMAIN
PUBLIC_FIREBASE_PROJECT_ID
PUBLIC_FIREBASE_STORAGE_BUCKET
PUBLIC_FIREBASE_MESSAGE_SENDER_ID
PUBLIC_FIREBASE_APP_ID
This is from the Firebase Service Account
FIREBASE_SERVICE_ACCOUNT
- Paste your entire Firebase service accountjson
file here
Demo mode
PUBLIC_DEMO
- set this tofalse
- Create a firebase project here. This project will be used to store all of your logs
- Click the "Web" button and fill in the details to register a new web app. Make sure to copy the firebaseConfig object. You will need this later
- Click on the little cog icon next to
Project Overview
in your Firebase console and go toProject Settings
- Go to the "Service accounts" tab
- Click "Generate new private key"
- After setting up your MacroStash instance, go to
yourdomain.vercel.app/projects
and create a new project - Open a project to view it's API endpoint
- Send a POST request to the API endpoint to log events