Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b2fb32a
Copy `packages/fedify/src/x/*.ts` files to `packages/*/src/mod.ts`
2chanhaeng Aug 24, 2025
a25e1b9
Set as packages
2chanhaeng Aug 24, 2025
51ef4b8
Add `tsdown.config.ts`
2chanhaeng Aug 24, 2025
eabf011
Fix entry file
2chanhaeng Aug 24, 2025
d60986c
Added dependencies
2chanhaeng Aug 24, 2025
ddacced
Remove `@fedify/fresh`
2chanhaeng Aug 24, 2025
88b0c00
Added `deno.json`
2chanhaeng Aug 25, 2025
062d769
Remove `@fedify/fresh`
2chanhaeng Aug 25, 2025
a5c2177
Fix import path
2chanhaeng Aug 25, 2025
f09ef6c
Added tests
2chanhaeng Aug 25, 2025
1b1720e
Added `deprecated` to JSDoc
2chanhaeng Aug 25, 2025
06485ac
Added docs
2chanhaeng Aug 25, 2025
acbed4f
Fix docs
2chanhaeng Aug 25, 2025
e0b4f84
Lint all files
2chanhaeng Aug 25, 2025
3530457
Added description
2chanhaeng Aug 26, 2025
41026bb
Deleted configuration file to publish `@fedify/denokv` to NPM
2chanhaeng Aug 26, 2025
c76255a
Replace `Deno.test` to `node:test`
2chanhaeng Aug 26, 2025
d69f43b
Removed `@fedify/denokv` from pnpm workspace
2chanhaeng Aug 26, 2025
d7cc8c7
Fix `@fedify/hono` test
2chanhaeng Aug 26, 2025
5efbf86
Merge branch 'main' into main
2chanhaeng Aug 26, 2025
c8cbdb8
Fix lock file
2chanhaeng Aug 26, 2025
dd720af
Fixed packages since
2chanhaeng Aug 26, 2025
d78d0c6
Log warning for deprecated modules
2chanhaeng Aug 26, 2025
92d3187
Added README.md for new packages
2chanhaeng Aug 26, 2025
50dd15c
Added cspell
2chanhaeng Aug 27, 2025
c30c038
Replaced `@fedify/fedify/x/*` modules with `@fedify/*` packages in docs
2chanhaeng Aug 27, 2025
3f17346
Fixed links to archived repository
2chanhaeng Aug 27, 2025
7a7b4d1
Fix entry point of packages
2chanhaeng Aug 27, 2025
37be33b
Added packages to docs
2chanhaeng Aug 27, 2025
533f75f
Added commands to install the integration packages in docs
2chanhaeng Aug 27, 2025
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
12 changes: 8 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,21 @@ The repository is organized as a monorepo with the following packages:
- *src/testing/*: Testing utilities
- *src/vocab/*: ActivityPub vocabulary implementation
- *src/webfinger/*: WebFinger protocol implementation
- *src/x/*: Framework integrations
- ~~src/x/: Framework integrations~~ **Don't use.** This directory will be removed in version 2.0.0. Use packages from the `@fedify` scope, which are located in the `packages/` directory (e.g., `@fedify/hono` is in `packages/hono/`).
- *packages/cli/*: Fedify CLI implementation (@fedify/cli, built with Deno)
- *packages/amqp/*: AMQP/RabbitMQ driver (@fedify/amqp)
- *packages/cfworkers/*: Cloudflare Workers integration (@fedify/cfworkers)
- *packages/denokv/*: Deno KV integration (@fedify/denokv)
- *packages/elysia/*: Elysia integration (@fedify/elysia)
- *packages/express/*: Express.js integration (@fedify/express)
- *packages/h3/*: h3 framework integration (@fedify/h3)
- *packages/hono/*: Hono integration (@fedify/hono)
- *packages/postgres/*: PostgreSQL drivers (@fedify/postgres)
- *packages/redis/*: Redis drivers (@fedify/redis)
- *packages/nestjs/*: NestJS integration (@fedify/nestjs)
- *packages/next/*: Next.js integration (@fedify/next)
- *packages/sqlite/*: SQLite driver (@fedify/sqlite)
- *packages/sveltekit/*: SvelteKit integration (@fedify/sveltekit)
- *packages/testing/*: Testing utilities (@fedify/testing)
- *docs/*: Documentation built with Node.js and VitePress
- *examples/*: Example projects demonstrating Fedify usage
Expand Down Expand Up @@ -143,10 +147,10 @@ Common Tasks

### Implementing Framework Integrations

1. Add new integrations in the *packages/fedify/src/x/* directory
2. Follow pattern from existing integrations (hono.ts, sveltekit.ts)
1. Create a new package in *packages/* directory for new integrations
2. Follow pattern from existing integration packages (*packages/hono/*, *packages/sveltekit/*)
3. Use standard request/response interfaces for compatibility
4. Consider creating a dedicated package for substantial integrations
4. Consider creating example applications in *examples/* that demonstrate usage

### Creating Database Adapters

Expand Down
42 changes: 42 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,21 @@ To be released.
- Changed how `parseSoftware()` function handles non-Semantic Versioning
number strings on `tryBestEffort` mode. [[#353], [#365] by Hyeonseo Kim]]

- Separated modules from `@fedify/fedify/x` into dedicated packages to
improve modularity and reduce bundle size. The existing integration
functions in `@fedify/fedify/x` are now deprecated and will be removed in
version 2.0.0. [[#375] by Chanhaeng Lee]

- Deprecated `@fedify/fedify/x/cfworkers` in favor of `@fedify/cfworkers`.
- Deprecated `@fedify/fedify/x/denokv` in favor of `@fedify/denokv`.
- Deprecated `@fedify/fedify/x/hono` in favor of `@fedify/hono`.
- Deprecated `@fedify/fedify/x/sveltekit` in favor of `@fedify/sveltekit`.

[FEP-5711]: https://w3id.org/fep/5711
[#353]: https://github.com/fedify-dev/fedify/issues/353
[#365]: https://github.com/fedify-dev/fedify/pull/365
[#373]: https://github.com/fedify-dev/fedify/issues/373
[#375]: https://github.com/fedify-dev/fedify/issues/375
[#381]: https://github.com/fedify-dev/fedify/pull/381

### @fedify/cli
Expand All @@ -67,6 +78,30 @@ To be released.
[#353]: https://github.com/fedify-dev/fedify/issues/353
[#365]: https://github.com/fedify-dev/fedify/pull/365

### @fedify/cfworkers

- Created Cloudflare Workers integration as the *@fedify/cfworkers* package.
Separated from `@fedify/fedify/x/cfworkers` to improve modularity and
reduce bundle size. [[#375] by Chanhaeng Lee]

[#375]: https://github.com/fedify-dev/fedify/issues/375
Comment thread
2chanhaeng marked this conversation as resolved.

### @fedify/denokv

- Created Deno KV integration as the *@fedify/denokv* package.
Separated from `@fedify/fedify/x/denokv` to improve modularity and
reduce bundle size. [[#375] by Chanhaeng Lee]

[#375]: https://github.com/fedify-dev/fedify/issues/375

### @fedify/hono

- Created Hono integration as the *@fedify/hono* package.
Separated from `@fedify/fedify/x/hono` to improve modularity and
reduce bundle size. [[#375] by Chanhaeng Lee]

[#375]: https://github.com/fedify-dev/fedify/issues/375

### @fedify/next

- Created [Next.js] integration as the *@fedify/next* package.
Expand All @@ -82,6 +117,13 @@ To be released.

[#368]: https://github.com/fedify-dev/fedify/pull/368

### @fedify/sveltekit

- Created SvelteKit integration as the *@fedify/sveltekit* package.
Separated from `@fedify/fedify/x/sveltekit` to improve modularity and
reduce bundle size. [[#375] by Chanhaeng Lee]

[#375]: https://github.com/fedify-dev/fedify/issues/375

Version 1.8.8
-------------
Expand Down
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,18 @@ The repository is organized as a monorepo with the following packages:
- *packages/cli/*: The Fedify CLI (@fedify/cli). The CLI is built with
[Deno].
- *packages/amqp/*: AMQP/RabbitMQ driver (@fedify/amqp) for Fedify.
- *packages/cfworkers/*: Cloudflare Workers integration (@fedify/cfworkers) for Fedify.
- *packages/denokv/*: Deno KV integration (@fedify/denokv) for Fedify.
- *packages/elysia/*: Elysia integration (@fedify/elysia) for Fedify.
- *packages/express/*: Express integration (@fedify/express) for Fedify.
- *packages/h3/*: h3 framework integration (@fedify/h3) for Fedify.
- *packages/hono/*: Hono integration (@fedify/hono) for Fedify.
- *packages/postgres/*: PostgreSQL drivers (@fedify/postgres) for Fedify.
- *packages/redis/*: Redis drivers (@fedify/redis) for Fedify.
- *packages/nestjs/*: NestJS integration (@fedify/nestjs) for Fedify.
- *packages/next/*: Next.js integration (@fedify/next) for Fedify.
- *packages/sqlite/*: SQLite driver (@fedify/sqlite) for Fedify.
- *packages/sveltekit/*: SvelteKit integration (@fedify/sveltekit) for Fedify.
- *packages/testing/*: Testing utilities (@fedify/testing) for Fedify.
- *docs/*: The Fedify docs. The docs are built with [Node.js] and
[VitePress].
Expand Down
5 changes: 5 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
"./packages/fedify",
"./packages/cli",
"./packages/amqp",
"./packages/cfworkers",
"./packages/denokv",
"./packages/elysia",
"./packages/express",
"./packages/h3",
"./packages/hono",
"./packages/postgres",
"./packages/redis",
"./packages/sqlite",
"./packages/sveltekit",
"./packages/testing",
"./examples/blog",
"./examples/cloudflare-workers",
Expand All @@ -26,6 +30,7 @@
"@std/path": "jsr:@std/path@^1.0.6",
"@std/yaml": "jsr:@std/yaml@^1.0.8",
"amqplib": "npm:amqplib@^0.10.8",
"es-toolkit": "npm:es-toolkit@^1.30.0",
"h3": "npm:h3@^1.15.0",
"@nestjs/common": "npm:@nestjs/common@^11.0.1",
"ioredis": "npm:ioredis@^5.6.1",
Expand Down
8 changes: 8 additions & 0 deletions docs/manual/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ Hono

*This API is available since Fedify 0.6.0.*

> [!WARNING]
> The `@fedify/fedify/x/hono` module is deprecated and will be removed in
> Fedify 2.0.0. Please use the `@fedify/hono` package instead.

[Hono] is a fast, lightweight, and Web standard-compliant server framework for
TypeScript. Fedify has the `@fedify/fedify/x/hono` module that provides
a middleware to integrate Fedify with Hono:
Expand Down Expand Up @@ -244,6 +248,10 @@ SvelteKit

*This API is available since Fedify 1.3.0.*

> [!WARNING]
> The `@fedify/fedify/x/sveltekit` module is deprecated and will be removed in
> Fedify 2.0.0. Please use the `@fedify/sveltekit` package instead.

[SvelteKit] is a framework for building web applications with [Svelte]. Fedify
has the `@fedify/fedify/x/sveltekit` module that provides a hook handler to
integrate Fedify with SvelteKit. Put the following code in your
Expand Down
8 changes: 8 additions & 0 deletions docs/manual/kv.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ const federation = createFederation<void>({

### `DenoKvStore` (Deno only)

> [!WARNING]
> The `@fedify/fedify/x/denokv` module is deprecated and will be removed in
> Fedify 2.0.0. Please use the `@fedify/denokv` package instead.

`DenoKvStore` is a key–value store implementation for [Deno] runtime that uses
Deno's built-in [`Deno.openKv()`] API. It provides persistent storage and good
performance for Deno environments. It's suitable for production use in Deno
Expand Down Expand Up @@ -280,6 +284,10 @@ const federation = createFederation<void>({

*This API is available since Fedify 1.6.0.*

> [!WARNING]
> The `@fedify/fedify/x/cfworkers` module is deprecated and will be removed in
> Fedify 2.0.0. Please use the `@fedify/cfworkers` package instead.

`WorkersKvStore` is a key–value store implementation for [Cloudflare Workers]
that uses Cloudflare's built-in [Cloudflare Workers KV] API. It provides
persistent storage and good performance for Cloudflare Workers environments.
Expand Down
8 changes: 8 additions & 0 deletions docs/manual/mq.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ const federation = createFederation<void>({

### `DenoKvMessageQueue` (Deno only)

> [!WARNING]
> The `@fedify/fedify/x/denokv` module is deprecated and will be removed in
> Fedify 2.0.0. Please use the `@fedify/denokv` package instead.

`DenoKvMessageQueue` is a message queue implementation for [Deno] runtime that
uses Deno's built-in [`Deno.openKv()`] API. It provides persistent storage and
good performance for Deno environments. It's suitable for production use in
Expand Down Expand Up @@ -285,6 +289,10 @@ const federation = createFederation({

*This API is available since Fedify 1.6.0.*

> [!WARNING]
> The `@fedify/fedify/x/cfworkers` module is deprecated and will be removed in
> Fedify 2.0.0. Please use the `@fedify/cfworkers` package instead.

`WorkersMessageQueue` is a message queue implementation for [Cloudflare Workers]
that uses Cloudflare's built-in [Cloudflare Queues] API. It provides
scalability and high performance, making it suitable for production use in
Expand Down
21 changes: 21 additions & 0 deletions packages/cfworkers/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "@fedify/cfworkers",
"version": "1.9.0",
"license": "MIT",
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.13",
"es-toolkit": "npm:es-toolkit@^1.30.0",
"@cloudflare/workers-types/experimental": "npm:@cloudflare/workers-types@^4.20250529.0/experimental"
},
"exports": {
".": "./src/mod.ts"
},
"exclude": [
"dist",
"node_modules"
],
"tasks": {
"check": "deno fmt --check && deno lint && deno check src/*.ts",
"test": "deno test --allow-net --allow-env"
}
}
67 changes: 67 additions & 0 deletions packages/cfworkers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"name": "@fedify/cfworkers",
"version": "1.9.0",
"description": "Adapt Fedify with Cloudflare Workers",
"keywords": [
"Fedify",
"ActivityPub",
"Fediverse",
"Cloudflare Workers"
],
"author": {
"name": "Hong Minhee",
"email": "hong@minhee.org",
"url": "https://hongminhee.org/"
},
"homepage": "https://fedify.dev/",
"repository": {
"type": "git",
"url": "git+https://github.com/fedify-dev/fedify.git",
"directory": "packages/cfworkers"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/fedify-dev/fedify/issues"
},
"funding": [
"https://opencollective.com/fedify",
"https://github.com/sponsors/dahlia"
],
"type": "module",
"main": "./dist/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
},
"import": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"default": "./dist/index.js"
}
},
"./package.json": "./package.json"
},
"files": [
"dist/",
"package.json"
],
"peerDependencies": {
"@fedify/fedify": "workspace:",
"@cloudflare/workers-types": "catalog:"
},
"devDependencies": {
"tsdown": "catalog:",
"typescript": "catalog:"
},
"scripts": {
"build": "tsdown",
"prepack": "tsdown",
"prepublish": "tsdown",
"test": "deno task codegen && tsdown && cd dist/ && node --test"
}
}
83 changes: 83 additions & 0 deletions packages/cfworkers/src/mod.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import type {
KVNamespace,
Queue,
} from "@cloudflare/workers-types/experimental";
import { delay } from "es-toolkit";
import { deepStrictEqual, strictEqual } from "node:assert/strict";
import { describe, test } from "node:test";
import { WorkersKvStore, WorkersMessageQueue } from "./mod.ts";

describe("WorkersKvStore", {
skip: !("navigator" in globalThis &&
navigator.userAgent === "Cloudflare-Workers"),
}, () => {
test("set() & get()", async (t) => {
const { env } = t as unknown as {
env: Record<string, KVNamespace<string>>;
};
const store = new WorkersKvStore(env.KV1);

await store.set(["foo", "bar"], { foo: 1, bar: 2 });
deepStrictEqual(await store.get(["foo", "bar"]), { foo: 1, bar: 2 });
strictEqual(await store.get(["foo"]), undefined);

await store.set(["foo", "baz"], "baz", {
ttl: Temporal.Duration.from({ seconds: 0 }),
});
strictEqual(await store.get(["foo", "baz"]), undefined);
});

test("delete()", async (t) => {
const { env } = t as unknown as {
env: Record<string, KVNamespace<string>>;
};
const store = new WorkersKvStore(env.KV1);

await store.delete(["foo", "bar"]);
strictEqual(await store.get(["foo", "bar"]), undefined);
});
});

describe("WorkersMessageQueue", {
skip: !("navigator" in globalThis &&
navigator.userAgent === "Cloudflare-Workers"),
}, () => {
test("message queue operations", async (t) => {
const { env, messageBatches } = t as unknown as {
env: Record<string, Queue>;
messageBatches: MessageBatch[];
};
const queue = new WorkersMessageQueue(env.Q1);
await queue.enqueue({ foo: 1, bar: 2 });
await waitFor(() => messageBatches.length > 0, 5000);
strictEqual(messageBatches.length, 1);
strictEqual(messageBatches[0].queue, "Q1");
strictEqual(messageBatches[0].messages.length, 1);
deepStrictEqual(messageBatches[0].messages[0].body, { foo: 1, bar: 2 });

await queue.enqueue(
{ baz: 3, qux: 4 },
{ delay: Temporal.Duration.from({ seconds: 3 }) },
);
await delay(2000);
strictEqual(messageBatches.length, 1);
await waitFor(() => messageBatches.length > 1, 6000);
strictEqual(messageBatches[1].queue, "Q1");
strictEqual(messageBatches[1].messages.length, 1);
deepStrictEqual(messageBatches[1].messages[0].body, { baz: 3, qux: 4 });
});
});

async function waitFor(
predicate: () => boolean,
timeoutMs: number,
): Promise<void> {
let delayed = 0;
while (!predicate()) {
await delay(500);
delayed += 500;
if (delayed > timeoutMs) {
throw new Error("Timeout");
}
}
}
Loading
Loading