Building a Retro Desktop OS in the Browser with Plain JS
Most small web projects begin with a framework, a bundler and a few hundred packages before the first line of real logic exists. I wanted to see how far I could get without any of that. The result is IROS 98.10 LTS, codenamed "Retro Raccoon": a browser-based desktop operating system with the look of a 90s desktop and the behaviour of an Ubuntu machine. It has no build step and no dependencies. You open index.html and it runs.
In this article I explain what it does, how the code is organised, and what I took away from building a window manager, a file system and a shell in plain JavaScript, HTML and CSS.
Why I built it
I wanted a project that forced me to solve problems a framework usually hides: how windows stack and resize, how state survives a reload, how a shell parses a command line. Building an operating system metaphor in the browser touches all of those, and each piece is small enough to finish on its own.
I also wanted two aesthetics in one place. The classic beveled desktop of the late 90s and the Ubuntu workflow (terminal, package manager, workspaces, an Activities overview) are very different, and making them coexist was a good design constraint.
What it does
The boot sequence runs through a BIOS screen, GRUB and systemd messages, then a splash screen and a log-on dialog. You can click or press any key to skip it, and any user name and password will log you in. Shutting down ends with the message "It is now safe to turn off your computer".
The classic desktop
- Beveled windows you can drag, resize, minimize and maximize
- A taskbar, a Start menu with submenus and a Run dialog
- Desktop icons and right-click context menus
- Shut Down, Restart and Log Off
- Session restore: open windows (position, size, workspace, minimized or maximized state), the files and folders they show, and the wallpaper are saved in
localStorageand return after a reload
The Ubuntu side
- A Terminal with an aubergine background and a bash-like shell supporting pipes,
>,>>and<redirection,&&,||,;, variables, wildcards, aliases, Tab completion, history and shell scripts run withbash file.sh sudoandapt, for examplesudo apt install neofetch cowsay fortune sl, plusapt list,search,show,removeandupdate- "Command not found, but can be installed with..." hints, as on a real Ubuntu system
- A Software Center for installing and removing apps and terminal tools
- An Activities overview (Ctrl+Space, or tap Super) to search apps, files and commands and to switch workspaces
- Four workspaces, reachable from tray buttons, Ctrl+Alt+Left/Right, or by right-clicking a taskbar button to move a window
- Notification toasts and a calendar popup
The built-in apps are File Manager (with Trash and restore), Text Editor, Terminal, Calculator, Settings and Help, plus the Software Center. Four more can be installed: IR Paint, Mines, System Monitor and Clock. Settings offers three themes (IROS Classic, Aubergine and Midnight), seven wallpapers, a user name, sound options and a factory reset.
How it works
The stack is JavaScript, CSS and HTML, with no build tooling. Each file has one job, which keeps the whole thing readable:
index.htmlholds the shell markupcss/iros.cssholds the themes and all stylingjs/core.jshas helpers, settings, an event bus, sounds and wallpapersjs/vfs.jsis the virtual file systemjs/ui.jscovers menus, dialogs and notificationsjs/wm.jsis the window manager and workspacesjs/apps.jsis the app registry, the packages and the GUI appsjs/terminal.jsis the shell and its commands, including aptjs/main.jshandles boot, login, the desktop, taskbar, Start menu, Activities and power
A shared core and an event bus
Putting settings and an event bus in core.js lets the other modules stay decoupled. The window manager does not need to know about the taskbar; it announces that something changed and the taskbar reacts. This is a reusable pattern for any vanilla JavaScript app that grows beyond a single file.
A virtual file system as the single source of truth
The file system in vfs.js is used by both the File Manager and the terminal. When you run echo hi > note.txt in the shell, the file shows up in the GUI, and the Text Editor can open it. Sharing one data layer between very different front ends is what makes the system feel coherent rather than like a set of separate demos.
Persistence with localStorage
Files, settings, installed packages and terminal history are stored in the browser's localStorage. Session restore extends this to the window layout. Because everything is local, there is no server component, and Settings then Reset returns the system to its factory state.
Packages as a registry
The Software Center and apt are two interfaces to the same package registry in apps.js. Installing a package from either place changes the same state, so installing Mines in the terminal makes it appear in the Software Center. The same registry makes the "command not found" hint possible, since the shell can look up which package provides a command.
What I learned
- Modules by responsibility scale well without a framework. Splitting by job (windows, files, UI chrome, shell) kept each file understandable.
- One data layer, several views. Making the terminal and the File Manager share a file system removed a whole class of synchronisation problems.
- Persist structure, not just data. Saving window position, size, workspace and minimized state is what makes a reload feel like resuming rather than restarting.
- Small details sell the illusion. The boot sequence, the apt hints and the final shutdown message take little code but change how the whole project feels.
- Shells are mostly parsing. Pipes, redirection,
&&,||and;are manageable if you treat a command line as a small grammar rather than a string to split.
Try it
You can run it here: https://iros-98.vercel.app. Skip the boot screen, log in with any name, then press Ctrl+Alt+T to open a terminal and try sudo apt install cowsay. Press Ctrl+Space for the Activities overview, and use Alt+W to close the active window.
Conclusion
IROS 98 is a side project, but it was a useful reminder of how much the browser provides on its own. With a clear file layout, a shared event bus and a single file system, a desktop environment fits in a handful of plain files. If you want to understand windowing, shells or persistence, building a small version yourself is a good way to learn them.