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

# Data, accounts and Newly Backend

> How your app stores data, and when the agent adds Newly Backend for accounts, shared data and server code.

Newly v2, at app.newly.app and in Newly for Mac, builds your app to keep its data on the device unless it needs more. When your app needs accounts or data shared between people, the agent adds **Newly Backend**.

## Apps start local-first

By default, a new app saves its data on the phone. There are no accounts, no server and no sign-in, and there's nothing to host.

The agent adds a backend only when your app needs one, for example when you ask for:

* sharing data between people
* more than one user, or user accounts and sign-in
* syncing data across devices
* payments

If your request doesn't make it clear, the agent asks you one plain question first, such as whether other people should be able to sign in and see the same data. Answer in your own words.

<Tip>
  If you already know your app needs accounts, say so in your first message. For example: "People sign in with email and see their own saved recipes on any phone."
</Tip>

## What Newly Backend includes

When the agent adds Newly Backend, your project gets:

* **A sign-in service** for your app's users. Email and password sign-in work right away. See [Sign-in for your app](/backend/app-sign-in).
* **An API service** for your app's own server code and endpoints.
* **A Postgres database** for each environment.
* **File storage** for things like photos and uploads.

The first setup takes a few minutes. The agent sets up the backend, connects your app to it, and then tells you what your app can now do. You don't need to run anything yourself.

The backend code lives in the `backend/` folder of your project, next to your app code. Database changes are made through migrations, which the agent writes and applies for you.

## Dev and production

Newly Backend has two separate environments:

| Environment    | Who changes it                   | Database            |
| -------------- | -------------------------------- | ------------------- |
| **Dev**        | The agent, as it builds your app | Its own database    |
| **Production** | You, with the newly CLI          | A separate database |

The agent only works on dev, and it connects your app to your dev backend. Data you create while testing stays in the dev database and doesn't appear in production. Shipping your backend to production is a step you take yourself, as the project's owner or a project **Admin**. See [Production and secrets](/backend/production-and-secrets).

## See your backend's status

On Mac: with a chat open, open **Settings**, then **Publishing**, and find the **Newly Backend** row. It needs the project folder on your Mac and a sign-in to the newly CLI. When both are in place, it shows whether the backend is connected, the status of dev and production, and the address of each dev service. Otherwise it tells you what's missing. Click **Refresh** to update it. The row is read-only.

The web app doesn't show backend status.

There's no database viewer or log viewer in the app. If you're comfortable with a terminal, the newly CLI can help:

* `newly db url` prints a read-only address for your **dev** database, which you can open in a database tool.
* `newly logs` shows recent logs from your **dev** services.

Both commands work for dev only. See [Get your code](/code/get-your-code) to install the tool and sign in.

## Things to know

* **Background jobs:** background queue processing isn't available in Newly Backend.
* **Other backend providers:** Newly v2 doesn't connect to Supabase, Firebase or other backend providers. Newly Backend is the backend for Newly v2 apps.
* **Email:** Newly Backend doesn't send emails for you, such as password resets. See [Sign-in for your app](/backend/app-sign-in#emails-for-password-reset-and-verification).
* **AI features:** your app can use AI models through Newly Backend without provider keys. See [AI features in your app](/backend/ai-models).

## Credits

Hosting Newly Backend doesn't draw down credits currently. The agent work that builds and changes your backend uses credits like any other agent work, and your app's AI model requests use credits too. See [How credits work](/billing/how-credits-work).

You need a positive credit balance to create a Newly Backend. See [Running out of credits](/billing/out-of-credits).

## Related

<CardGroup cols={2}>
  <Card title="Sign-in for your app" icon="right-to-bracket" href="/backend/app-sign-in">
    Email, Google and Apple sign-in for your app's users.
  </Card>

  <Card title="Production and secrets" icon="key" href="/backend/production-and-secrets">
    Ship your backend to production and set API keys.
  </Card>

  <Card title="AI features in your app" icon="wand-magic-sparkles" href="/backend/ai-models">
    Add text, image, audio and video generation.
  </Card>

  <Card title="Integrations" icon="puzzle-piece" href="/backend/integrations">
    Push notifications, payments and other services.
  </Card>
</CardGroup>
