This is a React Native project created with Expo. The Diary Companion mobile application enables you to create, store, and manage your diary notes in the Firebase cloud. The app can be built for both Android and iOS platforms.
- JavaScript. Node version >=20
- Java Development Kit (JDK). Download from AdoptOpenJDK
-
npm install
To set up credentials for your Diary Companion application, follow these steps:
Step 1. Create a .env
File
Create a .env
file in the root folder of your project. You can use .env.example
as a template.
Step 2. Obtaine keystore for Android
SHA1 key value will be usef further while setting up Firebase project (step 3). For detailed instructions on obtaining a keystore, refer to the Obtaining Keystore section below.
Step 3. Set Up Firebase
- Create a new Firebase project in the Google Firebase Console.
- Obtain
firebaseConfig
from the Firebase Console (Web app) and paste the values into the corresponding variables in your.env
file. - Obtain
google-services.json
from the Firebase Console (Android app) and paste the value ofclient_id
(group"client_type": 3
) toEXPO_PUBLIC_WEB_CLIENT_ID
value in.env
file.
Step 4. Add Required Files
- Copy
google-services.json
andkeystore.jks
(if applicable) to the[root]/credentials/
folder. - Copy
GoogleService-Info.plist
to the[root]/credentials/
folder. - Copy any other necessary credentials to the
[root]/credentials/
folder.
-
For Android
Run the following command to build the app for production:
npm run build:a:c:prod
This command performs the following steps:
- Runs the secrets script:
npm run secrets
- Builds the app using Expo Application Services (EAS):
npx eas build -p android --profile production
- Runs the secrets script:
-
Download and Install
After the build completes, download the APK from the Expo build service, then install it on your mobile phone.
To run the app in development mode, use the following command:
npm run build:a:c:dev
This command runs the secrets script and builds the app using the development profile.
After the build completes, download the APK from the Expo build service, then install it on your mobile phone.
Start the dev mode application:
npm run start:build
In the output, you'll find options to open the app in a
- development build
- Android emulator
- iOS simulator
- Expo Go, a limited sandbox for trying out app development with Expo
You can start developing by editing the files inside the app directory. This project uses file-based routing.
For signing your Android app, you will need a keystore. You can use the eas credentials command to manage your keystore:
eas credentials
Follow the prompts to set up your keystore through the Expo Application Services (EAS) platform.
Ensure your eas.json file is configured to use the credentials stored on the EAS platform.
Alternatively, ollow these steps to generate a keystore locally:
Use the following command to generate a new keystore:
keytool -genkey -v -keystore [your_keystore_name].keystore -alias [your_alias_name] -keyalg RSA -keysize 2048 -validity 10000
Replace [your_keystore_name] with your desired keystore filename and [your_alias_name] with your chosen alias name.
Save the generated keystore.jks file in the [root]/credentials/ folder.
Add the keystore information to your eas.json file:
{ "android": { "buildType": "apk", "keystore": { "path": "./credentials/[your_keystore_name].keystore", "keyAlias": "[your_alias_name]" } } }
Replace [your_keystore_name] and [your_alias_name] with the appropriate values.
Now you're ready to build, run, and manage your Diary Companion app on Android and iOS platforms! If you encounter any issues, refer to the Expo and Firebase documentation or seek help from the community. Happy coding!