Google Cloud Storage Setup
Multiforum uses Google Cloud Storage (GCS) for file uploads including images, attachments, and downloads.
Create a Google Cloud Project
- Go to Google Cloud Console
- Create a new project or select an existing one
- Note your Project ID
Enable Cloud Storage API
- Go to APIs & Services > Library
- Search for "Cloud Storage"
- Click Cloud Storage API
- Click Enable
Create a Storage Bucket
- Go to Cloud Storage > Buckets
- Click Create Bucket
- Configure the bucket:
- Name: Choose a globally unique name (e.g.,
multiforum-uploads-yourname) - Location: Select a region close to your deployment
- Storage class: Standard
- Access control: Fine-grained
- Name: Choose a globally unique name (e.g.,
- Click Create
Configure CORS
To allow uploads from your frontend, configure CORS:
- Create a file named
cors.json:
[
{
"origin": ["https://your-frontend-domain.com"],
"method": ["GET", "POST", "PUT", "DELETE"],
"responseHeader": ["Content-Type"],
"maxAgeSeconds": 3600
}
]
- Apply the CORS configuration:
gcloud storage buckets update gs://your-bucket-name --cors-file=cors.json
Create a Service Account
- Go to IAM & Admin > Service Accounts
- Click Create Service Account
- Name it (e.g.,
multiforum-storage) - Click Create and Continue
- Grant the Storage Admin role
- Click Done
Generate and Encode the Key
- Click on your new service account
- Go to the Keys tab
- Click Add Key > Create new key
- Select JSON and click Create
- Save the downloaded JSON file securely
Base64 encode the key for use in environment variables:
base64 -i your-key-file.json
Required Environment Variables
Backend (.env)
GCS_BUCKET_NAME=your-bucket-name
GOOGLE_CREDENTIALS_BASE64=your-base64-encoded-credentials
Frontend (.env)
VITE_GOOGLE_CLOUD_STORAGE_BUCKET=your-bucket-name
Next Steps
Continue setting up the other prerequisites: