An open API service indexing awesome lists of open source software.

https://github.com/tiesen243/qianyu

A minimal and modern React Native starter template designed to provide a clean, scalable foundation for mobile applications.
https://github.com/tiesen243/qianyu

githib-actions heroui-native react-native-cli react-navigation

Last synced: 1 day ago
JSON representation

A minimal and modern React Native starter template designed to provide a clean, scalable foundation for mobile applications.

Awesome Lists containing this project

README

          

# Qianyu



Version API


Version Desktop


Version Web


Version Mobile


License



CI


Release


Publish

## Overview

Qianyu is a modern monorepo containing a web application and a mobile application, sharing optimized developer tooling and CI/CD pipelines.

The monorepo contains 2 main applications:

- **Web App** (`apps/web`): Built with React Router, with CI configured for automated deployment to Cloudflare Workers.
- **Mobile App** (`apps/mobile`): A Bare React Native application with CI configured for automated APK builds.

## Tech Stack

- **Web App**: React Router, Cloudflare Workers
- **Mobile App**: Bare React Native, React Navigation, HeroUI Native
- **Styling**: Tailwind CSS (Utility-first styling approach for rapid UI development)
- **Language**: TypeScript for safer and more maintainable code
- **Package Manager**: Bun (Fast JavaScript runtime for development and production)
- **Tooling**: Oxlint & Oxfmt for high-performance linting and formatting
- **CI/CD**: GitHub Actions for automated builds, deployments, and releases

## Getting Started

### Prerequisites

Make sure you have the following installed:

- [Bun](https://bun.com/)
- [Android SDK](https://developer.android.com/studio) (for Mobile App)
- [JDK 17 or higher](https://www.oracle.com/java/technologies/javase-jdk17-downloads.html) (for Mobile App)

### Installation

Clone the repository and install dependencies:

```bash
git clone https://github.com/tiesen243/qianyu.git
cd qianyu
bun install
```

### Development

#### Web App

To start the web development server:

```bash
cd apps/web
bun run dev
```

#### Mobile App

To start the Metro bundler and run the app on an Android emulator or device:

```bash
cd apps/mobile
bun run start
# In another terminal:
bun run android
```

## Deployment & Workflows

This project uses **GitHub Actions** to automate code quality checks, releases, web deployments, and APK builds.

### CI/CD Pipelines

1. **CI (`ci.yml`)**: Runs on every push and pull request to ensure code quality:
- Code formatting check (Oxfmt)
- Linting (Oxlint)
- Type checking (TypeScript)

2. **Web App Deployment**:
- Automated deployment to **Cloudflare Workers** on merge/push to the main branch.
- PR Preview deployments via `pr-preview.yml`.

3. **Mobile App Build (`build-apk.yml`)**:
- Triggered automatically after a release is created.
- Builds the Android APK and uploads the artifact to the GitHub Release.

4. **Release (`release.yml`)**: Handles versioning and release management:
- Generates changelog using Changesets.
- Creates a GitHub Release.

### Configuring Mobile Keystore for GitHub Actions

If you are setting up the Android build for the first time, you need to configure GitHub Secrets for the APK build:

1. Generate a keystore:

```bash
keytool -genkeypair -v -storetype PKCS12 \
-keystore my-release-key.keystore \
-alias my-key-alias \
-keyalg RSA -keysize 2048 -validity 10000
```

2. Base64 encode the keystore:

```bash
base64 my-release-key.keystore > my-release-key.keystore.base64
```

3. Set the following repository secrets:

- `ALCHEMY_PASSWORD`: Your Alchemy Password (generated by `openssl rand -base64 32`)
- `ALCHEMY_STATE_TOKEN`: Your Alchemy State Token for Cloudflare Workers (generated by `openssl rand -base64 32`)
- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare Account ID
- `CLOUDFLARE_API_TOKEN`: Your Cloudflare API Token with permissions: `Workers Agents Configuration:Edit`, `Containers:Edit`, `Workers Observability:Edit`, `Workers Builds Configuration:Edit`, `Cloudflare Pages:Edit`, `Workers R2 Storage:Edit`, `Workers Tail:Read`, `Workers KV Storage:Edit`, `Workers Scripts:Edit`, `Account Settings:Read`
- `CLOUDFLARE_EMAIL`: Your Cloudflare Account Email
- `CORS_ORIGINS`: Comma-separated list of allowed CORS origins for the API
- `PAT_TOKEN`: Your GitHub Personal Access Token with `repo` and `workflow` permissions
- `RN_API_URL`: The API URL of your deployed backend for the mobile app
- `RN_PREFIX` and `RN_SCHEME`: The URL scheme and prefix for deep linking in the mobile app
- `RN_UPLOAD_KEY_ALIAS`: The alias of the key in your keystore
- `RN_UPLOAD_STORE_BASE64`: The base64-encoded content of your keystore file
- `RN_UPLOAD_STORE_PASSWORD`: The password for your keystore

4. Generate SHA256 fingerprint of your keystore (optional, for deep linking):

```bash
keytool -list -v -keystore my-release-key.keystore
```

Then copy the SHA256 fingerprint and add it to `apps/web/public/.well-known/assetlinks.json` for Android deep linking.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.