Setup Wizard

The Setup Wizard provides an interactive, step-by-step deployment experience for the Temp-Number App.

What is the Setup Wizard?

The Setup Wizard is an intelligent deployment script that:

  • βœ… Collects configuration through interactive prompts
  • βœ… Validates your environment and prerequisites
  • βœ… Configures Firebase and GCP projects as needed
  • βœ… Deploys to your chosen platform (Docker or Google Cloud)
  • βœ… Provides clear instructions for post-deployment tasks
  • βœ… Handles errors gracefully with helpful messages

Prerequisites

Before running the wizard, ensure you have:

Required

For Local Deployment

  • Docker: Version 20.x or higher
  • Docker Compose: Version 2.x or higher

For Google Cloud Deployment

  • Google Cloud Account: With billing enabled
  • gcloud CLI: Install instructions
  • Domain Name: (Optional) For custom domain setup

πŸš€ Getting Started

Step 1: Clone the Repository

git clone https://github.com/platfone-com/temp-number-deploy.git
cd temp-number-deploy

Step 2: Run the Setup Wizard

./setup-wizard.sh

The wizard will start and guide you through the entire process.

Windows

Windows users: please refer to Windows Subsystem for Linux (WSL) guide.

▢️ Demonstration Videos

Docker deploy demo

Google Cloud deploy demo

Wizard Flow

Step 1: Welcome Screen

The wizard displays a welcome message and overview of what it will do.

==========================================
  πŸš€ Temp Number - Setup Wizard
==========================================

This wizard will guide you through setting up the Temp Number application.
You can run it locally using Docker Compose or deploy it to Google Cloud.

Press Enter to continue...

Action: Press Enter to proceed.

Step 2: Select Deployment Target

Choose where you want to deploy the application.

==========================================
  Step 1: Select Deployment Target
==========================================

Where would you like to deploy the application?

1) Local Development (Docker Compose)
   - Runs on your local machine
   - Requires: Docker and Docker Compose
   - Best for: Development and testing

2) Google Cloud Platform (Cloud Run)
   - Hosted in the cloud
   - Requires: GCP project with billing enabled
   - Best for: Production deployment

Enter your choice [1-2]: 2
βœ“ Selected: Google Cloud Platform

Options:

  • 1 - Local Development: Runs the full stack on your local machine using Docker Compose
  • 2 - Google Cloud Platform: Deploys to GCP using Cloud Run and CloudSQL

Recommendation:

  • Use Local for development, testing, and learning
  • Use GCP for production deployments with scalability

Step 3: Select Components to Deploy

(Local deployments only) Choose which components to include:

==========================================
  Step 1b: Select Components to Deploy
==========================================

Which components would you like to deploy?

1) Full Stack (Database + Backend + Web Frontend)
   - Complete application with web interface
   - Best for: Full-stack deployment

2) Backend + Database Only (No Web Frontend)
   - API server and database only
   - Best for: Mobile app developers, API-only services

3) Web Frontend Only (requires existing Backend)
   - Deploy/update web frontend only
   - Best for: Updating web UI with existing backend

Enter your choice [1-3]: 1
βœ“ Selected: Full Stack (Database + Backend + Web)

Options:

  • 1 - Full Stack: Deploy complete application (MySQL + Backend + Web)
  • 2 - Backend + Database Only: For mobile developers or API-only use cases
  • 3 - Web Frontend Only: Update or redeploy web interface when backend is running

Note: This step only appears for local Docker deployments. GCP deployments always include all components.

Step 4: Prerequisites Check

The wizard verifies all required tools are installed.

==========================================
  Step 2: Checking Prerequisites
==========================================

βœ“ gcloud CLI found
βœ“ Authenticated with gcloud

What it checks:

For all deployments:

  • gcloud CLI installation
  • gcloud authentication status

For local deployments only:

  • Docker installation
  • Docker Compose availability

