This application integrates with Google Cloud Storage (GCP) for document uploads. Follow these steps to configure it.
- Google Cloud Project created
- Billing enabled on the project
- Cloud Storage API enabled
# Visit https://console.cloud.google.com/
# Create a new project or use an existing one# In GCP Console:
# 1. Go to APIs & Services > Library
# 2. Search for "Cloud Storage"
# 3. Click on "Google Cloud Storage API"
# 4. Click "Enable"# In GCP Console:
# 1. Go to APIs & Services > Service Accounts
# 2. Click "Create Service Account"
# 3. Fill in the details:
# - Service account name: claims-storage-account
# - Service account ID: claims-storage-account
# 4. Click "Create and Continue"
# 5. Grant the following roles:
# - Storage Admin (roles/storage.admin)
# 6. Click "Continue" and "Done"# In the Service Accounts page:
# 1. Click on the service account you just created
# 2. Go to the "Keys" tab
# 3. Click "Add Key" > "Create new key"
# 4. Select "JSON" format
# 5. Click "Create" - this downloads a JSON file with your credentials
# 6. Save this file securely (you'll need it for environment setup)# In GCP Console:
# 1. Go to Cloud Storage > Buckets
# 2. Click "Create"
# 3. Enter bucket name: claims-documents (or your preferred name)
# 4. Choose location: Select appropriate region for your data
# 5. Choose storage class: Standard
# 6. Leave other options as default
# 7. Click "Create"You have two options to configure GCP credentials:
# Set the path to your downloaded JSON key file:
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json# Extract the credentials from the JSON file and set:
export GOOGLE_CLOUD_PROJECT=your-project-id
export GOOGLE_CLOUD_CREDENTIALS='{"type":"service_account",...}'
export GCP_BUCKET_NAME=claims-documentsAdd to your .env.local or Vercel environment:
GCP_BUCKET_NAME=claims-documents
GOOGLE_CLOUD_PROJECT=your-project-id
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json
Or if using the JSON credentials as an env var:
GOOGLE_CLOUD_CREDENTIALS='{"type":"service_account","project_id":"...","...'
GCP_BUCKET_NAME=claims-documents
For Vercel deployment:
- Go to your Vercel project settings
- Navigate to "Environment Variables"
- Add the following:
GCP_BUCKET_NAME: Your bucket nameGOOGLE_CLOUD_PROJECT: Your GCP project IDGOOGLE_CLOUD_CREDENTIALS: The entire JSON content from your service account key (as a single line)
Once configured, documents uploaded through the application will automatically be stored in GCP Cloud Storage with:
- Automatic timestamping to prevent filename collisions
- Signed URLs with 7-day expiration for secure access
- Metadata preservation (MIME type, upload time, etc.)
- Automatic cleanup capability
To verify GCP integration is working:
- Log into the application
- Navigate to the Documents section
- Upload a test document
- Check the upload completes successfully
- In GCP Console, verify the file appears in your bucket under
documents/folder
- Ensure the path to your JSON key file is correct and the file exists
- Or use the
GOOGLE_CLOUD_CREDENTIALSenvironment variable instead
- Verify the
GCP_BUCKET_NAMEenvironment variable matches your actual bucket name - Ensure the bucket exists in your GCP project
- Check that the service account has Storage Admin permissions
- Check the server logs for detailed error messages
- Verify the service account has the correct permissions
- Ensure the bucket name is correct in environment variables
- Never commit the JSON key file to version control
- Use environment variables for sensitive credentials
- Rotate credentials regularly for production deployments
- Use IAM roles with minimal required permissions
- Enable bucket versioning and retention policies for important documents
- Set up bucket logging to monitor access
If GCP credentials are not configured, the application will:
- Still accept file uploads
- Process them without cloud storage
- Log files to the local system (for development only)
- Show appropriate warnings in logs
To fully disable GCP:
- Don't set
GCP_BUCKET_NAMEorGOOGLE_CLOUD_PROJECTenvironment variables - The fallback in-memory storage will be used