Skip to content

feat(mobile): add APP_VARIANT to make it easier to install multiple variants#2422

Open
xuatz wants to merge 4 commits intokarakeep-app:mainfrom
xuatz:feat/app-variant-dx
Open

feat(mobile): add APP_VARIANT to make it easier to install multiple variants#2422
xuatz wants to merge 4 commits intokarakeep-app:mainfrom
xuatz:feat/app-variant-dx

Conversation

@xuatz
Copy link
Collaborator

@xuatz xuatz commented Jan 22, 2026

Summary

  • update app.config.js to switch between app.hoarder.hoardermobile or app.hoarder.hoardermobile.dev based on process.env.APP_VARIANT
  • added mobile related pnpm verbose scripts and alias for convenience
    • also updated docs

Details

Added env var APP_VARIANT, that is entirely meant for developers, not for users, to make it more convenient to install multiple instances of the mobile app on their devices.

Currently only supports production build (default) and dev build (process.env.APP_VARIANT === "development"). Potentially it could be extended to include other variants such as APP_VARIANT=(nightly|local) in future.

xuatz added 2 commits January 22, 2026 23:21
…ariants

- such as `production`, `development` and maybe `nightly` and `local`?
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 22, 2026

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds a development variant flow: introduces IS_DEV in mobile app config to toggle name/identifiers, sets APP_VARIANT for dev builds in eas.json, adds mobile dev/release/clean scripts, and updates mobile setup docs and commands for dev workflows (iOS/Android).

Changes

Cohort / File(s) Summary
Mobile app config & build env
apps/mobile/app.config.js, apps/mobile/eas.json
Adds an IS_DEV flag (derived from APP_VARIANT) to toggle expo.name, ios.bundleIdentifier, and android.package between dev and prod variants; adds APP_VARIANT: "development" to the development build env in eas.json.
Mobile package scripts
apps/mobile/package.json
Adds scripts: clean:prebuild, clean:prebuild:dev, android:dev:release, ios:dev:release to support dev prebuild/cleanup and dev release workflows.
Repo-level scripts
package.json
Adds root convenience scripts android and ios that proxy to the mobile package via pnpm filter.
Documentation updates
docs/versioned_docs/version-v0.29.0/07-development/01-setup.md
Replaces direct expo prebuild/run commands with filter-based pnpm --filter mobile commands, documents --clean and APP_VARIANT=development usage, and adds an "Installing a release build (android)" dev-variant workflow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(mobile): add APP_VARIANT to make it easier to install multiple variants' accurately reflects the main change: introducing an APP_VARIANT environment variable to support multiple app installations with different bundle identifiers.
Description check ✅ Passed The description is clearly related to the changeset, providing context about the APP_VARIANT feature, its purpose for developers, current implementation, and future extensibility.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@xuatz xuatz requested a review from MohamedBassem January 22, 2026 14:37
@xuatz xuatz marked this pull request as ready for review January 22, 2026 14:37
@greptile-apps
Copy link

greptile-apps bot commented Jan 22, 2026

Greptile Summary

This PR adds APP_VARIANT environment variable support to enable developers to install multiple variants of the mobile app (production and dev) side-by-side on their devices. The implementation modifies the app name and bundle identifiers conditionally based on APP_VARIANT=development, updates EAS build configuration, adds convenience scripts for variant-specific builds, and provides comprehensive documentation.

  • Clean implementation that properly handles variant switching at build time
  • Documentation is thorough and includes helpful TLDR section for quick setup
  • Root-level convenience scripts improve developer experience in monorepo
  • All changes are well-contained and don't affect production builds when APP_VARIANT is not set

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward and well-isolated. The variant logic only activates when APP_VARIANT=development is explicitly set, so production builds remain unchanged. The implementation follows Expo best practices for app variants and includes comprehensive documentation.
  • No files require special attention

Important Files Changed