If checks fail:

  • Install missing tools
  • Authenticate with gcloud if prompted
  • Re-run the wizard after fixing issues

Step 5: Source Code Repositories

The wizard checks if source code repositories are present and offers to clone them.

==========================================
  Step 2b: Checking Source Code Repositories
==========================================

βœ“ Backend repository found
βœ“ Web repository found

What it does:

  • Checks for temp-number-backend/ directory
  • Checks for temp-number-web/ directory
  • Offers to clone missing repositories if not found

If repositories are missing:

⚠ Backend repository (temp-number-backend) not found
⚠ Web repository (temp-number-web) not found

Missing repositories: temp-number-backend temp-number-web

These repositories contain the application source code and are required.

Would you like to clone the missing repositories now? (y/n):

Options:

  • y - Automatically clone repositories using git
  • n - Skip and clone manually later

If you choose ‘y’: The wizard will run:

git clone https://github.com/platfone-com/temp-number-backend.git
git clone https://github.com/platfone-com/temp-number-web.git

Step 6: Firebase Project Setup

Firebase is required for all deployments (authentication).

==========================================
  Step 3: Firebase Project Setup
==========================================

Firebase is required for user authentication.

Choose how to configure Firebase:
1) I have an existing Firebase project configured (provide key manually)
2) Set up a new or configure existing Firebase project (via GCP)

Enter your choice [1-2]: 2
β„Ή Setting up new GCP project and Firebase...

The wizard now offers two options for Firebase setup:

Option 1: Manual Firebase Key (Existing Project)

Use this option if you already have a Firebase project configured. This allows you to start without billing enabled.

If you answer ‘1’ (manual key for existing Firebase project):

Please download the Firebase Admin SDK key manually:
1. Go to Firebase Console: https://console.firebase.google.com/
2. Select your project
3. Go to Project Settings > Service Accounts
4. Click 'Generate New Private Key'
5. Save the file as: /path/to/config/secrets/firebase-service-account.json

Press Enter when you have downloaded the key...

Steps:

  1. Visit Firebase Console
  2. Select your project
  3. Navigate to Project Settings (gear icon) β†’ Service Accounts
  4. Click Generate New Private Key
  5. Download the JSON file
  6. Save it as: config/secrets/firebase-service-account.json
  7. Press Enter in the wizard

The wizard will:

  • Verify the file exists
  • Extract the project ID from the key
  • Continue with setup

Option 2: Automated GCP & Firebase Setup

If you answer ‘2’ (automated setup via GCP), the wizard will guide you through a complete GCP and Firebase setup:

GCP Project Creation
==========================================
  GCP Project Setup for Temp Number
==========================================

Select GCP Project:

1) Use existing project
2) Create new project

Enter choice [1-2]: 2
Enter new project ID (lowercase, hyphens allowed): temp-number
Enter project name [default: temp-number]:

β„Ή Creating project 'temp-number'...
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/temp-number].
Waiting for [operations/create_project.global.8107866941552596405] to finish...done.
Enabling service [cloudapis.googleapis.com] on project [temp-number]...
Operation "operations/acat.p2-832601501946-408b1370-d5d2-46c4-84f1-012d142dc397" finished successfully.
INFORMATION: Project 'temp-number' has no 'environment' tag set. Use either 'Production', 'Development', 'Test', or 'Staging'. Add an 'environment' tag using `gcloud resource-manager tags bindings create`.

βœ“ Project created
Updated property [core/project].
βœ“ Active project: temp-number

The wizard will:

  1. Create a new GCP project with your chosen ID
  2. Set it as the active project
  3. Check and enable billing
  4. Enable all required APIs
  5. Create a service account with necessary permissions
  6. Download the service account key
Billing Configuration
==========================================
  Checking Billing
==========================================

β„Ή Ensuring Cloud Billing API is enabled...
βœ“ Cloud Billing API is enabled

