Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# ---------------------------------------------------------------------------
FROM node:24-slim AS base

# Disable corepack (root package.json has a packageManager field for npm,
# but the workspace uses pnpm — installing pnpm directly avoids conflicts)
# Disable corepack and install pnpm explicitly so container builds use the
# same package manager as the workspace regardless of the base image defaults.
ENV COREPACK_ENABLE_STRICT=0
RUN corepack disable && npm install -g pnpm@latest

Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ Copy the example environment file and fill in your values:
cp .env.example .env
```

The API server reads the workspace root `.env` automatically when you use the
package scripts below. The frontend keeps its own dev defaults (port `5173`,
base path `/`) unless you add an artifact-local `.env` file.

Required variables:

| Variable | Description |
Expand Down Expand Up @@ -116,6 +120,11 @@ pnpm --filter @workspace/api-server run dev
pnpm --filter @workspace/cad-annotator run dev
```

In local development, the Vite dev server proxies `/api` requests to
`http://127.0.0.1:8080` by default, so the frontend works against the API
server without extra client configuration. Override that target with
`API_PROXY_TARGET` if your API is running elsewhere.

### 5. Build for production

```bash
Expand Down
5 changes: 3 additions & 2 deletions artifacts/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
"private": true,
"type": "module",
"scripts": {
"dev": "export NODE_ENV=development && pnpm run build && pnpm run start",
"dev": "NODE_ENV=development pnpm run build && pnpm run start",
"build": "node ./build.mjs",
"start": "node --enable-source-maps ./dist/index.mjs",
"start": "node --env-file-if-exists=../../.env --enable-source-maps ./dist/index.mjs",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "vitest --run"
},
"dependencies": {
"@workspace/api-zod": "workspace:*",
"@workspace/db": "workspace:*",
"@workspace/integrations-openai-ai-server": "workspace:*",
"better-sqlite3": "^11.9.1",
"cookie-parser": "^1.4.7",
"cors": "^2",
"drizzle-orm": "catalog:",
Expand Down
2 changes: 1 addition & 1 deletion artifacts/cad-annotator/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default function Home() {
<Layers className="w-4 h-4 text-primary" />
</div>
<h1 className="text-lg font-medium tracking-tight text-foreground">
CAD Annotator
Caid Annotator
</h1>
</div>
<nav className="flex items-center gap-4">
Expand Down
13 changes: 13 additions & 0 deletions artifacts/cad-annotator/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ if (Number.isNaN(port) || port <= 0) {
/** URL base path — defaults to "/" for standard deployments. */
const basePath = process.env.BASE_PATH || "/";

/**
* Local API target used by the dev server proxy.
* Keep frontend requests same-origin during development by forwarding `/api`
* to the separately running API server.
*/
const apiProxyTarget = process.env.API_PROXY_TARGET || "http://127.0.0.1:8080";

/* -------------------------------------------------------------------------- */
/* Vite config */
/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -60,6 +67,12 @@ export default defineConfig({
host: "0.0.0.0",
allowedHosts: true,
fs: { strict: true },
proxy: {
"/api": {
target: apiProxyTarget,
changeOrigin: true,
},
},
},

preview: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"typescript": "~5.9.2",
"prettier": "^3.8.1"
},
"packageManager": "npm@11.13.0+sha512.7119a16a0843580d65160977520e3f5710c974f04afd4fad36d9eb97d917ba716a856c35c78c4be6dc64367eeaccfb957ef5ce997ca31e9330b2e936ba2b1b92"
"packageManager": "pnpm@9.0.0"
}
Loading