Skip to content

feat(env): Implement environment configuration and setup script#43

Merged
jbdevprimary merged 1 commit into
mainfrom
feat/environment-configuration
Jan 18, 2026
Merged

feat(env): Implement environment configuration and setup script#43
jbdevprimary merged 1 commit into
mainfrom
feat/environment-configuration

Conversation

@jbdevprimary
Copy link
Copy Markdown
Contributor

Summary

Implements comprehensive environment configuration for Issue #7, enabling proper dev/staging/production builds with type-safe environment variable management.

Changes

  • Expanded .env.example with all required variables:

    • AI provider keys (Anthropic, OpenAI)
    • GitHub OAuth integration (Device Flow)
    • EAS/Expo build configuration
    • App Store submission variables (iOS/Android)
    • Optional analytics and monitoring
  • Created app.config.ts dynamic Expo config:

    • Environment-specific configuration (dev/staging/prod)
    • Automatic environment detection via EXPO_PUBLIC_APP_ENV
    • Different bundle identifiers per environment
    • Type-safe environment variable access
  • Created src/lib/env.ts for runtime environment validation:

    • Type-safe EnvironmentConfig interface
    • validateEnvironment() for startup validation
    • isFeatureEnabled() for feature flags
    • apiUrls constants for API endpoints
  • Created scripts/setup.sh for first-time contributors:

    • Checks for Node.js 18+ and pnpm
    • Creates .env.local from .env.example
    • Installs dependencies
    • Runs type check
  • Created docs/development/ENVIRONMENT.md:

    • Comprehensive environment setup guide
    • EAS secrets management instructions
    • Security best practices
    • Troubleshooting section

Usage

import { env, validateEnvironment } from '@/lib/env';

// Access environment
console.log(env.appEnv); // 'development' | 'staging' | 'production'
console.log(env.isDev);  // true

// Feature flags
if (isFeatureEnabled('devTools')) {
  // Show debug panel
}

// Validate at startup
const { isValid, missing } = validateEnvironment();

Quick Start

# Run setup script
pnpm setup

# Start development
pnpm dev

Closes #7

Test plan

  • All 79 tests pass (10 new env tests)
  • pnpm setup script works correctly
  • Environment validation catches missing vars
  • Feature flags work correctly per environment
  • app.config.ts builds with environment detection

🤖 Generated with Claude Code

- Expanded .env.example with all required variables including:
  - AI provider keys (Anthropic, OpenAI)
  - GitHub OAuth integration
  - EAS/Expo build configuration
  - App Store submission variables (iOS/Android)
  - Optional analytics and monitoring

- Created app.config.ts dynamic Expo config:
  - Environment-specific configuration (dev/staging/prod)
  - Automatic environment detection
  - Type-safe environment variable access
  - Different bundle identifiers per environment

- Created src/lib/env.ts for runtime environment validation:
  - Type-safe EnvironmentConfig interface
  - validateEnvironment() for startup validation
  - isFeatureEnabled() for feature flags
  - apiUrls constants for API endpoints

- Created scripts/setup.sh for first-time contributors:
  - Checks for Node.js 18+ and pnpm
  - Creates .env.local from .env.example
  - Installs dependencies
  - Runs type check

- Created docs/development/ENVIRONMENT.md:
  - Comprehensive environment setup guide
  - EAS secrets management instructions
  - Security best practices
  - Troubleshooting section

- Added 10 unit tests for env module
- Updated package.json with setup and dev scripts
- Updated SETUP.md with quick start instructions

Closes #7

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jbdevprimary
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 18, 2026

Warning

Rate limit exceeded

@jbdevprimary has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 56 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between fd8c9e4 and 59be21d.

📒 Files selected for processing (9)
  • .env.example
  • app.config.ts
  • docs/development/ENVIRONMENT.md
  • docs/development/SETUP.md
  • package.json
  • scripts/setup.sh
  • src/lib/__tests__/env.test.ts
  • src/lib/env.ts
  • src/lib/index.ts

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 18, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
63.8% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@jbdevprimary jbdevprimary merged commit d23163c into main Jan 18, 2026
11 of 12 checks passed
@jbdevprimary jbdevprimary deleted the feat/environment-configuration branch January 18, 2026 16:36
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.

[Foundation] Add environment configuration and secrets management

1 participant