firebase-proxy
This project contains a simple demo of Moralis API Proxy with the rate-limiting per a user IP.
Required Firebase services:
- Hosting
- Firestore
- Cloud Functions (only in the "Pay as you go" billing plan).
🚀 How to Start​
- Clone this repo.
- Install Firebase CLI globally:
npm install -g firebase-tools
- Login to your account:
firebase login
- Get list of your projects:
firebase projects:list
. If this list is empty you should add a new project. You can do it by the Firebase Console. - Set your project ID:
firebase use <PROJECT_ID>
- Copy
functions/.env.example
tofunctions/.env
and set your Moralis API key in the file.
🔌 Run Locally​
- Install Java on your computer. Functions Emulator requires Java.
- Run emulators:
firebase emulators:start
- Open
http://localhost:5555/
in your browser.
🔥 Deploy to Production​
- Activate Firestore.
- Deploy:
firebase deploy
- If you have any problem with the CORS on the production, probably you should allow unauthenticated HTTP function invocation. To allow unauthenticated invocation you must specify this at or after deployment. Here you can read more about it.