diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index b9a19b7a..ea632f5a 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -34,3 +34,7 @@ jobs:
- name: Publish @fresh/update
working-directory: ./update
run: deno publish
+
+ - name: Publish @fresh/examples
+ working-directory: ./examples
+ run: deno publish
diff --git a/examples/LICENSE b/examples/LICENSE
new file mode 100644
index 00000000..4a04b2f3
--- /dev/null
+++ b/examples/LICENSE
@@ -0,0 +1,20 @@
+MIT License
+
+Copyright (c) 2021-2024 the Deno authors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 00000000..034a78db
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,55 @@
+# Examples for Fresh
+
+This is an package contains examples for using Fresh with
+[JSR](https://jsr.io/).
+
+Learn more about the Fresh framework here:
+[https://fresh.deno.dev/](https://fresh.deno.dev/)
+
+## Usage: Island example
+
+```tsx
+import { App } from "fresh";
+// Import the island function
+import { DemoIsland } from "jsr:@fresh/examples/island";
+
+export const app = new App({ root: import.meta.url })
+ .use(staticFiles());
+
+// Register the island
+app.island(
+ // Module specifier for esbuild, could also be a file path
+ "jsr:@fresh/examples/island",
+ // Name of the island
+ "DemoIsland",
+ // Island component function
+ DemoIsland,
+);
+
+// Use the island somewhere in your components
+app.get("/", (ctx) => ctx.render());
+
+await app.listen();
+```
+
+## Usage: App1 or App2 example
+
+```tsx
+import { App } from "fresh";
+// Import the example apps
+import { app1 } from "jsr:@fresh/examples/app1";
+import { app2 } from "jsr:@fresh/examples/app2";
+
+export const app = new App({ root: import.meta.url })
+ .use(staticFiles());
+
+// Merge apps from JSR into this one
+app.mountApp("/app1", app1);
+app.mountApp("/app2", app1);
+
+await app.listen();
+```
+
+## License
+
+MIT, see the [LICENSE](./LICENSE) file.
diff --git a/examples/deno.json b/examples/deno.json
new file mode 100644
index 00000000..5c46f02b
--- /dev/null
+++ b/examples/deno.json
@@ -0,0 +1,18 @@
+{
+ "name": "@fresh/examples",
+ "version": "1.0.0",
+ "exports": {
+ "./island": "./src/island.tsx",
+ "./app1": "./src/app1.tsx",
+ "./app2": "./src/app2.tsx"
+ },
+ "imports": {
+ "@preact/signals": "npm:@preact/signals@^1.2.3",
+ "preact": "npm:preact@^10.22.0",
+ "fresh": "jsr:@fresh/core@^2.0.0-alpha.18"
+ },
+ "compilerOptions": {
+ "jsx": "react-jsx",
+ "jsxImportSource": "preact"
+ }
+}
diff --git a/examples/deno.lock b/examples/deno.lock
new file mode 100644
index 00000000..9d741063
--- /dev/null
+++ b/examples/deno.lock
@@ -0,0 +1,96 @@
+{
+ "version": "3",
+ "packages": {
+ "specifiers": {
+ "jsr:@fresh/core@^2.0.0-alpha.18": "jsr:@fresh/core@2.0.0-alpha.18",
+ "jsr:@std/assert@^0.226.0": "jsr:@std/assert@0.226.0",
+ "jsr:@std/encoding@^1.0.0-rc.1": "jsr:@std/encoding@1.0.0-rc.2",
+ "jsr:@std/fmt@^0.225.3": "jsr:@std/fmt@0.225.4",
+ "jsr:@std/fs@^0.229.1": "jsr:@std/fs@0.229.3",
+ "jsr:@std/html@^0.224.2": "jsr:@std/html@0.224.2",
+ "jsr:@std/media-types@^1.0.0-rc.1": "jsr:@std/media-types@1.0.0",
+ "jsr:@std/path@1.0.0-rc.1": "jsr:@std/path@1.0.0-rc.1",
+ "jsr:@std/path@^0.225.2": "jsr:@std/path@0.225.2",
+ "npm:@preact/signals@^1.2.3": "npm:@preact/signals@1.2.3_preact@10.22.0",
+ "npm:preact-render-to-string@^6.4.2": "npm:preact-render-to-string@6.5.3_preact@10.22.0",
+ "npm:preact@^10.22.0": "npm:preact@10.22.0"
+ },
+ "jsr": {
+ "@fresh/core@2.0.0-alpha.18": {
+ "integrity": "94a8d31ba6571cfad60dc676a3cfe0d053932cb3173675b915f2db5bbf65c08f",
+ "dependencies": [
+ "jsr:@std/encoding@^1.0.0-rc.1",
+ "jsr:@std/fmt@^0.225.3",
+ "jsr:@std/fs@^0.229.1",
+ "jsr:@std/html@^0.224.2",
+ "jsr:@std/media-types@^1.0.0-rc.1",
+ "jsr:@std/path@^0.225.2",
+ "npm:@preact/signals@^1.2.3",
+ "npm:preact-render-to-string@^6.4.2",
+ "npm:preact@^10.22.0"
+ ]
+ },
+ "@std/assert@0.226.0": {
+ "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3"
+ },
+ "@std/encoding@1.0.0-rc.2": {
+ "integrity": "160d7674a20ebfbccdf610b3801fee91cf6e42d1c106dd46bbaf46e395cd35ef"
+ },
+ "@std/fmt@0.225.4": {
+ "integrity": "584c681cf422b70e28959b57e59012823609c087384cbf12d05f67814797fda3"
+ },
+ "@std/fs@0.229.3": {
+ "integrity": "783bca21f24da92e04c3893c9e79653227ab016c48e96b3078377ebd5222e6eb",
+ "dependencies": [
+ "jsr:@std/path@1.0.0-rc.1"
+ ]
+ },
+ "@std/html@0.224.2": {
+ "integrity": "2f7bfd71081fad988af9ce991750ed1574917dc8e6fae0e151987ea020d1e21a"
+ },
+ "@std/media-types@1.0.0": {
+ "integrity": "58ff81ce1f7af8c46304a52482db804c42936492daad19c0bd5d887832737d2b"
+ },
+ "@std/path@0.225.2": {
+ "integrity": "0f2db41d36b50ef048dcb0399aac720a5348638dd3cb5bf80685bf2a745aa506",
+ "dependencies": [
+ "jsr:@std/assert@^0.226.0"
+ ]
+ },
+ "@std/path@1.0.0-rc.1": {
+ "integrity": "b8c00ae2f19106a6bb7cbf1ab9be52aa70de1605daeb2dbdc4f87a7cbaf10ff6"
+ }
+ },
+ "npm": {
+ "@preact/signals-core@1.6.0": {
+ "integrity": "sha512-O/XGxwP85h1F7+ouqTMOIZ3+V1whfaV9ToIVcuyGriD4JkSD00cQo54BKdqjvBJxbenvp7ynfqRHEwI6e+NIhw==",
+ "dependencies": {}
+ },
+ "@preact/signals@1.2.3_preact@10.22.0": {
+ "integrity": "sha512-M2DXse3Wi8HwjI1d2vQWOLJ3lHogvqTsJYvl4ofXRXgMFQzJ7kmlZvlt5i8x5S5VwgZu0ghru4HkLqOoFfU2JQ==",
+ "dependencies": {
+ "@preact/signals-core": "@preact/signals-core@1.6.0",
+ "preact": "preact@10.22.0"
+ }
+ },
+ "preact-render-to-string@6.5.3_preact@10.22.0": {
+ "integrity": "sha512-TWRSivNYMB3DMcFvrhwdGFkfSvPhUkd5r1q5q+1oQA21wnfEaxJe2X5U1BqLsuOA/v79sFRkg+qSeDkMHOqdvQ==",
+ "dependencies": {
+ "preact": "preact@10.22.0"
+ }
+ },
+ "preact@10.22.0": {
+ "integrity": "sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==",
+ "dependencies": {}
+ }
+ }
+ },
+ "remote": {},
+ "workspace": {
+ "dependencies": [
+ "jsr:@fresh/core@^2.0.0-alpha.18",
+ "npm:@preact/signals@^1.2.3",
+ "npm:preact@^10.22.0"
+ ]
+ }
+}
diff --git a/examples/src/app1.tsx b/examples/src/app1.tsx
new file mode 100644
index 00000000..f0f7525b
--- /dev/null
+++ b/examples/src/app1.tsx
@@ -0,0 +1,11 @@
+import { App } from "fresh";
+import { Doc } from "./shared.tsx";
+
+export const app1 = new App()
+ .get("/", (ctx) =>
+ ctx.render(
+
+ App1
+ This app is loaded from JSR
+ ,
+ ));
diff --git a/examples/src/app2.tsx b/examples/src/app2.tsx
new file mode 100644
index 00000000..0829c988
--- /dev/null
+++ b/examples/src/app2.tsx
@@ -0,0 +1,11 @@
+import { App } from "fresh";
+import { Doc } from "./shared.tsx";
+
+export const app2 = new App()
+ .get("/", (ctx) =>
+ ctx.render(
+
+ App2
+ This app is loaded from JSR
+ ,
+ ));
diff --git a/examples/src/island.tsx b/examples/src/island.tsx
new file mode 100644
index 00000000..4996b99b
--- /dev/null
+++ b/examples/src/island.tsx
@@ -0,0 +1,13 @@
+import { useSignal } from "@preact/signals";
+
+export default function DemoIsland() {
+ const count = useSignal(0);
+
+ return (
+
+
+
{count}
+
+
+ );
+}
diff --git a/examples/src/shared.tsx b/examples/src/shared.tsx
new file mode 100644
index 00000000..41acad98
--- /dev/null
+++ b/examples/src/shared.tsx
@@ -0,0 +1,13 @@
+import type { ComponentChildren } from "preact";
+
+export function Doc(props: { children?: ComponentChildren }) {
+ return (
+
+
+
+ Fresh Examples
+
+ {props.children}
+
+ );
+}