> For the complete documentation index, see [llms.txt](https://docs.talus.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talus.network/guides/nexus-api/tutorial.md).

# Build a dApp on Nexus API

{% hint style="info" %}
**Audience:** A developer with a terminal, curl, and Node 18+ who wants a first working integration against the hosted Nexus API.

**Goal:** Configure a provider-issued key, read indexed resources, stream events, assemble a raw-HTTP Run Watcher, and port that consumer boundary to React.
{% endhint %}

This tutorial is one continuous hosted-service consumer build. Each step calls the public REST/SSE boundary.

| Step                                                                        | You do                                                  | You end up with                                           |
| --------------------------------------------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------- |
| [1. Configure access](/guides/nexus-api/tutorial/01-get-a-key.md)           | Receive a provider-issued key and store it safely       | A scoped key held only by your server-side shell or relay |
| [2. Read the network](/guides/nexus-api/tutorial/02-read-the-network.md)    | List resources, follow pagination, and inspect an error | REST calls the dApp can render                            |
| [3. Stream events](/guides/nexus-api/tutorial/03-stream-events.md)          | Open SSE, filter kinds, disconnect, and resume          | A replayable live signal with a cursor                    |
| [4. Assemble the dApp](/guides/nexus-api/tutorial/04-assemble-the-dapp.md)  | Paste one raw-HTTP relay and Run Watcher                | A same-origin browser view with no browser key            |
| [5. Port the dApp to React](/guides/nexus-api/tutorial/05-port-to-react.md) | Use page-local public types with fetch and EventSource  | The same dApp in a typed React app                        |

The architecture figure keeps the API key on the server side while the browser receives only the app's public response and event state. REST renders the live projection; SSE wakes the app to re-read and recover.

```mermaid
sequenceDiagram
  participant Builder
  participant Provider
  participant Relay
  participant API as Hosted Nexus API
  participant Browser
  Provider-->>Builder: Deliver scoped API key through secure channel
  Builder->>Relay: Configure provisional URL and secret
  Browser->>Relay: Request same-origin resource
  Relay->>API: Add x-api-key and forward request
  API-->>Relay: JSON or SSE with status and diagnostics
  Relay-->>Browser: Public response without secret
  Browser->>Relay: Reconnect with last event cursor
  Relay->>API: Request retained replay when supported
```

The sequence is the complete external trust boundary: the provider provisions access, your relay protects it, and the browser never receives or logs the credential. Cursor retention, reset behavior, keep-alive cadence, and duplicate delivery remain provider-specific; validate frames and follow the provider's `/openapi.json` or published stream policy. Start with [Step 1](/guides/nexus-api/tutorial/01-get-a-key.md), then keep the same cleanup boundary as you move through the shell examples.

Set a clearly provisional endpoint before starting:

```bash
# mainnet
export NEXUS_API_URL="https://api.taluslabs.dev"

# testnet
export NEXUS_API_TESTNET_URL="https://api-testnet.taluslabs.dev"
```

When a response surprises you, use [Nexus API Troubleshooting](/guides/nexus-api/troubleshooting.md). For exact paths, scopes, status values, and envelopes, use the [HTTP API reference](https://api.taluslabs.dev/docs).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.talus.network/guides/nexus-api/tutorial.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
