# Jupyterlite server extension development

**URL:** <https://discourse.jupyter.org/t/jupyterlite-server-extension-development/21841>\
**Category:** extensions\
**Tags:** jupyterlite\
**Created:** [October 10, 2023, 5:58pm UTC](https://discourse.jupyter.org/t/jupyterlite-server-extension-development/21841 "2023-10-10T17:58:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThibautDR](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/thibautdr/32/13005_2.png) [@ThibautDR](https://discourse.jupyter.org/u/ThibautDR)\
**Post date:** [October 10, 2023, 5:58pm UTC](https://discourse.jupyter.org/t/jupyterlite-server-extension-development/21841/1 "2023-10-10T17:58:04Z")

</div>

Hello again Jupyter community,

I am developing an extension that I intend to use with Jupyterlite. Now comes the time for me to build the “server” extension piece. Of course I read [the documentation](https://jupyterlite.readthedocs.io/en/stable/howto/extensions/server.html) about developing server extensions for Jupyterlite.

The documentation states that Jupyterlite uses the same plugin architecture. What I would like to know are the differences. What is possible and not possible? I know some extensions are not compatible with Jupyterlite. Is it mostly due to the Python packages available for Pyodide or because of the architecture of the extension itself? What should we keep in mind when developing server extensions compatible with Jupyterlite?

As a subsidiary question, are there any basic server extension example for Jupyterlite that I could start from? I tried the [cookiecutter template](https://github.com/jupyterlite/serverlite-cookiecutter-ts), but I found it very limited.

Thank you in advance, any insights would be appreciated 🙂

Thibaut

---

<div class="post-metadata">

**Author:** ![bollwyvl](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/bollwyvl/32/904_2.png) [@bollwyvl](https://discourse.jupyter.org/u/bollwyvl)\
**Post date:** [October 10, 2023, 6:34pm UTC](https://discourse.jupyter.org/t/jupyterlite-server-extension-development/21841/2 "2023-10-10T18:34:24Z")

</div>

> Jupyterlite uses the same plugin architecture

… as the _JupyterLab client application_, not `jupyter_server`, `jupyverse`, or any other CPython-based HTTP server implementation. The [“server”](https://github.com/jupyterlite/jupyterlite/blob/042070a9cd2a5fed2d6f1e9ccebe54ed94cea586/packages/server/src/app.ts#L52) is a [`@lumino/application:Application`](https://lumino.readthedocs.io/en/latest/api/classes/application.Application-1.html), which supports dependency injection via `Token` injection with `provides`, `requires` and `optional`.

It answers the subset of the [Jupyter Server REST API + WebSockets](https://jupyter-server.readthedocs.io/en/latest/developers/rest-api.html) and is _probably_ under 100kb on the wire (a bit hard to tell, due to the way the WebPack bundling works).

At present, blocking to wait for a `emscripten` machine (or other WASM approach) to start up, then fill in with ~Xmb of a WASM-compiled runtime (like python), then ~XXmb of web server dependencies (many of which wouldn’t work in the browser, if they were re-compiled) before the first request for e.g. contents, settings, etc. can be drawn has [been](https://github.com/jupyterlite/jupyterlite/issues/779) [discussed](https://github.com/jupyterlite/jupyterlite/issues/1149), but would likely not land in `jupyterlite-core` any time soon.

A lite server _extension_, as implemented in the cookiecutter, _could_ choose to lazily create an emscripten machine (or a remote machine, presumably), without destroying the first-load experience, and even `provide` that underlying machine it to other lite server extensions to `require`.

---

<div class="post-metadata">

**Author:** ![ThibautDR](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/thibautdr/32/13005_2.png) [@ThibautDR](https://discourse.jupyter.org/u/ThibautDR)\
**Post date:** [October 10, 2023, 7:24pm UTC](https://discourse.jupyter.org/t/jupyterlite-server-extension-development/21841/3 "2023-10-10T19:24:38Z")

</div>

@bollwyvl Thank you for the explanation and documented reply.

I wrongly thought some pieces of jupyter\_server were running in the browser but now I understand why it’s not possible and even wouldn’t work.
