Skip to content

CLI local dev#195

Draft
artemdemo wants to merge 12 commits intomainfrom
cli-local-dev
Draft

CLI local dev#195
artemdemo wants to merge 12 commits intomainfrom
cli-local-dev

Conversation

@artemdemo
Copy link
Contributor

@artemdemo artemdemo commented Feb 5, 2026

Note

Description

Adds a local development mode via the base44 dev command that enables running Base44 applications entirely offline without backend connectivity. The implementation includes an Express-based API server that emulates Base44's backend, an in-memory NeDB database for entity storage, and a sophisticated Deno runtime manager that spawns isolated worker processes for each function with dynamic port allocation.

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 CLI command for starting local development server
  • Created Express-based dev server (src/dev-server/main.ts) running on port 3000 with CORS support
  • Implemented in-memory entity database using @seald-io/nedb for session-scoped storage with full CRUD operations
  • Built FunctionManager class that spawns and manages isolated Deno worker processes with automatic port allocation (starting from 4001)
  • Implemented entity API routes (/api/apps/:appId/entities) emulating Base44's entity endpoints (list, get, create, update, delete, query)
  • Created HTTP proxy layer for routing function invocations to Deno workers
  • Developed Deno runtime wrapper (deno-runtime/main.ts) that patches Deno.serve to inject dynamic ports for function isolation
  • Added integration routes for custom integrations and endpoints (placeholder implementations)
  • Updated build system (infra/build.ts) to bundle CLI and Deno runtime separately, changed CLI output to dist/cli/index.js
  • Added .base44/ to gitignore templates for both backend-and-client and backend-only project types
  • Added dependencies: express, cors, @seald-io/nedb, get-port and their TypeScript type definitions

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (bun 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

Architecture Overview:

The dev server follows a clean separation of concerns:

  • src/dev-server/ - Express server with routing logic and API emulation
  • deno-runtime/ - Deno-side wrapper that intercepts Deno.serve() calls to inject allocated ports
  • Database class - Isolated entity CRUD operations with in-memory NeDB storage
  • FunctionManager class - Function lifecycle management (spawn, port allocation, readiness detection, cleanup)

Current capabilities:

  • Loads entities and functions from project configuration at startup
  • In-memory entity operations persist for the server session
  • Each function runs in an isolated Deno process with dynamically allocated port (starting from 4001)
  • HTTP proxy routes function invocations to the correct Deno worker
  • Graceful shutdown handling cleans up all spawned processes
  • Fixed port (3000) for the dev server itself (intentional for client alignment)

Known limitations:

  • No hot-reloading for code changes (requires server restart)
  • No site/static file serving yet
  • Integration routes are placeholder implementations
  • CLAUDE.md not yet updated to document the new architecture
  • No automated tests for dev server functionality

Future enhancements:

  • Hot-reloading support for entities and functions
  • Enhanced error handling and structured logging
  • Static site serving integration
  • Frontend build workflow integration
  • Automated tests for dev server functionality

🤖 Generated by Claude | 2026-02-05 14:15 UTC

@artemdemo artemdemo changed the title Cli local dev CLI local dev Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.28-pr.195.8b03abf

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.28-pr.195.8b03abf"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.28-pr.195.8b03abf"
  }
}

Preview published to npm registry — try new features instantly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant