These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
To use this component you need ESP-IDF installed on your machine, see espressif getting started guide on how to do that natively or you can simply use PlatformIO.
- Install PlatformIO Extension for vscode
- Create a new project using ESP-IDF framework
- Under the root of the project create a new directory called components
- Clone this repo under the components directory
$ cd components
$ git clone https://github.com/kaizoku-oh/firestore.git
- To avoid exposing sensitive data in the code we'll store them in environment variables that'll be when building the project.
Add your WiFi SSID, WiFi password, Firebase project ID, Firebase API key as environment variables like the following:
# Set local environment variables
> $env:WIFI_SSID = '"TYPE_YOUR_WIFI_SSID_HERE"'
> $env:WIFI_PASS = '"TYPE_YOUR_WIFI_PASSWORD_HERE"'
> $env:FIRESTORE_FIREBASE_PROJECT_ID = '"TYPE_YOUR_FIREBASE_PROJECT_ID_HERE"'
> $env:FIRESTORE_FIREBASE_API_KEY = '"TYPE_YOUR_FIREBASE_API_KEY_HERE"'
# OPTIONAL: To read and verify the values of the variables that you just set:
> Get-ChildItem Env:WIFI_SSID
> Get-ChildItem Env:WIFI_PASS
> Get-ChildItem Env:FIRESTORE_FIREBASE_PROJECT_ID
> Get-ChildItem Env:FIRESTORE_FIREBASE_API_KEY
# Set local environment variables
$ export WIFI_SSID='"TYPE_YOUR_WIFI_SSID_HERE"'
$ export WIFI_PASS='"TYPE_YOUR_WIFI_PASS_HERE"'
$ export FIRESTORE_FIREBASE_PROJECT_ID='"TYPE_YOUR_FIREBASE_PROJECT_ID_HERE"'
$ export FIRESTORE_FIREBASE_API_KEY='"TYPE_YOUR_FIREBASE_PROJECT_ID_HERE"'
# OPTIONAL: To read and verify the values of the variables that you just set:
$ echo $WIFI_SSID
$ echo $WIFI_PASS
$ echo $FIRESTORE_FIREBASE_PROJECT_ID
$ echo $FIRESTORE_FIREBASE_API_KEY
- Open you firebase console
- Go to Project settings
- Scroll down to SDK setup and configuration
- Select the Config option and you'll be presented with something like this:
From there you can copy your projectId and apiKey.
const firebaseConfig = {
apiKey: "YOUR_FIRESTORE_FIREBASE_API_KEY",
authDomain: "XXXXXXXXXXXXXXXXXXXXXXXX",
databaseURL: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
projectId: "YOUR_FIRESTORE_FIREBASE_PROJECT_ID",
storageBucket: "XXXXXXXXXXXXXXXXXXXXXXXX",
messagingSenderId: "XXXXXXXXXXXXXX",
appId: "XXXXXXXXXXXXXXXXXXXXXX"
};
- Finally you can build project, upload the firmware to the board and start a serial monitor all with a single combined command:
$ pio run --target upload --target monitor
- Add contribution guide
- Refactor code and remove repeated parts
- Add doxygen comments
- Add anonymous authentication
- Add CI/CD
- Add thread safety
- Bayrem Gharsellaoui - Initial work - kaizoku-oh
This project is licensed under the MIT License - see the LICENSE.md file for details