

# Core concepts

An Amplify app is made of a configuration file, environments, deployments, an optional backend, custom domains, and integrations.

## App
<a name="core-concepts-app"></a>

An app is the top-level resource in Amplify, scoped to your AWS account. Everything else, including environments, deployments, integrations, and custom domains, hangs off an app.

An app represents a single web application. It has a unique name within your account and a default domain (` {{app-name}}.amplify.app`) that serves your `production` environment until you connect a custom domain. If another app already has that name, Amplify adds a random suffix to the domain, so take your app’s URL from the output of `aws amplifygen3 deploy`.

For more information about creating an app, see [Create and deploy an app](deploy-your-app-app.md).

## `amplify.jsonc`
<a name="core-concepts-amplifygen3-jsonc"></a>

The `amplify.jsonc` file, or the file that `--config` names, is your app configuration. The `aws amplifygen3 create`, `aws amplifygen3 local init`, and `aws amplifygen3 local backend add` commands write the file. The `app edit`, `env`, `var`, and `integration` commands change only the settings stored in Amplify. When you deploy, a value in `amplify.jsonc` overrides the build settings that `app edit` stored. The file is also version controlled alongside your source code, which makes it easier to develop and release your app.

```jsonc
{
  "name": "my-app",
  "deploy": {
    "install": "npm install",
    "build": "npx @aws-amplifygen3/adapter-nextjs",
    "output_directory": ".amplify"
  },
  "env": {
    "preview": {},
    "production": {}
  }
}
```

The file supports JSONC (JSON with comments), which is useful for documenting integration choices and build settings. For the full schema and all available options, see the [Configuration reference](yml-specification-syntax.md).

## Environments
<a name="core-concepts-environments"></a>

Every app starts with two environments: `preview` and `production`. You can add more (such as `staging` or `qa`) as your workflow requires.

Each environment is an isolated deployment target with its own:
+  **URL** – such as `my-app.amplify.app` for `production` 
+  **Integrations** – different databases, buckets, or AI models for each environment
+  **Environment variables and secrets** – separate configuration for each stage
+  **IAM role** – controls what AWS resources the environment can access
+  **Backend data** – its own backend branches, each with its own database and sign-in users, if your app has a backend

The CLI defaults to `preview` for all commands. To deploy to production, you always name the `production` environment explicitly. For more information about environments, see [Use environments for your apps](multi-environments.md).

For more information about creating more environments, see [Create a custom environment](deploy-your-app-create-environment.md).

## Deployments
<a name="core-concepts-deployments"></a>

A deployment is an immutable snapshot of your app. Every `aws amplifygen3 deploy --env <environment>` (or Git push to a connected repository) produces a new deployment, and each deployment gets its own unique URL:

```
https://k3x9w2q7mz--my-app.amplify.app
```

Each environment serves one deployment at a time. The environment also has a stable URL, the *leader URL*, that always points to the deployment that is active:

```
https://preview-ab12--my-app.amplify.app
```

To roll back, make an earlier deployment active. Amplify keeps the last 50 successful deployments for each environment.

## Backends
<a name="core-concepts-backends"></a>

