Repository: promptfoo/promptfoo
Issue: Having trouble building from source
Root cause: Documentation Deficiency

I'm trying to build this repo from source, but it wasn't a successful attempt.  
I couldn't find any documentation where it guides me through building and running the CLI.
I tried to build the docker file which wasn't successful either.
For building the standalone ui, I suppose we need a [subspace](https://supabase.com/) account. Still I couldn't figure out apart from providing the right env variables, `NEXT_PUBLIC_SUPABASE_URL`, `NEXT_PUBLIC_SUPABASE_ANON_KEY` what else do I need to do. I gave up trying to build its standalone version, next I tried to build the local version.  
I would try to augment the Readme with the documentation of building from source if I could build it myself.  
By running
```bash
$ npm install
$ npm build
```
The project is build without any error. But When I try to run the `view` command, the web interface doesn't work.  
```bash
$ npm run local view
```
Any suggestion how can I resolve this?


Hello @e3oroush, I've been doing the following.
```
git clone https://github.com/promptfoo/promptfoo.git
cd path/to/promptfoo-source
npm i

cd path/to/experiment-with-promptfoo # contains your promptfooconfig.yaml
npx path/to/promptfoo-source eval
```

Consider using `npx` with `--no-cache` to avoid caching a build in `~/.npm/_npx/...`

I run into the same problem of `npx path/to/promptfoo-source view` not working. However, using `npx promptfoo@latest view` in combination has worked, the promptfoo cache seems shared.

Here's my workflow to use the CLI after a fresh `git clone`:

```
NEXT_PUBLIC_SUPABASE_URL=http:// NEXT_PUBLIC_SUPABASE_ANON_KEY=abc123 npm install

./dist/src/main.js view
```

- The Supabase account is not necessary for development, I just put dummy envars.  It's only used for hosting the `promptfoo share` results at app.promptfoo.dev.  
- I also use `npm link` so I can just run `promptfoo` instead of manually specifying `./dist/src/main.js`.

If I'm developing the web view, then:
```
cd src/web/nextui
npm run dev
```
which runs the next.js app on localhost:3000 with hot reload and other debugging amenities.

> Hello @e3oroush, I've been doing the following.
> 
> ```
> git clone https://github.com/promptfoo/promptfoo.git
> cd path/to/promptfoo-source
> npm i
> 
> cd path/to/experiment-with-promptfoo # contains your promptfooconfig.yaml
> npx path/to/promptfoo-source eval
> ```
> 
> Consider using `npx` with `--no-cache` to avoid caching a build in `~/.npm/_npx/...`
> 
> I run into the same problem of `npx path/to/promptfoo-source view` not working. However, using `npx promptfoo@latest view` in combination has worked, the promptfoo cache seems shared.

I used this approach. Worked perfectly. Thanks.

@typpo how could one run "./dist/src/main.js view" during development with hot reloading?  

@shaayaansayed As of 83065a9c214681bd0d4ea507c7a384539b9456b5, to develop the web UI locally, run:
```
npm run local:web
```

This hosts a web frontend at http://localhost:3000 that talks to the `promptfoo view` web server.  The :3000 endpoint has hot reloading and other benefits of Next.js's developer environment.  You'll need to run `promptfoo view` or `./dist/src/main.js view` at the same time in order to provide the server side.