A Python project to connect and interact with Firebase using the Firebase Admin SDK.
-
Clone the repository (or you're already here!)
-
Create a virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure Firebase credentials:
- Go to your Firebase Console
- Project Settings → Service Accounts
- Generate a new private key (downloads a JSON file)
- Save the JSON file as
serviceAccountKey.jsonin the project root - Or set the path in your
.envfile
-
Set up environment variables:
- Copy
.env.exampleto.env - Update the values with your Firebase configuration
- Copy
Run the main script:
python main.pyfirebase-admin-python/
├── main.py # Main application entry point
├── config/ # Configuration files
│ └── firebase.py # Firebase initialization
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
└── README.md # This file
This project is set up to use:
- Authentication management
- Firestore database operations
- Realtime Database operations
- Cloud Storage
- Cloud Messaging
- Never commit
serviceAccountKey.jsonor.envfiles to version control - Keep your Firebase credentials secure
- Use environment variables for sensitive data