billingAccountName: ''
billingEnabled: false
name: projects/temp-number/billingInfo
projectId: temp-number

β„Ή Checking billing status...
⚠ Billing is not enabled for this project

β„Ή Fetching available billing accounts...
Available billing accounts:

1) Firebase Payment
   ID: 012345-67890AB-CDEFG

Select billing account [1-1]: 1
β„Ή Linking project to billing account: Firebase Payment
billingAccountName: billingAccounts/012345-67890AB-CDEFG
billingEnabled: true
name: projects/temp-number/billingInfo
projectId: temp-number

βœ“ Billing account linked successfully
API Enablement

For local Docker deployments, API enablement is skipped:

β„Ή Skipping API enablement (--skip-apis)

β„Ή Skipping service account setup (--skip-service-account)

For GCP cloud deployments, the wizard automatically enables all required APIs:

==========================================
  Enabling Required APIs
==========================================

β„Ή Enabling cloudbuild.googleapis.com...
βœ“ cloudbuild.googleapis.com enabled
β„Ή Enabling run.googleapis.com...
βœ“ run.googleapis.com enabled
β„Ή Enabling sqladmin.googleapis.com...
βœ“ sqladmin.googleapis.com enabled
β„Ή Enabling secretmanager.googleapis.com...
βœ“ secretmanager.googleapis.com enabled
β„Ή Enabling artifactregistry.googleapis.com...
βœ“ artifactregistry.googleapis.com enabled
Service Account Creation

For local Docker deployments, service account creation is skipped:

==========================================
  Setup Summary
==========================================

βœ“ Setup completed successfully!

Project Details:
  β€’ Project ID: temp-number
  β€’ Service Account: Skipped

Service Account Key:
  β„Ή GCP Service Account: Skipped

Next Steps:
GCP project created.

1. Set up Firebase Authentication:
   ./setup_firebase_project.sh --project-id temp-number

2. For cloud deployment later, enable required APIs and service account:
   ./setup_gcp_project.sh --project-id temp-number

For GCP cloud deployments, the wizard creates a service account:

==========================================
  Creating Service Account
==========================================

β„Ή Creating service account 'temp-number-deployer'...
βœ“ Service account created

==========================================
  Granting IAM Roles
==========================================

β„Ή Granting roles/cloudsql.admin...
βœ“ roles/cloudsql.admin granted
β„Ή Granting roles/run.admin...
βœ“ roles/run.admin granted
β„Ή Granting roles/secretmanager.admin...
βœ“ roles/secretmanager.admin granted

The service account is granted these roles (GCP deployments only):

  • roles/cloudsql.admin - Manage CloudSQL databases
  • roles/cloudbuild.builds.editor - Build container images
  • roles/run.admin - Deploy Cloud Run services
  • roles/storage.admin - Access Cloud Storage
  • roles/iam.serviceAccountUser - Act as service accounts
  • roles/artifactregistry.admin - Manage container registry
  • roles/secretmanager.admin - Manage secrets
Firebase Setup

After GCP project setup, the wizard configures Firebase:

βœ“ GCP project setup complete: temp-number

β„Ή Setting up Firebase for project: temp-number

==========================================
  Firebase Project Setup
==========================================

β„Ή Setting GCP project: temp-number
β„Ή Configuring quota project for Application Default Credentials...
β„Ή Using current gcloud authentication
β„Ή Active account: [email protected]

==========================================
  Enabling Required APIs
==========================================

β„Ή Enabling firebase.googleapis.com...
βœ“ firebase.googleapis.com enabled
β„Ή Enabling identitytoolkit.googleapis.com...
βœ“ identitytoolkit.googleapis.com enabled
β„Ή Enabling serviceusage.googleapis.com...
βœ“ serviceusage.googleapis.com enabled
β„Ή Enabling cloudresourcemanager.googleapis.com...
βœ“ cloudresourcemanager.googleapis.com enabled
βœ“ All APIs enabled successfully

