Your Firestore database is created but has restrictive security rules. To deploy the LegalMind security rules:
# Install Firebase CLI if not already installed
npm install -g firebase-tools
# Login to Firebase
firebase login
# From the backend directory, deploy rules
firebase deploy --only firestore:rules --project=legalmind-486106- Go to Google Cloud Console
- Select project: legalmind-486106
- Navigate to Firestore Database
- Click Rules tab
- Replace the default rules with the content from
firestore.rules - Click Publish
The Google Firestore client library will automatically use Application Default Credentials if available:
If you're using a local service account key:
- Create a service account in Google Cloud Console
- Download the JSON key file
- Set in
.env.local:GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
If running on Google Cloud (App Engine, Cloud Run, Compute Engine):
- Credentials are automatically provided by the environment
- No additional setup needed
After updating security rules, test the connection:
# Restart backend
cd backend
python main_new.pyThe backend should now successfully connect to Firestore and the API should work.
Once connected, the following collections will be automatically created:
sessions- Chat session storagemessages- Message historycontracts- Uploaded contract documentsclauses- Extracted contract clausesthinking_logs- Agent reasoning/thinking processdocuments- Generated legal documents
- Project ID: legalmind-486106
- Project Number: 677928716377
- Database: (default)
- Edition: Standard Edition
- Mode: Firestore Native
- Location: Multi-region (nam5 - United States)
- SLA: 99.999%