> ## Documentation Index
> Fetch the complete documentation index at: https://flatfileinc-feat-updatereactquickstart.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Running on your local machine

> Learn how to develop with Flatfile CLI.

<Snippet file="shared/dxpbanner.mdx" />

When developing with Flatfile, listeners can [deployed](../deploying) to Flatfile on every change or they can run directly on your machine.

### Before you begin

You can add a `.env` file to bypass having to enter your API Key when running the develop command.

```json
FLATFILE_API_KEY=sk_123456
```

### Develop

Run `npx flatfile develop` from terminal to launch a local listener. As your code changes, file changes are detected and will be reflected
immediately.

<Warning>
  Add the file name to the command: `npx flatfile develop path-to-file` if
  you're not running an index file.
</Warning>

1. In your terminal, you'll see a detailed log of each HTTP request made within a listener. It includes the request timing and status, enabling tracking and debugging of HTTP operations.
2. A pub/sub stream system will deliver Events with a latency of approximately 10-50ms. This provides a local development experience closely resembling the production environment speed.
3. Events that are being processed will be shown, along with their respective handlers. You can then respond to those Events accordingly.

```bash
> npx flatfile develop
✔ 1 environment(s) found for these credentials
✔ Environment "development" selected
ncc: Version 0.36.1
ncc: Compiling file index.js into CJS
  ✓ 427ms      GET    200 https://platform.flatfile.com/api/v1/subscription 12345

 File change detected. 🚀
  ✓ Connected to event stream for scope us_env_1234
 ▶ commit:created  10:13:05.159 AM us_evt_1234
 ↳ on(**, {})
 ↳ on(commit:created, {"sheetSlug":"contacts"})

```

## Shared environments

It is highly recommended to utilize an isolated environment when developing with the local listener. That's why the CLI is warning you when working in an environment that already has a deployed agent.

<CardGroup cols={2}>
  <Card title="Check for existing agents" href="../developing/check-for-agents" />

  <Card title="Create a new isolated environment in dashboard" href="https://platform.flatfile.com" />
</CardGroup>

### More details

Having deployed code running at the same time within the same development environment can lead to
interference, potentially resulting in a recursive loop and undesirable consequences for your local listener.
To avoid such complications, it's advisable to keep your local environment separate from any deployed code.
This ensures optimal performance and helps maintain a stable development environment.
