Compare commits

..

3 Commits

Author SHA1 Message Date
d6d36b224d Merge pull request 'fix(build): use the real API by default so the CI build works' (#6) from fix/api-default-build into main
Reviewed-on: #6
2026-11-04 12:03:33 +03:00
9ccd21584f fix(build): use the real API by default so the CI build works
The CI server runs a plain `next build` in apps/demo; it never reads vercel.json, so
`app:build` and its API URL were skipped. With no URL the app fell back to the demo data
source, which only works inside the hosted artifact sandbox, and rezina.yaltopia.com
showed "0 courses".

- the API URL is now the default in apps/demo/app/page.tsx; any plain build uses it
- NEXT_PUBLIC_LMS_API still overrides it (e.g. staging); set empty, it keeps demo data
- `demo:build` sets it empty: the artifact sandbox can't reach outside servers
  (artifact check: no network attempts)
- `app:build` is now just the plain build; README updated
2026-11-03 17:35:11 +03:00
1028caf109 Merge pull request 'Connect the student app to the Rezina API' (#5) from api-integration into main
Reviewed-on: #5
2026-11-03 16:57:59 +03:00
3 changed files with 8 additions and 6 deletions

View File

@ -31,6 +31,6 @@ npx -y pnpm@9 run i18n:check # every locale has every key
node tools/waitlist-check.mjs # waitlist Apps Script: validation, dedupe, formula-injection guard
```
**Vercel:** `vercel.json` runs `app:build`, which builds the student app against the real API (`https://api.rezina.yaltopia.com`, set in `package.json`). `demo:build` stays on demo data: it feeds the Claude-hosted demo, whose sandbox can't reach outside servers. To preview the old in-memory demo on Vercel, build with `npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs`. Deploy with `npx vercel deploy --prod`.
**Builds:** a plain build (`next build`, `app:build`, the CI server, Vercel) talks to the real API, `https://api.rezina.yaltopia.com`, the default in `apps/demo/app/page.tsx`. Point it elsewhere (e.g. staging) with `NEXT_PUBLIC_LMS_API=<url>`. `demo:build` sets it empty and keeps demo data: it feeds the hosted artifact demo, whose sandbox can't reach outside servers. To preview the old in-memory demo, build with `NEXT_PUBLIC_LMS_API= npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs`. Deploy to Vercel with `npx vercel deploy --prod`.
Phases 1–3 (Fastify API, Postgres, ArifPay, R2 video) haven't started yet. They wait on decisions D1, D2 and D8 in SPEC §17.

View File

@ -2,9 +2,11 @@
import { ApiDataSource, ClaudeDbDataSource } from '@lms/data';
import { Platform } from '@lms/features';
// Build with NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com to run the screens against the real API;
// without it the demo keeps its own data (Claude db, or the in-memory mock on Vercel).
const API = process.env.NEXT_PUBLIC_LMS_API;
// Any plain build (`next build`, as the CI server runs it) talks to the real API.
// The hosted artifact demo opts out by building with NEXT_PUBLIC_LMS_API set to an empty value (`demo:build`):
// its sandbox can't reach outside servers, so it keeps its own data. Another API (e.g. staging) is a different value.
const DEFAULT_API = 'https://api.rezina.yaltopia.com';
const API = process.env.NEXT_PUBLIC_LMS_API ?? DEFAULT_API;
const makeDs = () => (API ? new ApiDataSource(API) : new ClaudeDbDataSource());
export default function Page() {

View File

@ -3,8 +3,8 @@
"private": true,
"packageManager": "pnpm@9.15.9",
"scripts": {
"app:build": "NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com pnpm --filter demo build",
"demo:build": "pnpm --filter demo build && node tools/artifact-inline.mjs apps/demo/out dist/demo.html && node tools/artifact-check.mjs dist/demo.html",
"app:build": "pnpm --filter demo build",
"demo:build": "NEXT_PUBLIC_LMS_API= pnpm --filter demo build && node tools/artifact-inline.mjs apps/demo/out dist/demo.html && node tools/artifact-check.mjs dist/demo.html",
"test": "node packages/features/src/domain.check.ts && node packages/data/src/api.check.ts",
"typecheck": "pnpm -r exec tsc --noEmit",
"i18n:check": "node tools/i18n-check.mjs"