> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobile-starter.amisi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Config

> Access validated env, feature flags, and build variants in one place

# @amisi/config

`@amisi/config` centralizes environment variables, feature flags, and build variants.

## Rule

No package reads `process.env` directly.

Import `env`, `flags`, and `buildVariant` from `@amisi/config`.

## Environment (`env`)

Environment variables are validated via a Zod schema.

```ts theme={null}
import { env } from '@amisi/config';

const apiUrl = env.EXPO_PUBLIC_API_URL;
```

Helpers:

```ts theme={null}
import {
  isDevelopment,
  isPreview,
  isProduction,
  getApiUrl,
} from '@amisi/config';

if (isDevelopment()) {
  // dev only
}

const apiUrl = getApiUrl();
```

## Feature flags (`flags`)

Flags are environment-specific defaults with simple helpers.

```ts theme={null}
import { flags, isFeatureEnabled, getFeatureValue } from '@amisi/config';

if (flags.enableSubscriptions) {
  // show paywall entry points
}

if (isFeatureEnabled('enableDebugMenu')) {
  // show debug UI
}

const timeoutMs = getFeatureValue('apiTimeout');
```

## Build variants (`buildVariant`)

Build variants provide stable app-level configuration (app name, bundle id, logging, etc.).

```ts theme={null}
import { buildVariant } from '@amisi/config';

const baseUrl = buildVariant.apiUrl;
const appName = buildVariant.appName;
```

Common helpers:

```ts theme={null}
import {
  getAppName,
  getBundleId,
  isLoggingEnabled,
  isSentryEnabled,
} from '@amisi/config';

const name = getAppName();
const bundleId = getBundleId();
const canLog = isLoggingEnabled();
const canSendCrashes = isSentryEnabled();
```
