# Sources

The source picker sits in the top bar and is easy to miss, yet it decides what
every page below it is reading. A **source** is where the console fetches this
project's `dcupl.lc.json` from.

```mermaid
flowchart LR
  P["Source picker"] --> C["dcupl.lc.json<br/>from that source"]
  C --> R["Models · Data · Applications<br/>everything below"]
```

The models, data and applications the project shows you are the ones that one
file declares. Change the file, and the workspace changes with it.

## Two kinds of source

- **dcupl Cloud** — a **version** of this project, hosted by dcupl. Every version
  you create shows up in the picker as its own source. This is the normal way to
  work, and it is what the CLI pushes to and pulls from.
- **Url** — anywhere else. A URL source points at any host that serves a
  `dcupl.lc.json` and the resources it declares: a CDN, a static bucket, a
  colleague's preview build.

Owners and editors manage sources under **Project Settings → Sources**. A source
has a **Name**, a **Type** (dcupl Cloud or Url), a **Version** (dcupl Cloud) or
**Base Url** (Url), a **Loader File Name** (default `dcupl.lc.json`),
**Variables**, and for a Url source **Request Headers**. The versions of the
project are listed there as read-only **System Sources**. **Set default Source**
picks the source a project opens on from the project list. Your plan caps the
number of sources: 2 on Community, 3 on Basic, 5 on Business. The built-in
sources count toward the cap, so a new Community project has no free slot.

## Localhost via `dcupl serve`

Local development is a URL source that happens to point at your own machine.
Every project already has one: **dcupl CLI / Localhost**, pointing at
`http://localhost:8083`, the port `dcupl serve` uses by default. Run
`dcupl serve` in your workspace and pick that source; the console then reads the
files on your disk instead of the cloud. If you serve on another port, edit the
source's URL under **Project Settings → Sources**. The Getting Started card on
the project dashboard has the exact commands.

`dcupl serve` listens on `127.0.0.1` and lets the dcupl Console read and edit
the served files. A self-hosted Console (for example on
`https://console.example.com`) can only read; to edit from it, start the server with
`dcupl serve --allow-origin https://console.example.com`, or paste the **file-edit
token** that `dcupl serve` prints at startup (`x-dcupl-serve-token`) into the
dialog the console shows when serve refuses an edit. The token stays in that
browser tab and is sent only to that serve; a restarted serve prints a new one,
and the console asks again. The console sends the token and offers the dialog
only for a serve on this machine, so a `dcupl serve --host` on another machine
cannot be edited from the console: edit the files on that machine. The flags
are listed under [CLI commands](/cli/commands#serve).

If a URL source fails to load, the console says so directly with a **Dev Server
not started** error — the usual cause is that `dcupl serve` is not running. A
cloud source that cannot be reached fails quietly instead, because an empty
version is a normal state.

## Switching reloads the project around the source

The source is part of the page address, not in-memory state. The workspace URL
carries both the project and the source, so picking another source is a
navigation: the console rebuilds its dcupl instance, re-fetches the loader
config, and re-derives the whole workspace from it. You get different files and
different applications, not a filtered version of the same ones.

That also makes a workspace link precise. Sharing a console URL shares the source
it was opened on.

## What needs a cloud or local source

Some features cannot run against an arbitrary URL, because they need a project
the console can write to and deploy from:

- **The file editor** works on any dcupl Cloud source and on a URL source whose
  address contains `://localhost`. A URL source on `127.0.0.1` does not count as
  local.
- **Workflows** and **REST APIs** are enabled in the sidebar only while the
  **draft** version is the selected source. On any other source, localhost
  included, their entries are greyed out.

Both sidebar entries are also shown only to owners and editors. They are on for
new projects; if either entry is missing, ask your dcupl contact to turn it on
for your project. If an entry is there but greyed out, check the picker before
anything else.

## Next steps

- [Applications](/console/applications) — what you run once a source is selected
- [Loader configuration](/console/loader) — the file a source is chosen for
- [CLI cloud sync](/cli/cloud-sync) — push and pull the files behind a cloud version
