PetrCala / Kiroku

Track your alcohol adventures using a React Native application
MIT License
0 stars 0 forks source link
Kiroku Icon

Kiroku - Alcohol Tracker

Download the app

image

Table of Contents

For developers

On the platform choice

Setting up the local environment

Updating the application version

Building for Android

Formatting

Managing ruby versions

Platform-Specific File Extensions

In most cases, the code written for this repo should be platform-independent. In such cases, each module should have a single file, index.js, which defines the module's exports. There are, however, some cases in which a feature is intrinsically tied to the underlying platform. In such cases, the following file extensions can be used to export platform-specific code from a module:

Note that index.js should be the default and only platform-specific implementations should be done in their respective files. i.e: If you have mobile-specific implementation in index.native.js, then the desktop/web implementation can be contained in a shared index.js.

index.ios.js and index.android.js are used when the app is running natively on respective platforms. These files are not used when users access the app through mobile browsers, but index.website.js is used instead. index.native.js are for both iOS and Android native apps. index.native.js should not be included in the same module as index.ios.js or index.android.js.

Working with Firebase

Writing Firebase rules

Overview

Strategy

Migrating the database

The database migration process is handled in a rather manual fashion. As of now, the procedure is as follows:

  1. Make sure your _dev folder contains the folder migrations. This folder should in turn contain folders input and output.
  2. Inside the input folder, place the database you want to migrate (do not rename it from the Firebase import).
  3. Call the relevant migration script (located inside the _dev/database/migration-scripts folder) from the _dev/main.tsx file. You can run this file using either bun, or ts-node.
  4. The output will be located in the _dev/migrations/output folder. From there, you can update the relevant database.

Database maintenance

You can schedule database maintenance directly from the command line using bun run maintenance:schedule, provided you have the corresponding admin SDK. After the maintenance is over, you will have to cancel it through running bun run maintenance:cancel. For more detail, see the following sections.

Scheduling maintenance

  1. In .env, set the environment of the database you want to schedule the maintenance for.
  2. Place the admin SDK file of this database into the project root, and make sure the admin SDK paths in the .env file are configured correctly to point to this file.
  3. From the project root, run

    bun run maintenance:schedule

    From there, follow the on-screen instructions.

Cancelling maintenance

  1. Follow steps 1-2 from the previous section.
  2. From the project root, run

    bun run maintenance:cancel

    and follow the on-screen instructions.

Understanding the maintenance mechanism