Run the Setup Tool
One page in your browser deploys the Firestore rules, indexes, Storage rules, the starter data and all Cloud Functions. No commands to type, no database to edit by hand.
Have these ready
- The service account key (
.jsonfile) from Service Account Key. - Node.js 20 or newer on this computer (22 LTS recommended). See Requirements.
- Your Firebase project on the Blaze plan, with Storage and Firestore created in the previous steps.
Where the tool lives#
The tool is the firebase_setup folder in the root of the Go4Food download. Keep it where it is: it finds the functions folder next to it.
Go4Food/
├── admin_panel/ Admin panel (Flutter web)
├── customer/ Customer app
├── restaurant/ Restaurant app
├── driver/ Driver app
├── functions/ Cloud Functions (deployed by the tool)
└── firebase_setup/ ← the setup tool
├── start.bat Windows: double-click this
├── start.sh macOS / Linux: run this
├── database.json Starter data (settings, categories, cuisines, restaurants, foods, zones…)
├── firestore.rules, firestore.indexes.json, storage.rules
└── server.js, index.html
One check before you start#
Open functions/.env in a text editor. It lists the Firestore databases the Cloud Functions serve:
FIRESTORE_DATABASES=(default),staging
If you use only the normal (default) database (most buyers), change it to:
FIRESTORE_DATABASES=(default)
With staging in the list, every database trigger is deployed twice (a second copy ending in Staging), which is only useful if you also created a staging database for testing.
Start the tool#
- Open the
Go4Foodfolder, then thefirebase_setupfolder. - Double-click
start(the file of type Windows Batch File). - A black window opens. Leave it open while you work. Your browser opens the setup page by itself.
Open the Terminal app, go into the firebase_setup folder and start the tool. Tip: type cd (with a space) and drag the folder from Finder into the Terminal window, then press Enter.
cd ~/Downloads/Go4Food/firebase_setup
chmod +x start.sh
./start.sh
chmod +x is needed only the first time. Without it macOS answers permission denied.
The first start installs the tool's packages and takes 1–3 minutes. Then the page opens at http://localhost:5050 (or the next free port, shown in the window).
Node.js missing or too old?
The start file checks this for you. If it says Node.js is not installed or is too old, install the LTS version from nodejs.org, close the window and start the tool again.
Deploy in four steps#
Choose your key#
Click Choose the .json file and pick the key you downloaded, or drag the file onto the box. Everything under What to deploy is ticked for you. Leave it that way for a first setup.
- 1Choose the key you downloaded (or drag it here).
- 2Everything Go4Food needs is found and ticked.
- 3Mode: keep Only add documents that don't exist yet for a first setup.
- 4Removes the tool after a successful deploy (recommended).
- 5Becomes Deploy to your-project-id once a key is loaded.
Fix “Not allowed yet” with one click#
The tool checks what your key may do. A key downloaded from Firebase can deploy rules and data, but not indexes or Cloud Functions. That is normal. If you own the project, click Sign in with Google and sign in with the Google account that created the Firebase project. Those two parts then deploy with your own account. Nothing changes in Google Cloud.
- 1Red crosses: parts this key cannot deploy yet.
- 2Click Sign in with Google and use the project owner's account.
- 3Not your project? Open this and give the key the role it shows instead.
- 4Deploy is still possible, but the red parts would fail.
Already used the Firebase CLI on this computer?
If you once ran firebase login with the owner's account, the tool uses that sign-in automatically and the crosses turn green by themselves.
Check that everything is green#
After you sign in, the box says This key can deploy everything. Indexes and Cloud Functions now show Uses your Google account. The Storage bucket and the Blaze plan must be green too. If one is red, the text next to it tells you what to do and links to the right Firebase page.
Deploy#
Click Deploy to your-project-id. Keep the page and the black window open. Each line turns green as it finishes. The first deploy takes 10–20 minutes, mostly for creating the Cloud Functions.
Done
When the page says Done. Everything was deployed., your backend is live: security rules, 127 indexes, Storage rules, the starter data and all Cloud Functions. Click Open Firebase console to look. If Delete the firebase_setup folder was ticked, the folder removes itself and the page closes after a few seconds.
What the tool deploys#
| Part | What it is | Why Go4Food needs it |
|---|---|---|
| Firestore rules | firestore.rules |
Decides who may read and write each piece of data: admin, restaurant owner, driver and customer roles. Everything else is denied. |
| Firestore indexes | firestore.indexes.json (127 indexes) |
Makes the order, restaurant, food and report lists load fast. |
| Storage rules | storage.rules |
Public app images, private verification documents, images and PDFs up to 10 MB only. |
| Database data | database.json (20 collections, about 2,000 documents) |
A ready food delivery service: settings, categories, sub-categories, cuisines, demo restaurants and foods, zones, banners, documents, bank form, email templates, languages, currencies, taxes, onboarding screens, subscription plans and roles. |
| Cloud Functions | the functions folder (Node 24) |
Driver assignment and timeouts, order price check, online payments, push notifications, emails, search, support-ticket routing. |
| Google APIs | turned on for you | Firebase Rules, Firestore, Storage, Cloud Functions, Cloud Build, Artifact Registry, Cloud Run, Eventarc and Pub/Sub. |
The options explained#
Mode (database data)#
| Option | What it does | Use it when |
|---|---|---|
| Only add documents that don't exist yet (default) | Adds the starter data. Anything already in your database is left alone. | First setup, and every re-run. |
| Merge into existing documents | Adds new fields from the file and keeps your own values. | A new Go4Food version brings new settings. |
| Overwrite existing documents | Replaces documents with the file's version. | Resetting a test project. Never on a live business. |
More settings#
| Setting | Meaning |
|---|---|
| Firestore location | Used only if the project has no Firestore database yet. Choose the region closest to your customers. It cannot be changed later. |
| Storage bucket location | Used only if the project has no Storage bucket yet. US regions are in the free tier. |
| Delete functions that are in Firebase but not in the Functions folder | Leave this off unless you removed functions on purpose. |
Delete the firebase_setup folder after a successful deploy#
Ticked by default. After a fully successful deploy, the tool deletes its own folder (with the key it used, the rules and database.json). Your app folders and functions are never touched. If any step fails, the folder is kept so you can run it again.
Keep a backup of the original download
Want to run the tool again later, for example after an upgrade? Keep the original Go4Food zip, or untick this option.
Starter data: keep it, change it, or remove it#
The starter data makes every app show a working food delivery service the first time you open it. You manage all of it from the admin panel, so there is no need to touch the database:
- Keep and edit what you like: categories, cuisines, documents, email templates and settings are a good base.
- Replace the demo restaurants, foods and zones with your own from the admin panel.
- Delete demo restaurants and foods before real customers start ordering.
One thing to do in the admin panel afterwards
The apps read a copy of your payment settings without the secret keys. It is made by a Cloud Function each time the payment settings are saved, so after setup open the admin panel, go to Finance SettingsPayment Key and click Save once. See Commission, fees & payments.
Running it again is safe#
You can start the tool as often as you like. With the default mode, nothing you created is overwritten. Rules, indexes and functions are simply updated to the versions in the folder. Indexes that exist in Firebase but not in the file are kept.
If a step turns red#
| Message in the tool | Fix |
|---|---|
| Not allowed yet. Needs the … role | Click Sign in with Google with the project owner's account, or give the key that role in Google Cloud IAM (the tool shows the exact steps). |
| This project is on the free Spark plan | Upgrade to Blaze: Blaze plan & Storage. |
| This project has no Storage bucket yet | Open Storage in Firebase and click Get started, then click Check again. |
| This is not a service account key | You picked a different JSON file. Use the file from Generate new private key. |
| Permission denied while using the Eventarc Service Agent | Normal on a brand-new project. Wait 5 minutes and deploy again. |
| Loading your functions code took longer than 60 seconds | Deploy again: the second load is usually much faster (antivirus scans slow down the first one). |
| Some functions failed, others worked | Click Deploy again. Only what is missing or changed is sent. |
| The functions folder is not found | Put firebase_setup back next to the functions folder. |
| Lost connection to the setup server | The black window was closed. Start the tool again and reload the page. |
| Port 5050 is busy | Nothing to do: the tool picks the next free port and prints the address in the window. |
| The folder was not deleted | A window was open inside it. Close it and delete the folder yourself. |
More fixes: Troubleshooting.



