Skip to content

Conversation

@artemdemo
Copy link
Contributor

@artemdemo artemdemo commented Feb 10, 2026

Note

Description

This PR adds a new base44 dev command 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added base44 dev command (src/cli/commands/dev.ts) with optional --port flag
  • Implemented Express-based development server (src/cli/dev/dev-server/main.ts) with:
    • Full proxy to https://base44.app for API requests
    • CORS configuration allowing localhost origins with credentials
    • OAuth route redirection (direct redirect instead of proxy to preserve session cookies)
    • Automatic port detection (defaults to 4400, finds available port if occupied)
    • Error handling for port conflicts (EADDRINUSE)
  • Updated build configuration (infra/build.ts) to support multiple build targets
  • Added dependencies: express, cors, http-proxy-middleware, get-port, and their TypeScript types
  • Added .editorconfig for consistent code formatting across editors
  • Registered dev command in program as hidden feature

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

The dev server is marked as hidden: true in 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-port package.


🤖 Generated by Claude | 2026-02-11 19:28 UTC

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.31-pr.226.5f9b2b0

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/cli@0.0.31-pr.226.5f9b2b0"

Or add it to your package.json dependencies:

{
  "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]) {
Copy link
Contributor Author

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

@artemdemo artemdemo marked this pull request as ready for review February 10, 2026 14:35
@artemdemo artemdemo force-pushed the cli-local-dev-full-proxy branch from cdbd97e to 75699b5 Compare February 11, 2026 06:44
@base44 base44 deleted a comment from claude bot Feb 11, 2026
@base44 base44 deleted a comment from claude bot Feb 11, 2026
@artemdemo
Copy link
Contributor Author

@claude review

@base44 base44 deleted a comment from claude bot Feb 11, 2026
Copy link
Contributor Author

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"

@base44 base44 deleted a comment from claude bot Feb 11, 2026
@base44 base44 deleted a comment from claude bot Feb 11, 2026
@base44 base44 deleted a comment from claude bot Feb 11, 2026
@base44 base44 deleted a comment from claude bot Feb 11, 2026
@claude
Copy link

claude bot commented Feb 11, 2026


Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


@artemdemo artemdemo requested a review from kfirstri February 11, 2026 08:58
@artemdemo artemdemo enabled auto-merge (squash) February 11, 2026 08:59
@artemdemo artemdemo force-pushed the cli-local-dev-full-proxy branch from 75afbfa to 6ef1465 Compare February 11, 2026 09:34
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}`;
Copy link
Collaborator

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

// (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/;
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

@artemdemo artemdemo force-pushed the cli-local-dev-full-proxy branch from 4d73f20 to a452cc1 Compare February 11, 2026 11:44
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}`;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

// (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/;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment on lines 49 to 68
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,
});
}
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of error it will look like this:

Image

end process will exit

Comment on lines +1 to +3
{
"recommendations": ["biomejs.biome"]
}
Copy link
Contributor Author

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"
Copy link
Contributor Author

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

import express from "express";
import { createProxyMiddleware } from "http-proxy-middleware";

const DEFAULT_PORT = 3000;
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure

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}`;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider new URL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Collaborator

@kfirstri kfirstri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U R GREAT

@github-project-automation github-project-automation bot moved this from Backlog to In review in CLI Development Feb 11, 2026
@artemdemo artemdemo merged commit 2df66a8 into main Feb 11, 2026
4 of 8 checks passed
@artemdemo artemdemo deleted the cli-local-dev-full-proxy branch February 11, 2026 15:07
@github-project-automation github-project-automation bot moved this from In review to Done in CLI Development Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants