Version 2 of Redbean is available, a single file web server that runs on any x86-64 operating system, with new APIs, code completion, and more.


Justine Tunney, developer of Redbean, recently released the latest version (Redbean 2.0) of the web server. Redbean 2.0 introduces a new Actually Portable Executable (APE) loader that allows the server to run without changing headers, thus allowing it to run in memory. If the APE is not installed on the system, the shell script header automatically extracts the APE. Other new features in Redbean 2.0 include a Read Eval Print Loop (REPL) based on the “bestline” library, code completion using the Tab key, support for GNU Emacs compatible keyboard shortcuts, and many other new features.

Redbean is a single file web server that runs on any x86-64 operating system (GNU / Linux, macOS, Windows, FreeBSD, OpenBSD and NetBSD). Allows the sharing of web applications that work offline as a single file zip archive containing your assets. You just have to download the “” program, change the file name to .zip, add the content to a zip editor tool, then change the extension to .com. A proxy is not required as is the case with the nginx server; Redbean is vertically integrated.

According to the developer, Redbean can serve more than 1 million gzip-coded responses per second on a cheap personal computer. Tunney believes that with the release of Redbean 2.0, the project is no longer just a hobby. Over the past year, we’ve made Redbean more of a hobby project, “said the developer. Below are the new features in Redbean 2.0.

New APE charger

Redbean uses a hack called “APE” (Actually Portable Executable). The idea is this: whatever programming language you use, if you compile your code in native binary, it produces x86-64 machine code – and any x86-64 processor executes the same machine code. If you’re writing a program that doesn’t call any external code, in principle the only difference between a Windows binary and (say) a Linux binary is the format of the file that contains the binary. So, if you could solve this problem, your program could run on any operating system.

APE files are, as the name suggests, truly portable executables. A single APE file works fine on any x86-64 operating system. When the file is run on Windows it behaves like a Windows executable and when you run it on macOS it behaves like a macOS executable. When run on Linux, it is a Linux binary and it is the same on FreeBSD, OpenBSD, NetBSD, even though they all have their own different executable formats. However, almost all real programs must call a library, even the standard C library.

This is where the “Cosmopolitan” or Cosmo library comes into play. Thanks to the Cosmo library, C programs can be compiled and run on any operating system supported by the APE loader. Redbean 2.0 introduces a new APE loader that allows the server to function without having to automatically change the header. send order ape will then place your redbean (server) in memory with mmmap (). If the APE is not installed on a system, the shell script header will automatically extract it. There is support shebang and a support binfmt_misc even on Linux.

Tunney says these changes are expected to have a positive impact on distributions and build systems, which have struggled to package and distribute the APE software. For users who want the original behavior, a flag –assimilate is introduced which will turn your redbean into a ELF Where is it Mach-O local the platform.


Redbean 2.0 introduces a Read Eval Print Loop or REPL (Read Eval Print Loop) for short. It is built on the “bestline” library, as it provides nearly parity with GNU Readline in terms of functionality, except it is licensed under MIT rather than LGPL, so no dynamic linking is required. Redbean can’t dynamically link things, because in that case it wouldn’t be a single file. Tunney said he worked hard on creating bestline, a fork of “linenoise”, for this very reason.

Monkeys Patch

One of the use cases for a REPL on a live web server is the ability to patch code while the server is running. Redbean is a forked web server. This means that the main process behaves like a master model from which the worker processes are cloned. So anything you edit in the REPL lazily propagates through client connections as new connections are created, without affecting currently active connections. Other noteworthy features of this version are:

  • code completion: Redbean 2.0 introduces code completion. As with Bash, you can press Tab to see a list of all available functions and global objects. If you press unix.then you will see all the objects and functions available in the Unix module;
  • GNU Emacs key bindings: GNU Emacs users will be pleased to know that your redbean REPL supports almost all common GNU-style key combinations, including CTRL-R for reverse search;
  • Unix Module: Redbean 2.0 introduces a new Unix module implemented in instrument / network / lunix.c ;
  • Recording support: Redbean 2.0 introduces optional system call recording;
  • Lua Enhancements: Redbean 2.0 brings improvements to the Lua language that are intended to help C / C ++ and Python developers feel more comfortable;
  • New API: Redbean 2.0 introduces the following native functions: EncodeJson, EncodeLua, Compress, Dcompress, GetMonospaceWidth, ProgramMaxPayloadSize, ProgramSslRequired, ProgramSslClientVerify, MeasureEntropy, Decimate, Benchmark, Rdtsc, Lemur64, Rand64, Rdrand, GetCuCount, RdpuCount, RdpuCount , hex, bin;
  • redbean 2.0 adds support for modern password hashing;
  • Bug Fixes: This release includes many fixes upstream of the Cosmo library. The quality of Windows platform support has been significantly improved. For instance, fork() it now works well enough on Windows that this version enables it by default. Several other Windows bugs that prevented Redbean from responding to CTRL-C interrupts have also been fixed.

Source: Redbean 2.0

And she ?

What is your opinion on the subject?

What do you think of the Redbean web server?

What do you think of the new features of Redbean 2.0?

See also

Caddy, the only web server that uses HTTPS automatically and by default, written in the Go language

JDK 18: New features in Java 18 include vector API, minimal web server, and adopting UTF-8 as the default character set

2022 WebAssembly Development Status Report Reveals Rust is the Most Used and Researched Language, and Web Applications are the Primary Use Case

Fresh, a next-generation web framework, built for speed, reliability and simplicity, brings some competition to Next.js


Leave a Comment