View a markdown version of this page

Develop locally - AWS Amplify

Develop locally

You can run your Amplify backend on your computer while you build your app. The local backend runs a PostgreSQL database, auth and a data API in Docker or Finch. When your app works, run aws amplifygen3 deploy from the AWS Amplify CLI to deploy it to AWS, where other people can use it.

Why develop locally

Developing on your computer has the following advantages:

  • Works without an AWS account – The local commands need no AWS account or AWS credentials, and they create no resources in AWS.

  • Nothing to pay while you build – The local backend runs on your computer, so it adds no charges to your AWS bill.

  • A change loop on your computer – You apply a migration, try it in your app and reset your data as often as you need, with no deployment in between. An AI coding agent can run the same loop on its own, many times in a row.

  • Data that stays on your computer – Your local data and local users are separate from every environment, such as preview and production.

  • Offline work – After the first download, the local backend starts without a network connection for up to 7 days.

  • The same migrations and auth settings – The local backend applies the same migrations and auth settings as a deployment.

Quickstart

Follow these steps to start a local backend for your app:

  1. Start Docker or Finch.

  2. In your app’s folder, run the following command to add a backend:

    aws amplifygen3 local init --type fullstack

    If your app already has an amplify.jsonc file, run aws amplifygen3 local backend add instead.

  3. Install your app’s dependencies, such as with npm install.

  4. Run the following command to start the local backend and your app’s dev server:

    aws amplifygen3 local run

    You should see the backend URL, your app’s address, and the addresses of the local console and Mailpit.

  5. When you’re done, run aws amplifygen3 local stop. Your local data stays for the next run.

Work locally

Use the following pages to work with the local backend:

  • Local development workflow – Start a new app or work on an existing one, make a change, and deploy it to preview.

  • Local database – Apply migrations, run SQL, load seed data, reset the local database and test your row-level security (RLS) policies.

  • Local console – Browse your tables, run SQL, create test users and read logs in your browser.

  • Local auth and emails – Sign in as local users, call the data API with the local publishable key, and read auth emails in Mailpit.

  • Docker and Finch – Choose the container runtime, and pick the PostgreSQL client that the db commands use.