Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/01-command_bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ body:
description: List necessary versions here. This includes your package version, runtime version, operating system etc.
placeholder: |
- @nanoforge-dev/loader-client 1.0.0 (`npm ls @nanoforge-dev/loader-client`)
- Node.js 25.x.x (`node --version`)
- Node.js 26.x.x (`node --version`)
- TypeScript 5.9.3 (`npm ls typescript` if you use it)
- macOS Ventura 13.3.1
validations:
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
name: Install Node.js
uses: actions/setup-node@v6
with:
node-version: 25
node-version-file: .nvmrc
package-manager-cache: false
registry-url: https://registry.npmjs.org

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v25
v26
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

This repository contains the Loader of NanoForge. Check [releases][github-releases] to see versions of the Loader. NanoForge is a powerful game engine for web browsers.

The Loader is the runtime layer invoked by the [NanoForge CLI][cli-source] when you run `nf start`. It handles both sides of a NanoForge project simultaneously: the **client side** served to the browser and the **server side** running in Node.js.
The Loader is the runtime layer invoked by the [NanoForge CLI][cli-source] when you run `nf start`. It handles both sides of a NanoForge project simultaneously: the **client side** served to the browser and the **server side** running in Bun.

## Usage

Expand Down Expand Up @@ -47,7 +47,7 @@ nf start
This monorepo provides three packages, each fulfilling a distinct role at runtime.

- `loader-client` : Bun HTTP server that serves the browser loader UI and the compiled client game files. The entry point for everything the browser sees.
- `loader-server` : Node.js process that runs the compiled server game files in an isolated worker. The entry point for the server-side game logic.
- `loader-server` : Bun process that runs the compiled server game files in an isolated worker. The entry point for the server-side game logic.
- `loader-website` : Browser application bundled as a static asset. Displays the loading screen, caches game files in the browser and bootstraps the game.

### `@nanoforge-dev/loader-client`
Expand All @@ -73,7 +73,7 @@ The client loader is a Bun HTTP server that bridges the browser and the compiled

### `@nanoforge-dev/loader-server`

The server loader is a Node.js process that runs the server-side game code. It:
The server loader is a Bun process that runs the server-side game code. It:

- Scans the game server directory for compiled files
- Forks an isolated worker that requires `/main.js` and calls its exported `main()` function
Expand Down
2 changes: 1 addition & 1 deletion apps/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
},
"packageManager": "pnpm@11.5.1",
"engines": {
"node": "25"
"node": "26"
},
"publishConfig": {
"access": "public"
Expand Down
2 changes: 1 addition & 1 deletion apps/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

This package contains the Server Loader of NanoForge. It is part of the [NanoForge Loader][loader-source] monorepo. Check [releases][github-releases] to see versions. NanoForge is a powerful game engine for web browsers.

The server loader is a Node.js process that runs the server-side game code of a NanoForge project. It scans a compiled game directory, then forks an isolated worker process that loads `main.js` and calls its exported `main()` function.
The server loader is a Bun process that runs the server-side game code of a NanoForge project. It scans a compiled game directory, then forks an isolated worker process that loads `main.js` and calls its exported `main()` function.

## Usage

Expand Down
16 changes: 11 additions & 5 deletions apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,35 +44,41 @@
"funding": "https://github.com/NanoForge-dev/Loader?sponsor",
"scripts": {
"build": "pnpm run build:server && pnpm run build:worker",
"build:server": "bun build src/server.ts --outdir dist --target node",
"build:worker": "bun build src/worker.ts --outdir dist --target node",
"start": "node dist/server.js",
"build:server": "bun build src/server.ts --outdir dist --target bun",
"build:worker": "bun build src/worker.ts --outdir dist --target bun",
"start": "bun run dist/server.js",
"lint": "prettier --check . && eslint --format=pretty src",
"format": "prettier --write . && eslint --fix --format=pretty src",
"prepack": "pnpm run build && pnpm run lint",
"changelog": "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'apps/server/*'",
"release": "cliff-jumper"
},
"dependencies": {
"bun": "catalog:core",
"commander": "catalog:core"
},
"devDependencies": {
"@favware/cliff-jumper": "catalog:ci",
"@nanoforge-dev/utils-eslint-config": "catalog:lint",
"@nanoforge-dev/utils-prettier-config": "catalog:lint",
"@trivago/prettier-plugin-sort-imports": "catalog:lint",
"bun": "catalog:core",
"@types/bun": "catalog:core",
"eslint": "catalog:lint",
"prettier": "catalog:lint",
"typescript": "catalog:build"
},
"packageManager": "pnpm@11.5.1",
"engines": {
"node": "25"
"node": "26"
},
"publishConfig": {
"access": "public"
},
"pnpm": {
"allowBuilds": {
"bun": true
}
},
"lint-staged": {
"**": [
"prettier --ignore-unknown --write"
Expand Down
3 changes: 3 additions & 0 deletions apps/server/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["bun"]
},
"include": ["src/**/*.ts"],
"exclude": ["node_modules", "dist"]
}
2 changes: 1 addition & 1 deletion apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
},
"packageManager": "pnpm@11.5.1",
"engines": {
"node": "25"
"node": "26"
},
"publishConfig": {
"access": "public"
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/loader/1-overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import { Card, CardGroup } from "mintlify/components";

## What is the Loader?

The NanoForge Loader is the runtime layer that starts a NanoForge project. It is invoked by the [NanoForge CLI](https://github.com/NanoForge-dev/CLI) when you run `nf start`, and handles both sides of a game simultaneously: the **client side** delivered to the browser and the **server side** running in Node.js.
The NanoForge Loader is the runtime layer that starts a NanoForge project. It is invoked by the [NanoForge CLI](https://github.com/NanoForge-dev/CLI) when you run `nf start`, and handles both sides of a game simultaneously: the **client side** delivered to the browser and the **server side** running in Bun.

The Loader is a monorepo of three packages, each with a distinct responsibility at runtime:

- **`loader-client`** — the Bun HTTP server that serves the browser with the loader UI and the compiled game files.
- **`loader-server`** — the Node.js process that runs the compiled server game code in an isolated worker.
- **`loader-server`** — the Bun process that runs the compiled server game code in an isolated worker.
- **`loader-website`** — the browser application that displays the loading screen, caches game files locally, and bootstraps the game.

The NanoForge CLI orchestrates all three; as a game developer you never interact with these packages directly.
Expand Down Expand Up @@ -49,7 +49,7 @@ npx loader-server --dir .nanoforge/server
game files via the browser Origin Private File System, then bootstraps the game.
</Card>
<Card title="loader-server" href="./4-server">
Node.js process that runs the server-side game code in an isolated worker process. Supports
Bun process that runs the server-side game code in an isolated worker process. Supports
live-reload by restarting the worker on file changes.
</Card>
</CardGroup>
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/loader/4-server.mdx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: Server
description: Node.js process that runs the server-side game code of a NanoForge project
description: Bun process that runs the server-side game code of a NanoForge project
---

import { Tooltip } from "mintlify/components";

## Overview

`loader-server` is a Node.js process that runs the compiled server-side game code. It scans a built game directory, locates `/main.js`, then forks an isolated child process — the worker — that loads the game and calls its exported `main()` function. The parent process manages the worker lifecycle and restarts it when files change in watch mode.
`loader-server` is a Bun process that runs the compiled server-side game code. It scans a built game directory, locates `/main.js`, then forks an isolated child process — the worker — that loads the game and calls its exported `main()` function. The parent process manages the worker lifecycle and restarts it when files change in watch mode.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"packageManager": "pnpm@11.5.1",
"engines": {
"node": "25"
"node": "26"
},
"private": true,
"lint-staged": {
Expand Down
38 changes: 27 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ catalogs:
lint-staged: ^17.0.7
core:
'@types/bun': ^1.3.14
'@types/node': ^25.9.2
'@types/node': ^26.6.2
bun: ^1.3.14
commander: ^15.0.0
lint:
Expand Down
Loading