==========================================
  Adding Firebase to Project
==========================================

βœ“ Firebase added to project successfully

==========================================
  Initializing Firebase Authentication
==========================================

βœ“ Firebase Auth initialized successfully
Firebase Web App Creation
==========================================
  Initializing Firebase Web App
==========================================

β„Ή Checking for existing web apps...
β„Ή Creating new Firebase web app...
β„Ή Web app creation started (operation: operations/workflows/NjE3MGNmZWItYTRkMC00YzJkLWE0MjEtM2M2ZDQ4MTlmY2Iw)
β„Ή Waiting for operation to complete...
β„Ή Still waiting... (attempt 1/20)
βœ“ Operation completed
βœ“ Firebase web app created: 1:832601501946:web:0d4619583ad7a6382f1943
β„Ή Waiting for app configuration to be ready...
β„Ή Retrieving web app configuration...

βœ“ Firebase Web App Created Successfully!

==========================================
  πŸ”₯ Firebase Web App Configuration
==========================================

β„Ή Firebase SDK values retrieved and will be validated/populated automatically.

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

VITE_FIREBASE_WEB_API_KEY=AIzaSyCUjyD24gCCv3R6U743Gdioo0s-f5BXXKw
VITE_FIREBASE_AUTH_DOMAIN=temp-number.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=temp-number
VITE_FIREBASE_APP_ID=1:832601501946:web:0d4619583ad7a6382f1943

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Automatic Configuration

The Firebase SDK values are now automatically populated in your web.env file. The wizard will validate and update the configuration file for you.

Authentication Provider Configuration
==========================================
  Authentication Provider Configuration
==========================================

Which authentication providers would you like to enable?

Enable Email/Password authentication? (y/n) [default: y]:
Enable Google OAuth? (y/n) [default: n]:
Enable Apple OAuth? (y/n) [default: n]:
Enable Facebook OAuth? (y/n) [default: n]:

==========================================
  Configuring Sign-In Methods
==========================================

β„Ή   β†’ Email/Password: enabled (password required: true)
βœ“ Sign-in methods configured successfully
Authorized Domains
==========================================
  Configuring Authorized Domains
==========================================

β„Ή Fetching existing authorized domains...
β„Ή No existing domains found
β„Ή Authorized domains to be configured:
  β€’ localhost
  β€’ temp-number.firebaseapp.com
  β€’ temp-number.web.app

βœ“ Authorized domains configured successfully
Firebase Admin SDK Key
==========================================
  Downloading Firebase Admin SDK Key
==========================================

β„Ή Looking for Firebase Admin SDK service account...
β„Ή Attempt 1/12: Service account not found yet, waiting 5 seconds...
βœ“ Found Firebase service account: [email protected]
β„Ή Creating service account key...
β„Ή Attempt 1/5: Service account not fully provisioned yet, waiting 10 seconds...
βœ“ Key downloaded to: /home/user/temp-number-deploy/config/secrets/firebase-service-account.json
βœ“ Permissions set to 600
Setup Summary
==========================================
  Setup Summary
==========================================

βœ“ Setup completed successfully!
β„Ή ==========================================

Project: temp-number

Configured Authentication Methods:
  βœ“ Email/Password (password required: true)

Firebase Admin SDK Key: /home/user/temp-number-deploy/config/secrets/firebase-service-account.json

Authorized Domains:
  - localhost
  - temp-number.firebaseapp.com
  - temp-number.web.app

Next Steps:
1. Verify Firebase Authentication settings in Firebase Console:
   https://console.firebase.google.com/project/temp-number/authentication/providers

2. Update your backend configuration with Firebase credentials

β„Ή For more details, see Firebase Console:
β„Ή https://console.firebase.google.com/project/temp-number

βœ“ Firebase setup complete for project: temp-number

β„Ή Skipping GCP service account setup (not needed for local Docker deployment)

Step 7: Configuration Files Check

