create-apollo-monorepo 0.5.3 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.mjs +73 -7
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -364,21 +364,23 @@ function writeRootPackageJson(targetDir, dirName) {
364
364
  // Allow listed packages to run their build/postinstall scripts; the rest
365
365
  // are skipped (pnpm 10 default is empty allow-list).
366
366
  onlyBuiltDependencies: [
367
+ "@parcel/watcher",
368
+ "@rolldown/binding-darwin-arm64",
369
+ "@rolldown/binding-linux-arm64-gnu",
370
+ "@rolldown/binding-linux-x64-gnu",
371
+ "@sentry/cli",
367
372
  "@swc/core",
368
373
  "@swc/core-darwin-arm64",
369
374
  "@swc/core-darwin-x64",
370
375
  "@swc/core-linux-arm64-gnu",
371
376
  "@swc/core-linux-x64-gnu",
377
+ "better-sqlite3",
378
+ "core-js",
379
+ "core-js-pure",
372
380
  "esbuild",
373
381
  "msw",
374
382
  "sharp",
375
383
  "unrs-resolver",
376
- "@rolldown/binding-darwin-arm64",
377
- "@rolldown/binding-linux-x64-gnu",
378
- "@rolldown/binding-linux-arm64-gnu",
379
- "better-sqlite3",
380
- "core-js",
381
- "core-js-pure",
382
384
  ],
383
385
  },
384
386
  };
@@ -407,6 +409,58 @@ function writePnpmWorkspace(targetDir) {
407
409
  );
408
410
  }
409
411
 
412
+ // Single-origin nginx reference. Only emitted when adminPrefix is set, since
413
+ // in separate-origins mode the two apps live on their own domains/ports and
414
+ // don't need the prefix-aware location ordering.
415
+ function writeNginxSample(targetDir, adminPrefix) {
416
+ const prefix = adminPrefix || "/admin";
417
+ const conf = `# Apollo CMS — single-origin nginx sample.
418
+ # Mirrors apps/frontend/next.config.ts rewrites (frontend :3001 / backend :3000).
419
+ # No caching headers — Next.js sets its own. Add SSL + HTTP→HTTPS in production.
420
+
421
+ upstream apollo_frontend { server 127.0.0.1:3001; }
422
+ upstream apollo_backend { server 127.0.0.1:3000; }
423
+
424
+ server {
425
+ listen 80;
426
+ server_name _;
427
+
428
+ client_max_body_size 50m;
429
+
430
+ proxy_http_version 1.1;
431
+ proxy_set_header Host $host;
432
+ proxy_set_header X-Real-IP $remote_addr;
433
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
434
+ proxy_set_header X-Forwarded-Proto $scheme;
435
+ proxy_set_header X-Forwarded-Host $host;
436
+
437
+ # Backend — admin UI + chunks (APOLLO_ASSET_PREFIX=${prefix}), media, Sentry tunnel
438
+ location = ${prefix} { proxy_pass http://apollo_backend; }
439
+ location ^~ ${prefix}/ { proxy_pass http://apollo_backend; }
440
+ location ^~ /uploads/ { proxy_pass http://apollo_backend; }
441
+ location = /monitoring { proxy_pass http://apollo_backend; }
442
+
443
+ # Backend SSE — long-lived, no buffering
444
+ location ^~ /api/editing-presence/ {
445
+ proxy_pass http://apollo_backend;
446
+ proxy_buffering off;
447
+ proxy_read_timeout 24h;
448
+ }
449
+
450
+ # Backend APIs (mirror the list in apps/frontend/next.config.ts).
451
+ # \`editing-presence\` is included so the bare path also routes to backend;
452
+ # streaming sub-paths still match the \`^~\` block above first.
453
+ location ~ ^/api/(auth|v1|cron|email|health|mcp|admin|editing-presence)(/|$) {
454
+ proxy_pass http://apollo_backend;
455
+ }
456
+
457
+ # Frontend — everything else
458
+ location / { proxy_pass http://apollo_frontend; }
459
+ }
460
+ `;
461
+ writeFileSync(resolve(targetDir, "nginx.conf.sample"), conf);
462
+ }
463
+
410
464
  function writeRootGitignore(targetDir) {
411
465
  const ignore = [
412
466
  "node_modules",
@@ -855,6 +909,13 @@ paths to the backend so /_next/* doesn't collide:
855
909
  The frontend MUST NOT define routes at \`/admin\`, \`/api/auth\`, \`/api/v1\`, etc.
856
910
  If you need your own API, namespace it under \`/api/internal/*\` or similar.
857
911
 
912
+ ### Reverse proxy (nginx)
913
+
914
+ A reference \`nginx.conf.sample\` ships at the repo root with the same routing
915
+ baked in (frontend on :3001, backend on :3000). Use it when fronting both apps
916
+ behind a single TLS-terminating proxy outside Vercel — drop in your domain and
917
+ SSL certs.
918
+
858
919
  To **disable** single-origin and run the backend on its own subdomain,
859
920
  delete \`APOLLO_ASSET_PREFIX\` from \`apps/backend/.env.local\` and remove the
860
921
  \`rewrites()\` block from \`apps/frontend/next.config.ts\`.
@@ -1070,7 +1131,12 @@ async function main() {
1070
1131
  writeRootGitignore(targetDir);
1071
1132
  writeRootEnv(targetDir, { dbUrl, siteUrl, locale, authSecret, cronSecret, adminPrefix, backendInternalUrl });
1072
1133
  writeReadme(targetDir, dirName, frontendName, adminPrefix);
1073
- success("package.json, pnpm-workspace.yaml, .gitignore, .env.local, README.md");
1134
+ if (adminPrefix) writeNginxSample(targetDir, adminPrefix);
1135
+ success(
1136
+ `package.json, pnpm-workspace.yaml, .gitignore, .env.local, README.md${
1137
+ adminPrefix ? ", nginx.conf.sample" : ""
1138
+ }`,
1139
+ );
1074
1140
 
1075
1141
  // ── Step 4: git init ──
1076
1142
  step(4, "Initializing git");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-apollo-monorepo",
3
- "version": "0.5.3",
3
+ "version": "0.6.0",
4
4
  "description": "Scaffold a monorepo with a frontend app and Apollo CMS as a git submodule backend (single-origin via Next.js rewrites + assetPrefix)",
5
5
  "bin": {
6
6
  "create-apollo-monorepo": "index.mjs"