Installing BWEB
BWEB ships in the BSPK Tools component, which bundles every BSPOKE tool: BWEB, the ATL, code and method execution, the JSON object editor. Installation happens in two stages: 4D loads the component as a dependency of your project, then the component's wizard installs BWEB into your database.
Before you start
- 4D 21. The component is built for 4D 21: its version number starts with 4D's (for instance
21.6.85). - A 4D project, new or existing, opened locally and not compiled: the wizard refuses to run otherwise.
- Internet access on first start: 4D downloads the component and its own dependencies from GitHub, then keeps them in cache.
- Node.js: BWEB needs it to build its stylesheets. If it is missing, the wizard offers to install it.
1. Declare the component
The component is published on GitHub, in the public bspoke-dev/BSPK-Tools repository, where every version is listed. You declare it as a dependency of your project, from 4D:
- Menu Design > Project Dependencies.
- Click the + button at the bottom of the window, then choose the GitHub tab.
- Enter the repository path:
bspoke-dev/BSPK-Tools. - Choose Exact Version (Tag) with a tag such as
21.6.85: you decide when to move to the next version. Click Add. - The dependency is listed as Available after restart: restart 4D.
On restart, the component is downloaded, and it pulls the official 4D components it needs by itself: there is nothing else to declare. The dependencies window then lists BSPK Tools with its version, next to 4D NetKit, 4D Progress, 4D SVG and 4D Widgets.
The window only writes the project's Project/Sources/dependencies.json file. You can also declare the component there directly:
{
"dependencies": {
"BSPK Tools": {
"github": "bspoke-dev/BSPK-Tools",
"tag": "21.6.85"
}
}
}
What about the
Componentsfolder? Copying the component into the project'sComponentsfolder, as with older versions, still works. A dependency is nevertheless the recommended method: it is the 4D standard, and moving to a new version is done from the dependencies window, without handling any folder.
2. Run the wizard
Run the _BSPK_LAUNCH method. It opens the component's launcher, which gives access to every tool. Click BWEB. As long as BWEB is not installed, the launcher first shows Before installing: the list of the changes the installation will make to your database, based on its current state. Read it, then click I have read these changes and I accept them. Accept the licence, then click Start installation.
The wizard lists its steps and ticks them as it goes. They fall into these groups:
- Environment: prerequisite check, Node.js and npm installation if needed, libraries, and stylesheet build.
- Web server: 4D web server configuration and SSL certificate installation. The wizard asks for your
cert.pemandkey.pemfiles; you can continue without them for a local trial. - Files and methods: the web folder, configuration files and
BSPH_*methods are copied into your project; the On Startup, On Web Connection and On Exit database methods (and their server counterparts) are modified. The existing code of On Web Connection is commented out, line by line; some of the added lines, including the toolbar one, are commented out too: see The launcher, startup and the toolbar. - Structure: the
BSPK_*tables are created, with their relations and indexes. Your application restarts at this step: that is expected, and installation resumes on its own. - First domain: the wizard asks for the name of your first site, then offers to add it to the machine's
hostsfile so that it answers locally. Changing thehostsfile requires administrator rights. If you decline, or if the change fails, the step shows an error; on failure, a message gives the line to add yourself.
The
BSPK_*tables added to your structure belong to BWEB: do not delete or rename them.
The installation also copies parameter file templates, including
DEV_PARAMETERS: a fresh installation therefore starts in DEV mode. On a production server, deleteDEV_PARAMETERSandPREPROD_PARAMETERS.
Installing BWEB in a database that already serves web pages
The Before installing screen details these changes for your database. In short:
- On Web Connection: its code is commented out, line by line, under a dated line, and replaced by the call to BWEB. The routes it handled stop answering until you move them to the
BSPH_WEB_ON_CONNECTIONmethod, which BWEB calls on every request. It receives the client's IP address:$vo_Param.vt_Browser_IP, andvt_ClientIp, the real address behind a declared proxy. To handle a request yourself, send the response (WEB SEND TEXT…) and returnTrue; returnFalse, or nothing, to let BWEB handle it. - Web settings: the HTML root becomes
./bweband the session mode becomes 1. Pages served from the former root are no longer served. - Privileges:
roles.jsonis replaced; the original is kept inroles.json.backup. - .gitignore: if there is one, it is completed (parameter files, installation state,
bweb_dependencies, generated CSS, certificates). It is never created. - Compilation: a
Compiler_BSPHmethod is added. It declares the variables of theBSPH_*methods for databases whose compilation requires every variable to be declared inCompiler_methods.
There is no uninstall: these changes stay in place if you remove the component.
3. Check
At the end, click Test BWEB in the launcher: your browser opens your domain's administration, at https://<your domain>/bweb. If you continued without a certificate, or with a self-signed one, the browser shows a security warning: you can proceed for a local trial.
If the login page appears, BWEB is installed.
What next
- To understand what you just installed: The data model.
- To build right away: the Quick Start, in the menu, walks you through a complete blog.
- For the page editing tool: The dev panel.
- To turn on the 4D toolbar and understand the lines added to your database methods: The launcher, startup and the toolbar.
- To configure the mail server, the licence and the rest: Parameter files.