After Firebase/GCP setup is complete, the wizard verifies all configuration files are present.

==========================================
  Step 5: Configuration Files
==========================================

Checking required configuration files...

⚠ backend.env not found
⚠ web.env not found
⚠ backend.secrets not found
βœ“ firebase-service-account.json found

β„Ή Creating missing configuration files from templates...

βœ“ Created backend.env from template
βœ“ Created web.env from template
βœ“ Created backend.secrets from template

⚠️  IMPORTANT: You need to edit the configuration files with your values

Configuration files that need editing:
  β€’ /home/user/temp-number-deploy/config/env/backend.env
    (Database settings, server config)
  β€’ /home/user/temp-number-deploy/config/env/web.env
    (Firebase config, API URLs)
  β€’ /home/user/temp-number-deploy/config/secrets/backend.secrets
    (API keys, passwords, APP_KEY)

You can edit these files now or later.
The setup cannot continue until these files are properly configured.

Would you like to edit them interactively now? (y/n): y

Interactive Editing:

If you answer y, the wizard opens each configuration file in nano editor for you to edit:

  1. backend.env - Opens in nano for editing
  2. web.env - Opens in nano for editing
  3. backend.secrets - Opens in nano for editing (this is where you set your PLATFONE_API_KEY)

After Editing:

βœ“ Configuration files edited

==========================================
  Validating Firebase Web Configuration
==========================================

⚠ Firebase SDK values not set in web.env - populating automatically...
β„Ή Backed up web.env to: /home/user/temp-number-deploy/config/env/web.env.backup.20251114_160920
βœ“ Firebase SDK values populated in web.env

β„Ή Verifying configuration files...

β„Ή Skipping DB_PASSWORD validation for local Docker deployment
β„Ή Validating PLATFONE_API_KEY by making test request to https://temp-number-api.com/test/api/v1...
βœ“ PLATFONE_API_KEY is valid

The wizard now:

  • Automatically populates Firebase SDK values in web.env (creates a backup first)
  • Validates your PLATFONE_API_KEY by making a test API request
  • Skips database password validation for local deployments (uses default)

Minimal Configuration to Launch

For a quick demo build, you only need to set:

In backend.secrets:

  • PLATFONE_API_KEY - Your Platfone API key

All other values use sensible defaults.

For detailed configuration options, refer to Configuration Guide.

Step 8: Deploy Application

After all prerequisites are complete, the wizard offers to deploy.

β„Ή All prerequisites are complete!

Ready to deploy? (y/n): y

For Docker Deployment

If you selected Local Development:

==========================================
  Step 6: Deploy Application
==========================================

β„Ή Deploying to local Docker Compose...

β„Ή Configuring for local deployment...

β„Ή Note: Configuration overrides for Docker deployment:
  - DB_HOST='mysql'
  - DB_PORT=3306
  - DB_PASSWORD=temp_number_password (default if not set in backend.secrets)
  - ALLOWED_ORIGINS='http://localhost:8080'


β„Ή Starting Docker Compose...

This will:
  1. Build Docker images
  2. Start MySQL database
  3. Start backend service
  4. Start web frontend
  5. Run database migrations

Press Enter to start deployment...

==========================================
  Docker Compose Local Setup
==========================================

βœ“ Docker and Docker Compose are installed

β„Ή Checking configuration files...
βœ“ Configuration files exist

βœ“ Firebase credentials found
β„Ή Setting Firebase service account file permissions...
βœ“ Permissions set (644)

βœ“ Project directories found

β„Ή Creating .env file for Docker Compose...
βœ“ Configuration loaded from .env file

β„Ή Running mode: background (start services in background)
β„Ή Starting services in background (profile: full)...

What happens:

  1. The wizard runs ./docker-start.sh
  2. Validates Docker and configuration files
  3. Sets proper permissions on Firebase credentials
  4. Creates Docker Compose .env file
  5. Starts building Docker images for backend and web

