-
Notifications
You must be signed in to change notification settings - Fork 3
CLI local dev full proxy #226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.31-pr.226.5f9b2b0Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.31-pr.226.5f9b2b0"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.31-pr.226.5f9b2b0"
}
}
Preview published to npm registry — try new features instantly! |
| formatOutput(result.outputs) | ||
| ); | ||
| const { cli } = await runAllBuilds(); | ||
| for (const result of [cli]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a preparation for additional entry
cdbd97e to
75699b5
Compare
|
@claude review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will help automatically to deal with lint errors regarding "non empty last line in file"
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
75afbfa to
6ef1465
Compare
src/cli/dev/dev-server/main.ts
Outdated
| const AUTH_LOGIN_PATTERN = /^\/api\/apps\/auth(\/\w+)?\/login/; | ||
| app.use((req, res, next) => { | ||
| if (AUTH_LOGIN_PATTERN.test(req.path)) { | ||
| const targetUrl = `https://base44.app${req.originalUrl}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using new URL, then we can do something like
// save the base url
const BASE44_APP_URL = 'https://base44.app';
new URL(req.originalUrl, BASE44_APP_URL)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/cli/dev/dev-server/main.ts
Outdated
| // (redirects + session cookies) works correctly. Proxying breaks OAuth | ||
| // because the session cookie ends up on localhost while Google's callback | ||
| // goes to base44.app. | ||
| const AUTH_LOGIN_PATTERN = /^\/api\/apps\/auth(\/\w+)?\/login/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's test/check if there's a signup url we need to handle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
4d73f20 to
a452cc1
Compare
src/cli/dev/dev-server/main.ts
Outdated
| const AUTH_LOGIN_PATTERN = /^\/api\/apps\/auth(\/\w+)?\/login/; | ||
| app.use((req, res, next) => { | ||
| if (AUTH_LOGIN_PATTERN.test(req.path)) { | ||
| const targetUrl = `https://base44.app${req.originalUrl}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/cli/dev/dev-server/main.ts
Outdated
| // (redirects + session cookies) works correctly. Proxying breaks OAuth | ||
| // because the session cookie ends up on localhost while Google's callback | ||
| // goes to base44.app. | ||
| const AUTH_LOGIN_PATTERN = /^\/api\/apps\/auth(\/\w+)?\/login/; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
| return new Promise((resolve, reject) => { | ||
| const server = app.listen(port, "127.0.0.1", (err) => { | ||
| if (err) { | ||
| if ("code" in err && err.code === "EADDRINUSE") { | ||
| reject( | ||
| new Error( | ||
| `Port ${port} is already in use. Stop the other process and try again.`, | ||
| ), | ||
| ); | ||
| } else { | ||
| reject(err); | ||
| } | ||
| } else { | ||
| resolve({ | ||
| port, | ||
| server, | ||
| }); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| { | ||
| "recommendations": ["biomejs.biome"] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin needed for correct work.
Without it nothing will correctly happened and it will be the same experience as before - only lints when you run bun run lint:fix
| "editor.defaultFormatter": "biomejs.biome" | ||
| }, | ||
| "[jsonc]": { | ||
| "editor.defaultFormatter": "biomejs.biome" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed it last time, should be explicit
src/cli/dev/dev-server/main.ts
Outdated
| import express from "express"; | ||
| import { createProxyMiddleware } from "http-proxy-middleware"; | ||
|
|
||
| const DEFAULT_PORT = 3000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do port 4400 :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
src/cli/dev/dev-server/main.ts
Outdated
| const AUTH_ROUTE_PATTERN = /^\/api\/apps\/auth(\/|$)/; | ||
| app.use((req, res, next) => { | ||
| if (AUTH_ROUTE_PATTERN.test(req.path)) { | ||
| const targetUrl = `${BASE44_APP_URL}${req.originalUrl}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider new URL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
kfirstri
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
U R GREAT

Note
Description
This PR adds a new
base44 devcommand that starts a local development server proxying to the production Base44 API. The dev server enables local frontend development with CORS support, OAuth redirect handling, and automatic port selection when the default port (4400) is already in use.Related Issue
None
Type of Change
Changes Made
base44 devcommand (src/cli/commands/dev.ts) with optional--portflagsrc/cli/dev/dev-server/main.ts) with:https://base44.appfor API requestsinfra/build.ts) to support multiple build targetsexpress,cors,http-proxy-middleware,get-port, and their TypeScript types.editorconfigfor consistent code formatting across editorsTesting
npm test)Checklist
Additional Notes
The dev server is marked as
hidden: truein the CLI program, indicating this is an experimental or internal-use feature. The server redirects OAuth authentication routes directly to base44.app rather than proxying them, which preserves the OAuth flow and session cookie handling required by authentication providers.The port handling logic gracefully handles the case where port 4400 is already in use, automatically finding the next available port using the
get-portpackage.🤖 Generated by Claude | 2026-02-11 19:28 UTC