# OrchardGo

<div align="center">
  <img src="./brands/orchard/icons/launcher/prod.png" height="120" alt="OrchardGo" />
  <img src="./brands/awal/icons/launcher/prod.png" height="120" alt="AwalGo" />
</div>

<p align="center">
  <strong>React Native mobile app for The Orchard's music distribution platform</strong>
</p>

<p align="center">
  <img alt="React Native" src="https://img.shields.io/badge/React%20Native-0.80.2-61DAFB?style=flat-square&logo=react&logoColor=white" />
  <img alt="Node" src="https://img.shields.io/badge/Node-20.x-339933?style=flat-square&logo=node.js&logoColor=white" />
  <img alt="TypeScript" src="https://img.shields.io/badge/TypeScript-5.0.4-3178C6?style=flat-square&logo=typescript&logoColor=white" />
  <img alt="iOS" src="https://img.shields.io/badge/iOS-13.0+-000000?style=flat-square&logo=apple&logoColor=white" />
  <img alt="Android" src="https://img.shields.io/badge/Android-7.0+-3DDC84?style=flat-square&logo=android&logoColor=white" />
</p>

<p align="center">
  <a href="#anchor-quick-start">Quick Start</a> •
  <a href="#anchor-documentation">Documentation</a> •
  <a href="#anchor-development">Development</a> •
  <a href="#anchor-deployment">Deployment</a>
</p>

---

## 🎯 About

InsightsGo is an exclusive tool created to empower Sony Music Entertainment labels. InsightsGo provides meaningful and actionable insights on the Go, so you never miss a beat - in the studio, on tour, or after your next release.

### Key Features

- 🎨 **Multi-brand support** - Orchard and Awal brands with independent configurations
- 🔐 **Auth0 authentication** - Secure authentication with SSO support
- 📱 **iOS & Android** - Native performance on both platforms
- 🚀 **CodePush** - Over-the-air JavaScript updates
- 📊 **Analytics** - DataDog RUM, Segment, Firebase Analytics
- 🔔 **Push notifications** - Firebase Cloud Messaging
- 🔗 **Deep links** - Universal/App Links support
- 🎨 **GraphQL API** - Apollo Client integration

## 📋 Tech Stack

