Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ body {
background: var(--background);
color: var(--foreground);
font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
Oxygen, Ubuntu, Cantarell, sans-serif;
font-family:
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
Cantarell, sans-serif;
}

a {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use strict";
var mq = window.matchMedia("(prefers-color-scheme: dark)");
const mq = globalThis.window.matchMedia("(prefers-color-scheme: dark)");
document.body.classList.add(mq.matches ? "dark" : "light");
mq.addEventListener("change", function (e) {
document.body.classList.remove("light", "dark");
Expand Down
8 changes: 1 addition & 7 deletions deno.lock

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

5 changes: 5 additions & 0 deletions examples/nuxt/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
dist
.output
.nuxt
.data
45 changes: 45 additions & 0 deletions examples/nuxt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!-- deno-fmt-ignore-file -->

Fedify-Nuxt integration example application
===========================================

A comprehensive example of building a federated server application using
[Fedify] with [Nuxt]. This example demonstrates how to create an
ActivityPub-compatible federated social media server that can interact with
other federated platforms like [Mastodon], [Misskey], and other ActivityPub
implementations using the Fedify and [Nuxt].

[Fedify]: https://fedify.dev
[Nuxt]: https://nuxt.com/
[Mastodon]: https://mastodon.social/
[Misskey]: https://misskey.io/


Running the example
-------------------

~~~~ sh
pnpm dev
~~~~


Communicate with other federated servers
----------------------------------------

1. Tunnel your local server to the internet using `fedify tunnel`

~~~~ sh
fedify tunnel 3000
~~~~

2. Open the tunneled URL in your browser and check that the server is running
properly.

3. Search your handle and follow from other federated servers such as
[Mastodon] or [Misskey].

> [!NOTE]
> [ActivityPub Academy] is a great resource to learn how to interact
> with other federated servers using ActivityPub protocol.

[ActivityPub Academy]: https://www.activitypub.academy/
13 changes: 13 additions & 0 deletions examples/nuxt/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<NuxtPage />
</template>

<script setup lang="ts">
useHead({
link: [
{ rel: "stylesheet", href: "/style.css" },
{ rel: "icon", type: "image/svg+xml", href: "/fedify-logo.svg" },
],
script: [{ src: "/theme.js" }],
});
</script>
7 changes: 7 additions & 0 deletions examples/nuxt/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default defineNuxtConfig({
modules: ["@fedify/nuxt"],
fedify: { federationModule: "#server/federation" },
ssr: true,
devServer: { host: "0.0.0.0" },
vite: { server: { allowedHosts: true } },
Comment on lines +5 to +6
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Confirm devServer.host: "0.0.0.0" and vite.server.allowedHosts: true are only intended for this demo.

Binding the dev server to all interfaces and disabling Vite's host-header allow-list is useful for tunneling (e.g., pinggy/localtunnel) during local federation testing, but it turns off a defence against DNS-rebinding-style attacks on the dev server. Since the test runner uses pnpm start against the built Nitro output (not the Vite dev server), this only affects developers running nuxt dev. Consider a brief comment in the config noting these options are intentional for tunnel-based federation demos and not recommended defaults for general Nuxt projects, so consumers who copy this file don't propagate the looser settings.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/nuxt/nuxt.config.ts` around lines 5 - 6, Add a short inline comment
above the devServer and vite.server settings (devServer.host and
vite.server.allowedHosts) explaining these loosened options are intentional for
this demo to support tunneling/local federation testing (e.g.,
pinggy/localtunnel) and are not recommended for general Nuxt projects; keep the
existing settings unchanged for the demo but clearly warn consumers copying the
file to remove or tighten them for production or normal development.

});
27 changes: 27 additions & 0 deletions examples/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "nuxt-example",
"version": "0.0.1",
"private": true,
"type": "module",
"description": "Fedify app with Nuxt integration",
"scripts": {
"dev": "nuxt dev",
"build": "nuxt build",
"preview": "nuxt preview",
"start": "node .output/server/index.mjs"
},
"dependencies": {
"@fedify/fedify": "workspace:^",
"@fedify/nuxt": "workspace:^",
"@fedify/vocab": "workspace:^",
"@logtape/logtape": "catalog:",
"nuxt": "catalog:",
"h3": "catalog:",
"vue": "^3.5.13",
"x-forwarded-fetch": "^0.2.0"
},
"devDependencies": {
"typescript": "catalog:",
"@types/node": "catalog:"
}
}
Loading