Filename Overview
apps/mobile/app.config.js Added IS_DEV constant to conditionally set app name and bundle identifiers based on APP_VARIANT environment variable, enabling multiple app variants to coexist
apps/mobile/eas.json Added APP_VARIANT environment variable to development build configuration to ensure proper variant is set during EAS builds
apps/mobile/package.json Added convenience scripts for prebuild cleaning and variant-specific builds (clean:prebuild, clean:prebuild:dev, android:dev:release, ios:dev:release, expo)
docs/versioned_docs/version-v0.29.0/07-development/01-setup.md Added comprehensive documentation for APP_VARIANT usage, including TLDR section, detailed explanations of prebuild process, and release build instructions
package.json Added root-level convenience scripts (android, ios) for running mobile commands from monorepo root

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

"android": "expo run:android",
"android:dev:release": "APP_VARIANT=development pnpm run android --variant release",
"ios": "expo run:ios",
"ios:dev:release": "echo 'i don't have an ios device to confirm if this works'",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: placeholder echo command instead of actual implementation

Suggested change
"ios:dev:release": "echo 'i don't have an ios device to confirm if this works'",
"ios:dev:release": "APP_VARIANT=development pnpm run ios --configuration Release",
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile/package.json
Line: 14:14

Comment:
**style:** placeholder echo command instead of actual implementation

```suggestion
    "ios:dev:release": "APP_VARIANT=development pnpm run ios --configuration Release",
```

How can I resolve this? If you propose a fix, please make it concise.

alias: `pnpm --filter mobile clean:prebuild`
- why would I want to change the bundleIdentifier/package?
- so you can install `dev` variant, to try out your own build alongside your "production" karakeep app without uninstalling it
- you need to inject the env var`APP_VARIANT=development`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: missing space between var and backtick

Suggested change
- you need to inject the env var`APP_VARIANT=development`
- you need to inject the env var `APP_VARIANT=development`
Prompt To Fix With AI
This is a comment left during a code review.
Path: docs/versioned_docs/version-v0.29.0/07-development/01-setup.md
Line: 145:145

Comment:
**syntax:** missing space between `var` and backtick