| Technology | Version | Link |
|------------|---------|------|
| **Node.js** | [`.node-version`](.node-version) | [nvm](https://github.com/nvm-sh/nvm) |
| **React** | 19.1.0 | [React](https://react.dev/) |
| **React Native** | 0.80.2 | [Docs](https://reactnative.dev/) |
| **TypeScript** | 5.0.4 | [TypeScript](https://www.typescriptlang.org/) |
| **Apollo Client** | 3.7.7 | [Docs](https://www.apollographql.com/docs/react/) |
| **Redux** | 5.0.1 | [Redux](https://redux.js.org/) |
| **Ruby** | [`.ruby-version`](.ruby-version) | CocoaPods |
| **Java** | [`.java-version`](.java-version) | Android |
| **Xcode** | [`.xcode-version`](.xcode-version) | iOS |

<a name="anchor-quick-start"></a>
## 🚀 Quick Start

### Prerequisites

Before you begin, ensure you have the required tools installed. See [Prerequisites](docs/getting-started/prerequisites.md) for detailed instructions.

**Quick check:**
```bash
yarn check:tools
```

### Installation

```bash
# 1. Clone the repository
git clone https://github.com/theorchard/orchardgo.git
cd orchardgo

# 2. Configure private packages
cp ./setup/.npmrc.shadow .npmrc
# Edit .npmrc and add your GitHub token

# 3. Configure environment
cp .env.shadow .env
# Edit .env with your configuration

# 4. Install dependencies
yarn clean
yarn install
```

### Running the App

```bash
# iOS (default: Orchard brand, Production environment)
yarn start:ios

# Android
yarn start:android

# With options
yarn start --platform ios --brand awal --env qa
```

📚 **For detailed setup instructions, see [Installation Guide](docs/getting-started/installation.md)**

<a name="anchor-documentation"></a>
## 📖 Documentation

### Getting Started
- [Prerequisites](docs/getting-started/prerequisites.md) - Required tools and versions
- [Installation](docs/getting-started/installation.md) - Step-by-step setup
- [Configuration](docs/getting-started/configuration.md) - Environment and brand config

### Development
- [Running the App](docs/development/running-the-app.md) - Run on iOS/Android
- [Testing](docs/development/testing.md) - Unit tests, linting, coverage
- [Debugging](docs/development/debugging.md) - Debug tools and techniques
- [Scripts Reference](docs/development/scripts-reference.md) - All available commands

### Deployment
- [CodePush](docs/deployment/codepush.md) - Over-the-air JavaScript updates
- [Building Binaries](docs/deployment/building.md) - iOS and Android builds

### Guides
- [Multi-Brand Support](docs/guides/branding.md) - Working with multiple brands
- [Apollo Client Tips](docs/guides/apollo-client.md) - GraphQL best practices
- [Authentication Flow](docs/guides/authentication.md) - Auth0 integration

### Architecture
- [Project Structure](docs/architecture/project-structure.md) - Code organization

### Maintenance
- [macOS Maintenance](docs/maintenance/macos-maintenance.md) - CI Mac mini setup
- [Xcode Setup](docs/maintenance/xcode-setup.md) - Xcode configuration

### Reference
- [Useful Links](docs/reference/links.md) - External resources and tools


<a name="anchor-development"></a>
## 🛠️ Development

### Common Commands

```bash
# Start development
yarn start                    # iOS, Orchard, Production
yarn start:ios               # iOS shorthand
yarn start:android           # Android shorthand

# Testing
yarn test                    # Run all tests
yarn test:unit              # Unit tests only
yarn watch                  # Test watch mode
yarn lint                   # Type check + ESLint

# Utilities
yarn clean                  # Clean build artifacts
yarn reset                  # Reset Metro bundler
yarn check:tools           # Verify tool versions

# iOS
yarn xcode                  # Open in Xcode
yarn ios:simulators        # List simulators

# Android
yarn android:devices       # List devices
yarn android:emulators    # List emulators
```

### Project Structure

```
orchardgo/
├── android/          # Android native code
├── ios/             # iOS native code
├── src/             # JavaScript/TypeScript source
│   ├── components/  # Reusable UI components
│   ├── screens/     # Screen components
│   ├── navigation/  # Navigation config
│   ├── hooks/       # Custom hooks
│   ├── queries/     # GraphQL queries
│   └── branding/    # Brand configuration
├── brands/          # Brand-specific assets
│   ├── orchard/
│   └── awal/
├── docs/            # Documentation
└── scripts/         # Build scripts
```

### Running Tests

```bash
# All tests
yarn test

# Unit tests
yarn test:unit

# Watch mode
yarn test:unit:watch

# Update snapshots
yarn test:update:snapshots

# Coverage
yarn test:unit --coverage
```


<a name="anchor-deployment"></a>
## 🚢 Deployment

### CodePush (JavaScript Updates)

```bash
# Deploy to QA
yarn deploy:js --env qa

# Test, then promote to Production
yarn promote
```

### Native Binaries

```bash
# Deploy to app stores
yarn deploy:binary
```

### Monitoring

- **DataDog**: [Production](https://app.datadoghq.com/dashboard/bk2-s6f-vtz/prod-code-push-server-release-radar) | [QA](https://app.datadoghq.com/dashboard/74n-raq-nip)
- **Sentry**: [Error Tracking](https://sentry.io)
- **Jenkins**: [Pipelines](https://pipeline.theorchard.io)

## 🏗️ CI/CD

Automated builds and deployments via Jenkins:
- Pull request validation
- Nightly builds
- Release deployments

See [Jenkins Pipeline](https://pipeline.theorchard.io/job/mobile-binary/)

## 🤝 Team

InsightsGo is developed and maintained by Sony Music PDE (Product Design Engineering).

### Getting Help

- **Documentation**: Check [docs/](docs/) directory
- **Issues**: Open an issue in the repository
- **Team**: Contact the mobile development team

## 📄 Version

Current version: **2.18.0** (see [`package.json`](package.json))

## 🔗 Related Projects

- [The Orchard Docs](https://github.com/theorchard/docs) - Engineering documentation
- [JavaScript Packages Guide](https://github.com/theorchard/docs/blob/master/javascript/packages.md) - Private package setup

---

<p align="center">
  Built with ❤️ by Sony Music PDE - Product Design Engineering
</p>