Docker Build Output:

[+] Building 5.7s (27/34)
 => [web build 5/7] RUN npx update-browserslist-db@latest && npm install              3.5s
 => => # npm warn exec The following package was not found and will be installed: [email protected]
 => => # Latest version:     1.0.30001754
 => => # Installed version:  1.0.30001698
 => => # Removing old caniuse-lite from lock file
 => => # Installing new caniuse-lite version
 => => # $ npm install caniuse-lite

The build process:

  • Uses cached layers where possible for faster builds
  • Downloads and installs npm dependencies
  • Builds the React frontend application
  • Creates optimized production images

Success output:

πŸŽ‰ Deployment complete!

Your application is now running:
  β€’ Web Frontend: http://localhost:8080/app/
  β€’ Backend API:  http://localhost:3333/api
  β€’ MySQL:        localhost:3336

To manage your Docker services (view logs, stop, clean, etc.):
  ./docker-start.sh

For GCP Deployment

If you selected Google Cloud Platform:

Step 6: Deploy Application

Deploying to Google Cloud Platform...

This will:
  1. Create CloudSQL database instance
  2. Deploy backend to Cloud Run
  3. Run database migrations
  4. Deploy web frontend to Cloud Run

Press Enter to start deployment...

What happens:

  1. Runs deploy_app.sh with all parameters
  2. Creates CloudSQL MySQL instance
  3. Deploys backend to Cloud Run
  4. Runs database migrations
  5. Deploys web frontend to Cloud Run
  6. Configures environment variables and secrets

Success output:

βœ“ πŸŽ‰ Deployment complete!

Your application is now deployed to Google Cloud.

To get service URLs:
  gcloud run services describe temp-number-web --region us-central1 --format='value(status.url)'
  gcloud run services describe temp-number-backend --region us-central1 --format='value(status.url)'

To view logs:
  gcloud logging read 'resource.type=cloud_run_revision' --limit 100 --project=temp-number

==========================================
  Step 7: Configuring Firebase Authentication
==========================================

β„Ή Checking current Firebase Auth configuration...
β„Ή Web deployment: Using frontend URL from web.env
β„Ή Callback URL: https://temp-number-web-p4oh4mgzxa-uc.a.run.app/app/deeplink
β„Ή Authorized domain: temp-number-web-p4oh4mgzxa-uc.a.run.app
β„Ή Setting Firebase Auth callback URL and authorized domain...

Post-Deployment Firebase Configuration:

After GCP deployment completes, the wizard automatically:

  1. Retrieves the Cloud Run service URL for your web frontend
  2. Configures the Firebase Auth callback URL (for deep linking)
  3. Adds the Cloud Run domain to Firebase authorized domains
  4. Updates Firebase Auth settings to work with your deployed application

This ensures Firebase Authentication works correctly with your production deployment.

Automated Deployment

For automated or CI/CD deployments, please refer to:

CI/CD Integration

The setup wizard can be integrated into CI/CD pipelines for automated deployments. Setup wizard outputs commands it runs, which can be scripted in your pipeline.

Troubleshooting

Common Issues

Issue: “Docker not found”

# Install Docker
curl -fsSL https://get.docker.com | sh

Issue: “gcloud not authenticated”

# Authenticate with Google Cloud
gcloud auth login
gcloud auth application-default login

Issue: “Firebase credentials invalid”

  • Ensure you downloaded the service account JSON from Firebase Console
  • Check file path is correct and file is readable
  • Verify the service account has required permissions

Issue: “Platfone API validation failed”

  • Check your API key is correct
  • Ensure your Platfone account is active
  • Verify the API URL is correct

Getting Help

If you encounter issues:

  1. Review deployment output for errors and warnings
  2. Review troubleshooting section above
  3. Contact support at

What’s Next?

After successful deployment:

Configuration

Configure authentication, payments, and more

Development Guide

Customize and extend the application