# Use and adapt fu

Use the documented interfaces and source layout for **fu**. The sections below retain the README’s examples and configuration details.

## Usage

### Run Convex backend (root)

```bash
cd fu
npm run dev
```

### Run seller-provider (Next.js)

```bash
cd seller-provider
npm run dev
```

### Run ServicesProviders (Next.js)

```bash
cd ServicesProviders
npm run dev
```

### Run mobile app (Expo)

```bash
cd min-app
npm run start
```

## Usage Examples

### Calling a Convex function from the CLI

```bash
npx convex run myFunctions:myQuery '{"first": 1, "second": "Hello"}'
```

### Calling Convex from a React component (example)

```ts
import { useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";

export function Example() {
  const profile = useQuery(api.users.getUserProfile, { userId: "user_123" });
  if (profile === undefined) return <div>Loading…</div>;
  if (profile === null) return <div>Not found</div>;
  return <div>{profile.name}</div>;
}
```

## Configuration

### Convex (backend)

You configure Convex through the CLI and your Convex dashboard:

- Dashboard: <https://dashboard.convex.dev>
- Docs: <https://docs.convex.dev>

Common commands:

```bash
# from repo root
npx convex dev
npx convex codegen
```

### Observability (Sentry)

- Issues dashboard: <https://avyren.sentry.io/projects/javascript-nextjs/issues/>

### seller-provider environment variables

Create `seller-provider/.env.local` and follow:

- [seller-provider/ENV_SETUP.md](https://github.com/Up-to-code/fu/blob/main/seller-provider/ENV_SETUP.md)

At minimum, seller-provider expects:

```env
NEXT_PUBLIC_CONVEX_URL=https://your-deployment.convex.cloud
NEXT_PUBLIC_CONVEX_SITE_URL=https://your-deployment.convex.site
NEXT_PUBLIC_BETTER_AUTH_BASE_URL=http://localhost:3000
```

## Commands in the root manifest

The captured [package.json](https://github.com/Up-to-code/fu/blob/HEAD/package.json) declares the following scripts. Run them from the directory containing that manifest.

| Command | Script |
| --- | --- |
| `npm run dev` | `convex dev` |
| `npm run lint` | `tsc -p convex && eslint . --report-unused-disable-directives --max-warnings 0` |

## Troubleshoot a local change

1. Reproduce the smallest example from the [quick-start guide](/docs/up-to-code-fu/quick-start-guide).
2. Compare required configuration and dependency versions with the README.
3. Check the linked issue tracker for the same error. Include the command, runtime version, and relevant error when reporting a problem; omit credentials.

## Source and help

- [GitHub repository](https://github.com/Up-to-code/fu)
- [Original README](https://github.com/Up-to-code/fu/blob/main/README.md)
- [Issues and existing reports](https://github.com/Up-to-code/fu/issues)
