# SFERA Web Next.js frontend for the SFERA 1C semantic workspace. ## Run On This NAS Workspace Use the mapped `R:` drive. It points to `\\nas\MST` and avoids Windows tooling issues with UNC current directories. ```bat cd /d R:\codex\SFERA\frontend\sfera-web npm run dev ``` Do not run `npm` from the UNC path `\\nas\MST\...`. Windows starts `cmd.exe` in `C:\Windows` for UNC current directories, so package scripts cannot find `package.json`. The app resolves the API endpoint in this order: 1. `SFERA_API_URL` 2. `NEXT_PUBLIC_SFERA_API_URL` 3. the current panel host with API port `8000` Examples: - `http://192.168.200.60:3000` -> `http://192.168.200.60:8000` - `http://docker-test.cin.su:3000` -> `http://docker-test.cin.su:8000` - `http://127.0.0.1:3001` -> `http://localhost:8000` If the stand moves to another API port, set: ```text SFERA_API_URL=http://api-host:8080 ``` You can also override only the derived port: ```text SFERA_API_PORT=8080 ``` ## Checks ```bat cd /d R:\codex\SFERA\frontend\sfera-web node_modules\.bin\tsc.cmd -p tsconfig.json --noEmit node_modules\.bin\next.cmd build npm run smoke:editor npm run smoke:editor:runtime npm run smoke:project-setup ``` `npm run smoke:editor` checks the running stand URL. By default it uses `http://192.168.200.60:3000` and verifies that the overview stays a dashboard while editor modes open directly: - `mode=module` - `mode=form` - `mode=events` - `mode=learning` Use `SFERA_WEB_URL` to point the smoke check at another host or port. The HTML smoke retries each page briefly while a freshly started stand settles. `npm run smoke:editor:runtime` opens the running editor in an installed Chrome/Edge through `playwright-core`. It catches browser runtime failures such as Monaco `Runtime TypeError`, verifies that Monaco renders in `mode=module`, opens `mode=versions`, clicks a version row, checks full version payload details, and exercises metadata draft preview/apply through the API. `npm run smoke:project-setup` checks the new Project Setup / Import Center flow. It prepares the `default` project through the web API proxy, verifies that the indexed Project IDE Shell opens, and exercises metadata draft preview/save to workspace history. By default the runtime smoke uses the installed Chrome/Edge paths on this Windows stand. Override when needed: ```text SFERA_BROWSER_PATH=C:\Path\To\chrome.exe SFERA_WEB_URL=http://docker-test.cin.su:3000 ``` Use `npm run smoke:editor:all` to run both the HTML smoke and browser runtime smoke. Browser-side editor actions require API CORS for the panel origin; the API allows LAN panel origins, localhost, and `docker-test.cin.su` by default. The Project Setup smoke uses the Next.js `/api/sfera/...` proxy and therefore also verifies frontend-to-backend routing.