# AI use cases for Nuvex Services (NuvexNetwork/nuvex-services)

Repo: [NuvexNetwork/nuvex-services](https://github.com/NuvexNetwork/nuvex-services) | Use cases: 3 | Page: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/

A TypeScript set of off-chain services for Nuvex: a read-only HTTP API, a chain indexer that writes PostgreSQL or a JSON snapshot, price-provider adapters, and an empty AI directory.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Serve Nuvex network counts from an indexed Postgres store: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/run-read-api-on-indexed-postgres/
- Confirm the services repo passes format, lint, tests, and schema checks: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/check-repo-before-changes/
- Write indexer output to a JSON snapshot instead of Postgres: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/snapshot-indexer-output-without-postgres/

## How to serve Nuvex network counts from an indexed Postgres store with Nuvex Services

Repo: [NuvexNetwork/nuvex-services](https://github.com/NuvexNetwork/nuvex-services) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Run the indexer against a Postgres database, then query the read API for requests, nodes, and network counts.

**Who it is for:** A developer who needs a local read API that shows Nuvex network state from data the indexer wrote, not from live chain calls.

**The problem:** The API reads requests, nodes, and network counts from the indexer store. Without an indexed database, those endpoints have nothing to return.

**The outcome:** A running API where GET /health reports authority: none and the other read endpoints return rows the indexer decoded from program accounts.

### Steps

1. Run `pnpm install` in the repository root.
2. Run `cp env/.env.local.example .env.local` and set NUVEX_RPC_URL, one program id, and DATABASE_URL in it.
3. Apply the SQL files in `indexer/prisma/migrations/` to the database before starting the API.
4. Start the indexer with the start command described in the indexer section of the README (the exact command is not shown there, so check the indexer/ folder), then start the API.
5. Open GET /health on the API and confirm the response includes authority: none.

### Prompt to paste into your agent

```text
Work in the NuvexNetwork/nuvex-services repo. Using the .env.local values for <rpc-url> and <database-url>, apply the migrations in indexer/prisma/migrations/, start the indexer and API, then call GET /health. Report the response body and confirm it says authority: none, and state whether the program account counts returned by the API are non-empty.
```

### Caveat

The indexer exits with code 2 unless an RPC URL, a program id, and either DATABASE_URL or NUVEX_READ_MODEL_PATH are all set, and the README does not give the start command.

Risk, credentials: DATABASE_URL and the RPC URL go into .env.local, so keep that file out of version control and do not share the database connection string.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/run-read-api-on-indexed-postgres/

## How to confirm the services repo passes format, lint, tests, and schema checks with Nuvex Services

Repo: [NuvexNetwork/nuvex-services](https://github.com/NuvexNetwork/nuvex-services) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Install dependencies and run make check to validate the code and the Prisma schema before editing.

**Who it is for:** A contributor about to change the API, indexer, or price adapters who wants a clean baseline first.

**The problem:** Changes to the indexer or API can break formatting, linting, tests, or the Prisma schema, and it is faster to find out before editing.

**The outcome:** A green make check run and a local .env.local file ready for development.

### Steps

1. Clone the repository and change into its root folder.
2. Run `pnpm install`.
3. Run `make check`.
4. Run `cp env/.env.local.example .env.local` to create the local environment file.

### Prompt to paste into your agent

```text
In the NuvexNetwork/nuvex-services repo, run `pnpm install` and then `make check`. Report which of the steps (format, lint, tests, Prisma schema validation) passed or failed, and quote the first error line if any. Do not start a database, since make check does not need one.
```

### Caveat

make check does not start a database, so it cannot confirm that the indexer connects to Postgres.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/check-repo-before-changes/

## How to write indexer output to a JSON snapshot instead of Postgres with Nuvex Services

Repo: [NuvexNetwork/nuvex-services](https://github.com/NuvexNetwork/nuvex-services) | Difficulty: Intermediate | Time: 1 hour | Basis: From the README

Point the indexer at a JSON read model path to capture decoded account data without running a database.

**Who it is for:** A developer or analyst who wants a file of decoded Nuvex program accounts for offline review and has no Postgres instance.

**The problem:** Running PostgreSQL just to look at decoded accounts adds setup time. The indexer can write a JSON snapshot instead.

**The outcome:** A JSON file at the path you set in NUVEX_READ_MODEL_PATH that contains rows decoded from known account layouts.

### Steps

1. Run `pnpm install` in the repository root.
2. Run `cp env/.env.local.example .env.local`, then set NUVEX_RPC_URL, one program id, and NUVEX_READ_MODEL_PATH.
3. Start the indexer with the start command in the indexer section (not shown in the README, so check indexer/ first).
4. Open the file at NUVEX_READ_MODEL_PATH and confirm it contains decoded rows, not placeholder data.

### Prompt to paste into your agent

```text
In the NuvexNetwork/nuvex-services repo, set NUVEX_RPC_URL, one program id, and NUVEX_READ_MODEL_PATH=<snapshot-path> in .env.local, run the indexer, then open the snapshot file. Report the number of top-level records and list the first record's keys. Verify that the indexer did not invent rows by comparing record count to the program accounts the RPC returned.
```

### Caveat

The README says the indexer does not invent rows but gives no snapshot schema, so the record structure must be read from the code.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/nuvexnetwork-nuvex-services/snapshot-indexer-output-without-postgres/
