For forging your next project inside of a browser.
This project is currently just my thoughts and playing around with ideas. Honestly it doesn't work right now because i don't have the time to polish it. Here is commit fef7146 with files already created to show a demo of what i've worked on.
basic-editor.mp4
Here's the pitch, what if we had a editor in the browser that anyone could visit and just start programming. The "editor" would run on the server and use a LSP-like protocol to communicate between the client and the server using websockets. The secret sauce to the idea would be that the editor is actually a large micro-service that is calling LSP's through network calls. By deploying an editor in this way, we can distribute it across multiple machines.
A rough sketch of some of my thoughts is below.
You need to setup redis. If you don't want to start a docker container, just run the following in your terminal.
brew install redis
redis-serverYou'll also need an S3 server with the following variables defined in .env file
S3_BUCKET="forge-editor"
AWS_ACCESS_KEY_ID=""
AWS_SECRET_ACCESS_KEY=""
# Create this folder
ROOT_PROJECT_DIRECTORY="./.workspace-cache"
You'll also need to install language servers so that you can effectively.
Warning
Only javascript has been tested a lot.
# Install gopls... lol idk how to do this.
# Installing markdown LSP
brew install marksman
# Installing Rust LSP
rustup component install rust-analyzer
# Install language servers for the Web
npm i -g typescript-language-server vscode-json-languageserver npm install vscode-markdown-languageservice vscode-html-languageserver-bin vscode-css-languageservice typescriptConfigure the Rust server with one or more project workspaces. Paths in the
JSON manifest are relative to FORGE_WORKSPACES_ROOT; physical roots are never
sent to the browser. Copy .env.example and adjust it for your machine:
PORT=8080
FORGE_ENVIRONMENT_ID=local
FORGE_ENVIRONMENT_NAME="Local projects"
FORGE_WORKSPACES_ROOT=/workspaces
FORGE_WORKSPACES_JSON='[{"id":"forge-editor","name":"Forge Editor","path":"forge-editor"}]'
FORGE_DEFAULT_WORKSPACE=forge-editorMultiple workspaces require FORGE_DEFAULT_WORKSPACE. Configuration is read
once at startup. BASE_DIRECTORY remains available temporarily and creates a
single workspace named default.
Install the packages
npm iPatch for web socket support (next.js doesn't support this out of the box)
npx next-ws-cli@latest patchFirst, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun devForge supports launch-only debugging through a server-owned adapter strategy.
Add .vscode/launch.json to a configured workspace:
The program and working directory must already exist and resolve inside the workspace. JSON comments and trailing commas are accepted. Integrated terminal, attach, command/config/environment substitutions, and arbitrary adapter commands are intentionally rejected in phase 1.
Debug adapters run on the Forge server, so these are server dependencies rather than browser dependencies. Install the adapters for the languages the server is expected to debug:
launch.json type |
Languages | Required server program | Transport |
|---|---|---|---|
forge-rust |
Rust and other native binaries | lldb-dap |
stdio |
forge-go |
Go | dlv (Delve) |
loopback TCP |
forge-node |
JavaScript and TypeScript | node and the VS Code js-debug dapDebugServer.js bundle |
loopback TCP |
forge-python |
Python | python3 with the debugpy module |
stdio |
Typical development-machine installations are:
# Rust/native debugging (macOS)
brew install llvm
# Go debugging; make sure the resulting dlv binary is copied or linked into
# /usr/local/bin or another PATH directory available to the Forge service.
go install github.com/go-delve/delve/cmd/dlv@latest
# Python debugging. Use the same python3 installation visible to Forge.
python3 -m pip install debugpyFor JavaScript and TypeScript, build or install Microsoft's vscode-js-debug
adapter on the server and point Forge at its debug-server entry point:
FORGE_JS_DEBUG_SCRIPT=/opt/forge/js-debug/src/dapDebugServer.jsThe configured file must be readable by the Forge service account. Forge starts
it as node "$FORGE_JS_DEBUG_SCRIPT" <ephemeral-port> and keeps the port bound
to loopback. The browser cannot select an adapter executable or network address.
Production images should pin adapter versions in their package/image manifest
instead of using floating installers such as @latest. A missing executable,
Python module, or JavaScript adapter bundle produces a sanitized failed-session
message without exposing the server path.


{ "version": "0.2.0", "configurations": [ { "name": "Debug app", "type": "forge-rust", "request": "launch", "program": "${workspaceFolder}/target/debug/app", "cwd": "${workspaceFolder}", "args": [], "env": {}, "console": "internalConsole" } ] }