A backend gives your app a Postgres database, user sign-up and sign-in, and a Data API that your app calls with the client SDK. Amplify creates and manages your backend, and deletes it when you delete your app. A backend has the following parts:
+  *Separate data for each environment* – Your `preview` and `production` environments each get their own backend branches and databases, so test data never mixes with your users' data.
+  *Migrations* – SQL files in the `migrations/` folder that create and change your tables. Each deploy runs the migrations that the environment doesn’t have yet.
+  *Branch* – Each environment keeps its backend data in branches. A branch is its own database, with its own sign-in users, publishable key, and URL. Deployments to `production` use the `production` branch. In other environments, CLI deployments share the `source-upload` branch by default, and the deployments of a Git branch, including those of pull requests opened from it, use a backend branch named after that Git branch. A new branch starts empty, with only the rows that your migrations insert. For which branch each deployment uses, see [Use environments for your apps](multi-environments.md).
+  *Row level security (RLS)* – Postgres policies, written in your migrations, that decide which rows each user can read and change. Anyone can reach your backend’s URL, so these policies keep each user’s data private.
+  *Database roles* – Each request runs as one of three PostgreSQL roles. Anyone can call your backend’s URL with the publishable key, so the grants and RLS policies in your migrations decide what each role can read and change. For more information, see [API keys and roles](backend-keys.md).
  +  `anon` – A request with only the publishable key runs as `anon`, a visitor who isn’t signed in.
  +  `authenticated` – A request that also carries a signed-in user’s token runs as `authenticated`, so `auth.uid()` returns that user’s ID.
  +  `service_role` – Server code that signs its requests with your AWS credentials runs as `service_role`, which bypasses RLS. The signature grants the role, so there is no secret key to store.
+  *Publishable key* – A key that your app sends with every backend request. You can put it in browser code, because it grants only what your RLS policies allow.

  Your app sends the branch’s publishable key as the `apikey` header with every request, and the client SDK does this for you. Each deployment gives your app the key as the environment variable `AMPLIFY_BACKEND_PUBLISHABLE_KEY`, and the branch’s URL as `AMPLIFY_BACKEND_URL`.

An app has at most one backend. A CLI command such as your first `aws amplifygen3 deploy` creates the backend, and a deployment from a Git push doesn’t.

For more information about backends, see [Backends](deploy-backend.md).

## Custom domains
<a name="core-concepts-custom-domains"></a>

A custom domain (such as `www.example.com`) is mapped to an environment, not to a specific deployment. It follows the environment’s leader, so promotions and rollbacks update the custom domain automatically.

For more information about adding a domain, see [Use a custom domain](custom-domains.md).

Amplify supports three DNS modes:
+  **Route 53** – Amplify auto-detects this mode if the domain’s hosted zone is in your AWS account, and creates DNS records automatically.
+  **NS delegation** – Amplify manages all DNS after you delegate nameservers at your registrar.
+  **Manual** – Amplify prints the DNS records to add with your external provider.

You can configure redirects (such as apex `example.com` → `www.example.com`) and map subdomains to different environments (such as `staging.example.com` → `staging`).

## Integrations
<a name="core-concepts-integrations"></a>

Integrations connect your Amplify application to AWS services such as databases, storage, and AI models by exposing connection details as environment variables. Amplify handles IAM permissions and credential management automatically, so there are no role assumptions in your application code. You declare what your app needs, and Amplify wires it up.

You bring your own AWS resource. When you remove an integration, only the connection is removed. The underlying resource is not modified.

Your integrations are created at the Amplify service level, so you can reuse them across apps. To add a prefix to an integration’s variable names, run `aws amplifygen3 integration edit --prefix`. The prefix applies in every environment that the integration is connected to.

You can connect your app to any AWS resource, and to third-party services that you reach over HTTPS. Amplify has a dedicated integration type for the following services. For these, Amplify sets the environment variables and grants your app only the permissions it needs. For any other resource or service, create a `custom` integration and define the environment variables yourself.


| Service | Type | Description | 
| --- | --- | --- | 
| Amazon Aurora DSQL |  `dsql`  | PostgreSQL-compatible serverless database | 
| Amazon S3 |  `s3`  | Object storage for files and assets | 
| Amazon Bedrock |  `bedrock`  | AI foundation models for generative AI | 
| Any other AWS resource or service |  `custom`  | Environment variables that you define | 

For more information about integrations, see [Integrations](integrations.md).

## Next steps
<a name="core-concepts-next-steps"></a>

Now that you understand the core concepts, you can:
+  [Tutorial: Deploy a website](getting-started.md) – deploy your first app in minutes
+ Explore [different framework integrations](server-side-rendering-amplify.md) 
+ Add more [AWS service integrations](integrations.md) to your app