---
title: "nuxt-backend/app"
description: "Every export of nuxt-backend/app, with its signature and where it is defined."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/app"
---
# nuxt-backend/app

## Type Aliases

### BackendEnv

```ts
type BackendEnv = typeof backendEnv;
```

Defined in: [src/convex/app.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts)

The env declaration the scaffolded `convex.config.ts` passes to `defineApp`.

## Variables

### backendEnv

```ts
const backendEnv: {
  AUTH_SECRET: VString<string, "required">;
  SITE_URL: VString<string, "required">;
  AUTH_TRUST_LOCAL_ORIGINS: VString<string | undefined, "optional">;
  EMAIL_API_KEY: VString<string | undefined, "optional">;
  EMAIL_FROM: VString<string | undefined, "optional">;
  EMAIL_TEST_MODE: VString<string | undefined, "optional">;
  EMAIL_WEBHOOK_SECRET: VString<string | undefined, "optional">;
  BILLING_ACCESS_TOKEN: VString<string | undefined, "optional">;
  BILLING_WEBHOOK_SECRET: VString<string | undefined, "optional">;
  BILLING_ENVIRONMENT: VUnion<"sandbox" | "production" | undefined, [VLiteral<"sandbox", "required">, VLiteral<"production", "required">], "optional", never>;
};
```

Defined in: [src/convex/app.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts)

Environment variables the backend reads, in two tiers.

Required — a deploy fails until they are set (misconfiguration of the
security-critical pair must surface at push time, never at runtime):
`AUTH_SECRET` (session/JWT signing) and `SITE_URL` (the app origin — auth
base URL and every emailed link).

Optional — the deploy succeeds and the feature degrades in a designed,
observable way until configured (`nuxt-backend doctor` reports each):

- `EMAIL_API_KEY` — sends no-op with a console warn, and a sign-in code
or an invitation to a real address is refused with a 400 (set
`NUXT_BACKEND_LOG_OTP=1` to echo codes to the dev console instead).
- `EMAIL_FROM` — falls back to the provider's onboarding sender, which
reaches no real recipient: codes and invitations to one are refused.
- `EMAIL_TEST_MODE` — defaults to ON (anything but `'false'`): only the
provider's test addresses get mail; codes and invitations to others are
refused.
- `EMAIL_WEBHOOK_SECRET` — delivery events are rejected until set.
- `BILLING_ACCESS_TOKEN` — billing queries return empty; checkout and other
billing actions fail on invocation.
- `BILLING_WEBHOOK_SECRET` — billing events are rejected until set
(`syncEntitlements` remains the on-demand fallback).
- `BILLING_ENVIRONMENT` — defaults to `'sandbox'`.

The names are service-neutral on purpose: the package hides its underlying
providers behind the general capability (auth, email, billing).

The scaffolded `convex.config.ts` declares these with
`defineApp({ env: backendEnv })` and forwards the `EMAIL_*` refs to the
`backend` component. Extend the set for your own vars (the env proxy
throws on undeclared ones):
`defineApp({ env: { ...backendEnv, MY_VAR: v.optional(v.string()) } })`.

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="property-auth_secret">
        
      </a>
      
       <code>
        AUTH_SECRET
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-site_url">
        
      </a>
      
       <code>
        SITE_URL
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
      , <code>
        "required"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-auth_trust_local_origins">
        
      </a>
      
       <code>
        AUTH_TRUST_LOCAL_ORIGINS
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-email_api_key">
        
      </a>
      
       <code>
        EMAIL_API_KEY
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-email_from">
        
      </a>
      
       <code>
        EMAIL_FROM
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-email_test_mode">
        
      </a>
      
       <code>
        EMAIL_TEST_MODE
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-email_webhook_secret">
        
      </a>
      
       <code>
        EMAIL_WEBHOOK_SECRET
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-billing_access_token">
        
      </a>
      
       <code>
        BILLING_ACCESS_TOKEN
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-billing_webhook_secret">
        
      </a>
      
       <code>
        BILLING_WEBHOOK_SECRET
      </code>
    </td>
    
    <td>
      <code>
        VString
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        undefined
      </code>
      
      , <code>
        "optional"
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="property-billing_environment">
        
      </a>
      
       <code>
        BILLING_ENVIRONMENT
      </code>
    </td>
    
    <td>
      <code>
        VUnion
      </code>
      
      <<code>
        "sandbox"
      </code>
      
       | <code>
        "production"
      </code>
      
       | <code>
        undefined
      </code>
      
      , [<code>
        VLiteral
      </code>
      
      <<code>
        "sandbox"
      </code>
      
      , <code>
        "required"
      </code>
      
      >, <code>
        VLiteral
      </code>
      
      <<code>
        "production"
      </code>
      
      , <code>
        "required"
      </code>
      
      >], <code>
        "optional"
      </code>
      
      , <code>
        never
      </code>
      
      >
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/app.ts" rel="nofollow">
        src/convex/app.ts
      </a>
    </td>
  </tr>
</tbody>
</table>


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