```suggestion
    - you need to inject the env var `APP_VARIANT=development`
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/mobile/package.json`:
- Line 14: The npm script "ios:dev:release" contains an unescaped apostrophe in
the single-quoted string which breaks shell parsing; update the script value for
"ios:dev:release" to use double quotes around the string or escape the
apostrophe (e.g., "i don't have..." or 'i don'\''t have...') so the shell sees a
valid quoted string.
🧹 Nitpick comments (2)
package.json (1)

16-17: LGTM! Consider using the full package name for consistency.

The scripts correctly delegate to the mobile workspace. However, other scripts in this file use the full scoped package name (e.g., @karakeep/web, @karakeep/db). For consistency, consider using @karakeep/mobile:

-    "android": "pnpm --filter mobile android",
-    "ios": "pnpm --filter mobile ios",
+    "android": "pnpm --filter `@karakeep/mobile` android",
+    "ios": "pnpm --filter `@karakeep/mobile` ios",

Both forms work with pnpm, so this is a minor style suggestion.

docs/versioned_docs/version-v0.29.0/07-development/01-setup.md (1)

164-167: Consider removing personal anecdote from documentation.

The phrase "my personal experience is that instead, the key is to run" is informal for project documentation. Consider rephrasing to be more direct:

📝 Suggested revision
-- You might need to add `APP_VARIANT=development` if you intend to run the dev variant, however, my personal experience is that instead, the key is to run `prebuild` with `APP_VARIANT=development` instead
-  `APP_VARIANT=development pnpm android`
-  or 
-  `pnpm --filter mobile clean:prebuild:dev && pnpm android`
+- For the dev variant, ensure you run `prebuild` with `APP_VARIANT=development`:
+  `pnpm --filter mobile clean:prebuild:dev && pnpm android`

@xuatz xuatz marked this pull request as draft January 22, 2026 14:44
"android": "expo run:android",
"android:dev:release": "APP_VARIANT=development pnpm run android --variant release",
"ios": "expo run:ios",
"ios:dev:release": "echo 'i dont have an ios device to confirm if this works'",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heads up, i haven't tested it on ios ^^

@xuatz xuatz marked this pull request as ready for review January 22, 2026 14:58
@greptile-apps
Copy link

greptile-apps bot commented Jan 22, 2026

Greptile found no issues!

From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/versioned_docs/version-v0.29.0/07-development/01-setup.md`:
- Around line 179-182: Replace the verbose, informal paragraph about running the
Android dev variant with a concise authoritative instruction: remove anecdotal
language and the contradictory suggestion to set APP_VARIANT at runtime, and
instead state that you should run the prebuild-clean step followed by the
android command (use the existing npm script names referenced in the diff:
clean:prebuild:dev, prebuild and the pnpm android invocation); e.g., advise
running "pnpm --filter mobile clean:prebuild:dev && pnpm android" (omit
APP_VARIANT unless a specific build variant is required and, if so, state it
explicitly and consistently).
♻️ Duplicate comments (1)
docs/versioned_docs/version-v0.29.0/07-development/01-setup.md (1)

158-158: Fix spacing before inline code.

Missing space between "var" and the backtick.

🔧 Proposed fix
-    - you need to inject the env var `APP_VARIANT=development`  
+    - you need to inject the env var `APP_VARIANT=development`
🧹 Nitpick comments (2)
docs/versioned_docs/version-v0.29.0/07-development/01-setup.md (2)

136-136: Consider a more professional heading.

The triple question marks ("???") in the heading are unconventional for technical documentation. Consider a clearer alternative like "Quick Commands" or "TL;DR: Quick Start Commands".

📝 Suggested heading alternatives
-#### TLDR??? THIS IS TOO VERBOSE!
+#### TL;DR: Quick Start Commands

or

-#### TLDR??? THIS IS TOO VERBOSE!
+#### Quick Commands

188-188: Clarify the release build concept more directly.

The phrase "It might be slightly confusing, but..." is unnecessarily tentative. State the concept clearly and confidently.

✍️ Suggested rewording
-It might be slightly confusing, but if you want to install the `dev` variant of the app, but you want it to be a "release" build; does not use the dev server, you can do the following:
+To install the `dev` variant as a release build (standalone, without the dev server), use the following commands:

Comment on lines +179 to +182
- You might need to add `APP_VARIANT=development` if you intend to run the dev variant, however, my personal experience is that instead, the key is to run `prebuild` with `APP_VARIANT=development` instead. But after you already prebuild properly, then you can just run run expo
`APP_VARIANT=development pnpm android`
or
`pnpm --filter mobile clean:prebuild:dev && APP_VARIANT=development pnpm android`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Simplify and clarify the Android setup instructions.

The current explanation is verbose, contradictory, and uses informal language ("my personal experience"). The guidance should be clear and authoritative.

📚 Proposed simplification
-- You might need to add `APP_VARIANT=development` if you intend to run the dev variant, however, my personal experience is that instead, the key is to run `prebuild` with `APP_VARIANT=development` instead. But after you already prebuild properly, then you can just run run expo
-  `APP_VARIANT=development pnpm android`
-  or 
-  `pnpm --filter mobile clean:prebuild:dev && APP_VARIANT=development pnpm android`
+- For the dev variant, ensure you've run prebuild with `APP_VARIANT=development` first:
+  ```sh
+  pnpm --filter mobile clean:prebuild:dev && pnpm android
+  ```

Note: This aligns with the TLDR section above and provides clear, non-contradictory guidance.

🧰 Tools
🪛 LanguageTool

[style] ~179-~179: You have already used this phrasing in nearby sentences. Consider replacing it to add variety to your writing.
Context: ...ted on the emulator/device. - You might need to add APP_VARIANT=development if you in...

(REP_NEED_TO_VB)

🤖 Prompt for AI Agents
In `@docs/versioned_docs/version-v0.29.0/07-development/01-setup.md` around lines
179 - 182, Replace the verbose, informal paragraph about running the Android dev
variant with a concise authoritative instruction: remove anecdotal language and
the contradictory suggestion to set APP_VARIANT at runtime, and instead state
that you should run the prebuild-clean step followed by the android command (use
the existing npm script names referenced in the diff: clean:prebuild:dev,
prebuild and the pnpm android invocation); e.g., advise running "pnpm --filter
mobile clean:prebuild:dev && pnpm android" (omit APP_VARIANT unless a specific
build variant is required and, if so, state it explicitly and consistently).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant