Skip to content

browserpod: Document the edge and fetch networks - #512

Open
yuri91 wants to merge 1 commit into
mainfrom
browserpod-networks
Open

yuri91 wants to merge 1 commit into
mainfrom
browserpod-networks

Conversation

@yuri91

@yuri91 yuri91 commented Nov 2, 2026

Copy link
Copy Markdown
Member

A Networking page explains the two networks a Pod can boot on and how they
differ. The reference covers createEdgeNetwork, createFetchNetwork,
opinionatedFetch, and boot's optional apiKey and new network option.

Add the changelog for version 3.5.0.

A Networking page explains the two networks a Pod can boot on and how they
differ. The reference covers createEdgeNetwork, createFetchNetwork,
opinionatedFetch, and boot's optional apiKey and new network option.

Add the changelog for version 3.5.0.
@yuri91
yuri91 requested a review from GabrielaReyna as a code owner November 2, 2026 15:14
@yuri91
yuri91 requested a review from codingfrog27 November 2, 2026 15:15
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying labs-browserpod-previews with  Cloudflare Pages  Cloudflare Pages

Latest commit: f12e7de
Status: ✅  Deploy successful!
Preview URL: https://cabf1206.labs-browserpod-previews.pages.dev
Branch Preview URL: https://browserpod-networks.labs-browserpod-previews.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying labs-cheerpj-previews with  Cloudflare Pages  Cloudflare Pages

Latest commit: f12e7de
Status: ✅  Deploy successful!
Preview URL: https://8494d69e.labs-cheerpj-previews.pages.dev
Branch Preview URL: https://browserpod-networks.labs-cheerpj-previews.pages.dev

View logs

@GabrielaReyna GabrielaReyna left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Yuri, thanks for your PR :)

A couple of things besides the comments left in the code:

  • BP_LATEST in packages/astro-theme/replace-variables.ts is still 3.4.0. Should this be updated too?

Some Nits:

  • The methods in the reference folder are alphabetical after boot, but the new files are numbered 09–11 so they appear after run in the sidebar. Worth renumbering to keep the order?
  • Those same two “custom handler” examples create network but never boot a Pod, unlike every other example on the pages. Minor, but nice to have for consistency.


## Options

- **fetch (`function`, _optional_)** - A custom fetch function to handle outgoing requests. Defaults to the browser's global [`fetch`]. The custom handler receives the browser's default implementation as `init.defaultFetch`, allowing you to inspect, modify, or proxy requests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **fetch (`function`, _optional_)** - A custom fetch function to handle outgoing requests. Defaults to the browser's global [`fetch`]. The custom handler receives the browser's default implementation as `init.defaultFetch`, allowing you to inspect, modify, or proxy requests.
- **fetch (`function`, _optional_)** - A custom fetch function to handle outgoing requests. Defaults to the browser's global [`fetch()`][fetch]. The custom handler receives the browser's default implementation as `init.defaultFetch`, allowing you to inspect, modify, or proxy requests.

Comment on lines +8 to +9
Pods can also boot without an API key on a **fetch network**, which routes network requests directly through your browser using `fetch()`. An API key is only required when booting on an **edge network**, which enables [Portals](/docs/understanding-browserpod/portals) and allows connections to external services without browser CORS restrictions. See [Networking](/docs/understanding-browserpod/networking) for details.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FAQ page still answers “Do I need an API key?” with a flat “Yes” (14-more/01-FAQ.md:16). The same for 01-quickstart.md:10
Could we update it in this PR so it doesn’t contradict the new Networking page?

Comment on lines +15 to +21
```js
// Edge network: pass an API key
const pod = await BrowserPod.boot({ apiKey: "your_key_here" });

// Fetch network: omit the API key
const pod = await BrowserPod.boot({});
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines are in one block, so copy-pasting it fails with “Identifier ‘pod’ has already been declared”. Could we split them into two code blocks?

| ----------------------------------------------------- | --------------------------------- | --------------------------- |
| **API key** | Required | Not required |
| **Token cost** | 10 tokens per boot | Free (0 tokens) |
| **Outgoing HTTP, HTTPS, WebSockets** | To any domain allowed by your key | To origins that permit CORS |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused here. Just trying to understand this correctly:
This row lists WebSockets for both networks, but createFetchNetwork describes it as HTTP/HTTPS only, and fetch() can’t open a WebSocket. Should the fetch column here say “Not supported” for WebSockets, or split the row? Please correct me if I am wrong.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it's confusing as written. I propose to just remove this table, but we also need to explain somewhere that websockets do work.
How:
the fetch() implementation that the user provides can return something like:

  return new Response(null, {
    status: 101,
    webSocket,
  });

This is the same API of cloudflare workers, so maybe we can point to that: https://developers.cloudflare.com/workers/examples/websockets/

it's also an advanced feature since our default fetch will do this automatically


A [Pod](/docs/reference/BrowserPod) connects to the internet using one of two network types:

- **Edge network:** Routes network traffic through BrowserPod's edge proxy servers. This requires an [API key](/docs/understanding-browserpod/api-key) and deducts tokens, but allows outgoing connections to any domain allowed by your key and enables public access to servers via [Portals](/docs/understanding-browserpod/portals).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Edge network:** Routes network traffic through BrowserPod's edge proxy servers. This requires an [API key](/docs/understanding-browserpod/api-key) and deducts tokens, but allows outgoing connections to any domain allowed by your key and enables public access to servers via [Portals](/docs/understanding-browserpod/portals).
- **Edge network:** Routes network traffic through BrowserPod's edge proxy servers. This requires an [API key](/docs/understanding-browserpod/api-key) and deducts tokens, but allows outgoing connections to any domain permitted by your key and enables public access to servers via [Portals](/docs/understanding-browserpod/portals).

const pod = await BrowserPod.boot({ network });
```

## Custom fetch handler

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Custom fetch handler
### Custom fetch handler

@yuri91

yuri91 commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

BP_LATEST should be updated to 3.5.0 yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants