opencode/packages/app
Alexey Volkov ad930e0ba2
feat: App - Support setting base URL during build
This is needed to host OpenCode app under under some URL prefix.
This minimal change makes it possible to build OpenCode Web App with VITE_BASE_URL="/subdir/" and have it run under `http://<host>:<port>/subdir/` instead of root (`http://<host>:<port>/`).

Set `VITE_BASE_URL` env var during build. This automatically sets the `base` in Vite config. Vite generates correct URLs in `index.html`.
`import.meta.env.BASE_URL` is also used in routers. See https://vite.dev/config/shared-options#base
You can also set `VITE_OPENCODE_SERVER_BASE_URL` to specify the base URL prefix for the server.

Usage:
```
% VITE_BASE_URL="/XXX" VITE_OPENCODE_SERVER_BASE_URL="/" bun dev
$ vite
(!) "base" option should start with a slash.

  VITE v7.1.4  ready in 320 ms

  ➜  Local:   http://localhost:3000/XXX
```
2026-03-19 22:50:05 -07:00
..
e2e fix: lots of desktop stability, better e2e error logging (#18300) 2026-03-20 00:12:06 -04:00
public fix(app): remove oc-1 theme 2026-03-09 08:25:41 -05:00
script fix(e2e): fail fast on config dependency installs (#17280) 2026-03-13 14:08:51 +10:00
src feat: App - Support setting base URL during build 2026-03-19 22:50:05 -07:00
.gitignore test(app): initial e2e test setup 2026-01-19 09:03:52 -06:00
AGENTS.md fix(app): fix numbered list rendering in web markdown (#9723) 2026-01-20 20:28:01 -06:00
README.md test(app): fix e2e 2026-01-20 14:02:09 -06:00
bunfig.toml chore: fix test 2026-02-10 07:06:20 -06:00
create-effect-simplification-spec.md chore(app): solidjs refactoring (#13399) 2026-03-02 10:50:50 -06:00
happydom.ts chore: rename packages/desktop -> packages/app 2025-12-22 19:39:00 -06:00
index.html fix(web): favicon rename again 2026-01-21 14:36:21 -06:00
package.json fix: restore recent test regressions and upgrade effect beta (#18158) 2026-03-19 09:54:01 +10:00
playwright.config.ts fix(app): increase CI e2e workers (#17263) 2026-03-13 10:15:34 +10:00
sst-env.d.ts zen: update sst version 2026-02-18 13:54:23 -05:00
tsconfig.json ci: remove unused publishConfig that was breaking npm publishing 2026-03-05 09:45:30 -05:00
vite.config.ts feat: App - Support setting base URL during build 2026-03-19 22:50:05 -07:00
vite.js chore: cleanup 2025-12-28 06:41:59 -06:00

README.md

Usage

Dependencies for these templates are managed with pnpm using pnpm up -Lri.

This is the reason you see a pnpm-lock.yaml. That said, any package manager will work. This file can safely be removed once you clone a template.

$ npm install # or pnpm install or yarn install

Learn more on the Solid Website and come chat with us on our Discord

Available Scripts

In the project directory, you can run:

npm run dev or npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.

npm run build

Builds the app for production to the dist folder.
It correctly bundles Solid in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

E2E Testing

Playwright starts the Vite dev server automatically via webServer, and UI tests need an opencode backend (defaults to localhost:4096). Use the local runner to create a temp sandbox, seed data, and run the tests.

bunx playwright install
bun run test:e2e:local
bun run test:e2e:local -- --grep "settings"

Environment options:

  • PLAYWRIGHT_SERVER_HOST / PLAYWRIGHT_SERVER_PORT (backend address, default: localhost:4096)
  • PLAYWRIGHT_PORT (Vite dev server port, default: 3000)
  • PLAYWRIGHT_BASE_URL (override base URL, default: http://localhost:<PLAYWRIGHT_PORT>)

Deployment

You can deploy the dist folder to any static host provider (netlify, surge, now, etc.)