You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+68-1Lines changed: 68 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,6 +42,58 @@ npm install tus-js-client
42
42
-**i18n Support** - English and German translations (works without i18n too)
43
43
-**Auto-imports** - All composables and components are auto-imported
44
44
45
+
## Environment Variables
46
+
47
+
| Variable | Context | Description |
48
+
|----------|---------|-------------|
49
+
|`NUXT_PUBLIC_API_URL`| Client + Server | Public API URL. Primary way to configure the API endpoint. Used for client-side requests and as SSR fallback. |
50
+
|`NUXT_API_URL`| Server only | Internal API URL for SSR requests. Use when the backend has a private network address that should not be exposed to the client. |
51
+
|`NUXT_PUBLIC_API_PROXY`| Client | Set to `true` to enable the Vite dev proxy. Routes client requests through `/api/` for same-origin cookies. **Only for local development.**|
52
+
53
+
### How URL Resolution Works
54
+
55
+
All environment variables are resolved **at runtime** (not build time). This means you can build a Docker image once and deploy it to different environments by changing env vars — no rebuild needed.
**Client with proxy (`NUXT_PUBLIC_API_PROXY=true`):**
64
+
All requests go to `/api/{path}` — the Vite dev proxy forwards them to the backend.
65
+
66
+
> **Security:**`NUXT_API_URL` is never exposed to the client bundle. It stays in `runtimeConfig.apiUrl` (server only). This is important when using internal network addresses like `http://api.svc.cluster.local`.
67
+
68
+
### Deployment Scenarios
69
+
70
+
**Local development** — Frontend and backend on different ports, proxy ensures same-origin cookies:
71
+
```bash
72
+
NUXT_PUBLIC_API_URL=http://localhost:3000
73
+
NUXT_PUBLIC_API_PROXY=true
74
+
```
75
+
76
+
**Production (simple)** — Backend reachable via public URL from both SSR and client:
77
+
```bash
78
+
NUXT_PUBLIC_API_URL=https://api.example.com
79
+
```
80
+
81
+
**Production (internal network)** — SSR uses fast internal route, client uses public URL:
82
+
```bash
83
+
NUXT_PUBLIC_API_URL=https://api.example.com
84
+
NUXT_API_URL=http://api-internal:3000
85
+
```
86
+
87
+
**Legacy (nuxt.config.ts only)** — Works but env vars are preferred for runtime flexibility:
0 commit comments