@pylonsync/create-pylon 0.3.19 → 0.3.20

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.
@@ -25,7 +25,7 @@ import { stdin, stdout, exit, argv, cwd } from "node:process";
25
25
  // of the pylon stack).
26
26
  // ---------------------------------------------------------------------------
27
27
 
28
- const PYLON_VERSION = "0.3.19";
28
+ const PYLON_VERSION = "0.3.20";
29
29
 
30
30
  // ---------------------------------------------------------------------------
31
31
  // CLI args + interactive prompt
@@ -604,7 +604,20 @@ write(
604
604
  * Pylon's typed client + functions packages re-export across the
605
605
  * server/client boundary AND the workspace UI package ships TSX.
606
606
  * \`transpilePackages\` makes Next bundle them cleanly.
607
+ *
608
+ * \`rewrites\` proxies every Pylon-owned path (\`/api/fn/*\`,
609
+ * \`/api/auth/*\`, \`/api/sync/*\`, …) to the Pylon binary running
610
+ * on \`PYLON_API_URL\` (default http://localhost:4321). Without this,
611
+ * Next.js sees \`/api/fn/addTodo\` as a missing route and 404s before
612
+ * the request ever reaches Pylon.
613
+ *
614
+ * In production set \`PYLON_API_URL\` to wherever you've deployed the
615
+ * Pylon binary (Fly, Render, Railway, your own box). The browser
616
+ * still hits same-origin paths under your Next deployment, and Next
617
+ * forwards them server-side — no CORS, no extra DNS.
607
618
  */
619
+ const PYLON_API_URL = process.env.PYLON_API_URL ?? "http://localhost:4321";
620
+
608
621
  const config: NextConfig = {
609
622
  \ttranspilePackages: [
610
623
  \t\t"@${projectName}/ui",
@@ -614,6 +627,14 @@ const config: NextConfig = {
614
627
  \t\t"@pylonsync/functions",
615
628
  \t\t"@pylonsync/sync",
616
629
  \t],
630
+ \tasync rewrites() {
631
+ \t\treturn [
632
+ \t\t\t{ source: "/api/fn/:path*", destination: \`\${PYLON_API_URL}/api/fn/:path*\` },
633
+ \t\t\t{ source: "/api/auth/:path*", destination: \`\${PYLON_API_URL}/api/auth/:path*\` },
634
+ \t\t\t{ source: "/api/sync/:path*", destination: \`\${PYLON_API_URL}/api/sync/:path*\` },
635
+ \t\t\t{ source: "/api/:path*", destination: \`\${PYLON_API_URL}/api/:path*\` },
636
+ \t\t];
637
+ \t},
617
638
  };
618
639
 
619
640
  export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pylonsync/create-pylon",
3
- "version": "0.3.19",
3
+ "version": "0.3.20",
4
4
  "description": "Scaffold a new Pylon app — realtime backend + Next.js frontend in one command. Run via `npm create @pylonsync/pylon@latest`.",
5
5
  "publishConfig": {
6
6
  "access": "public"