Skip to content

Add @fedify/astro, make an examples and make @fedify/init support Astro#593

Merged
dahlia merged 14 commits intofedify-dev:mainfrom
2chanhaeng:main
Mar 1, 2026
Merged

Add @fedify/astro, make an examples and make @fedify/init support Astro#593
dahlia merged 14 commits intofedify-dev:mainfrom
2chanhaeng:main

Conversation

@2chanhaeng
Copy link
Contributor

@2chanhaeng 2chanhaeng commented Mar 1, 2026

Summary

Add @fedify/astro, make an examples and make @fedify/init support Astro

Related issue

Changes

  • packages/astro added.
  • examples/astro added.
  • packages/init refactored and fix some errors.
  • packages/init/src/webframeworks/astro.ts added.

Benefits

Now users can conveniently use Astro and Fedify together more easier.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run mise test on your machine?

Additional Note

test-initcan't test deno(this is a bug by deno and vite), npm with Astro.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly expands Fedify's web framework compatibility by introducing a dedicated integration for Astro. It includes a new @fedify/astro package, a comprehensive example project showcasing its usage, and updates to the @fedify/init CLI tool to allow users to easily scaffold new Fedify projects with Astro. These changes aim to simplify the development experience for users wishing to combine Fedify's federation capabilities with Astro's content-driven website features.

Highlights

  • New Astro Integration: Added the new @fedify/astro package, providing a dedicated integration for Fedify with the Astro web framework.
  • Astro Example Project: Introduced a comprehensive examples/astro project to demonstrate how to build a federated server application using Fedify with Astro, supporting both Deno and Node.js runtimes.
  • Updated @fedify/init Tool: Refactored and fixed the @fedify/init package to now officially support Astro as a web framework option, simplifying project scaffolding.
  • Improved Deno Version Detection: Enhanced Deno version detection in @fedify/init to correctly manage the temporal unstable flag, ensuring it's only added when necessary for older Deno versions.
Changelog
  • AGENTS.md
    • Updated the list of packages using tsdown for TypeScript compilation to include packages/astro.
  • CHANGES.md
    • Added @fedify/astro package for integrating Fedify with Astro, providing fedifyIntegration() and fedifyMiddleware().
    • Changed fedify init to add "temporal" to deno.json's "unstable" field only when the installed Deno version is earlier than 2.7.0.
    • fedify init now omits the "unstable" field entirely when no unstable feature is required.
    • Supported Astro as a web framework option in fedify init, with runtime-specific templates for Deno, Bun, and Node.js environments.
  • CONTRIBUTING.md
    • Added packages/astro to the monorepo package list.
    • Updated test-init task command to mise test:init.
  • deno.json
    • Included packages/astro in the workspace.
    • Added astro to imports.
  • docs/.vitepress/config.mts
    • Added @fedify/astro to the documentation references.
  • docs/cli.md
    • Updated the list of supported web frameworks for fedify init to include Astro.
  • docs/manual/integration.md
    • Added a new section detailing how to integrate Fedify with Astro, including code examples for Deno and Node.js.
  • docs/package.json
    • Added @fedify/astro as a workspace dependency.
  • examples/astro/.gitignore
    • Added .astro to the ignore list.
  • examples/astro/README.md
    • Provided a comprehensive guide for the Astro integration sample, detailing features, how it works, project structure, running instructions, example usage scenarios, and configuration.
  • examples/astro/astro.config.deno.ts
    • Configured Astro for Deno runtime with fedifyIntegration and @deno/astro-adapter.
  • examples/astro/astro.config.node.ts
    • Configured Astro for Node.js runtime with fedifyIntegration and @astrojs/node.
  • examples/astro/deno.json
    • Defined Deno tasks for Astro development, build, and preview, and excluded build artifacts.
  • examples/astro/package.json
    • Configured package details and scripts for the Astro example, including dependencies for Astro, Fedify, and adapters.
  • examples/astro/public/astro-fedify-logo.svg
    • Added a new SVG logo combining Astro and Fedify branding.
  • examples/astro/public/astro-horizonal.svg
    • Added a new horizontal SVG logo for Astro.
  • examples/astro/public/astro-square.svg
    • Added a new square SVG logo for Astro.
  • examples/astro/public/fedify-logo.svg
    • Added the Fedify logo SVG.
  • examples/astro/src/layouts/Layout.astro
    • Created a base Astro layout with global styles and dark mode support for the example.
  • examples/astro/src/lib/federation.ts
    • Implemented the core Fedify federation logic for the Astro example, including actor dispatchers, key pair handling, inbox listeners, and object dispatchers.
  • examples/astro/src/lib/store.ts
    • Defined in-memory stores for key pairs, follower relations, and posts for the Astro example.
  • examples/astro/src/middleware.ts
    • Implemented Astro middleware to integrate Fedify's request handling.
  • examples/astro/src/pages/index.astro
    • Created the home page for the Astro example, displaying the demo handle and follower list.
  • examples/astro/src/pages/users/[identifier]/index.astro
    • Created the user profile page for the Astro example, displaying actor information.
  • examples/astro/src/pages/users/[identifier]/posts/[id].astro
    • Created a detail page for individual posts in the Astro example.
  • examples/astro/src/pages/users/[identifier]/posts/index.astro
    • Created the posts list and creation form page for the Astro example.
  • examples/astro/tsconfig.json
    • Configured TypeScript for the Astro example.
  • examples/test-examples/mod.ts
    • Added the Astro example to the list of server examples for testing.
  • mise.toml
    • Added a new test:init task to run tests for the init package.
  • packages/astro/README.md
    • Provided documentation for the @fedify/astro package, including installation and usage instructions.
  • packages/astro/deno.json
    • Configured the Deno project for @fedify/astro, including name, version, exports, and tasks.
  • packages/astro/package.json
    • Configured the Node.js package for @fedify/astro, including metadata, exports, peer dependencies, and build scripts.
  • packages/astro/src/mod.ts
    • Implemented the fedifyIntegration and fedifyMiddleware functions for Astro.
  • packages/astro/tsdown.config.ts
    • Configured tsdown for building the @fedify/astro package.
  • packages/fedify/README.md
    • Updated the package table to include @fedify/astro.
  • packages/init/src/action/configs.ts
    • Refactored Deno configuration loading, including a more robust unstable field handling and Deno version detection.
  • packages/init/src/action/deps.ts
    • Modified getDevDependencies to conditionally add or remove Fedify dependencies based on test mode and package manager.
  • packages/init/src/action/env.ts
    • Added JSDoc comments to recommendConfigEnv.
  • packages/init/src/action/install.ts
    • Added JSDoc comments to installDependencies.
  • packages/init/src/action/notice.ts
    • Added JSDoc comments to various notice functions and improved clarity.
  • packages/init/src/action/set.ts
    • Updated import path for webFrameworks.
  • packages/init/src/action/utils.ts
    • Added JSDoc comments to utility functions.
  • packages/init/src/ask/mod.ts
    • Added JSDoc comments to askOptions.
  • packages/init/src/ask/pm.ts
    • Updated import path for webFrameworks.
  • packages/init/src/ask/wf.ts
    • Updated import path for webFrameworks.
  • packages/init/src/command.ts
    • Added JSDoc comments to initOptions, initCommand, and testInitCommand types.
  • packages/init/src/const.ts
    • Added JSDoc comments to constants.
    • Included astro in WEB_FRAMEWORK.
  • packages/init/src/lib.ts
    • Added JSDoc comments to various functions and constants.
    • Removed getInstruction, getNextInitCommand, getNitroInitCommand, packageManagerToRuntime.
  • packages/init/src/mod.ts
    • Added a comprehensive JSDoc description for the module.
  • packages/init/src/test/create.ts
    • Changed the dry-run flag from -d to --dry-run.
    • Added a notice about output files for failed tests.
  • packages/init/src/test/lookup.ts
    • Updated import path for webFrameworks.
    • Added error handling for testApp.
  • packages/init/src/test/utils.ts
    • Modified the log message for test directories.
  • packages/init/src/types.ts
    • Added JSDoc comments to types and interfaces.
    • Updated WebFramework to include astro.
  • packages/init/src/utils.ts
    • Added JSDoc comments to utility functions and types.
  • packages/init/src/webframeworks.ts
    • Removed, as it was refactored into individual files.
  • packages/init/src/webframeworks/astro.ts
    • Added a new file defining the Astro web framework integration for @fedify/init.
  • packages/init/src/webframeworks/const.ts
    • Added a new file defining default development dependencies.
  • packages/init/src/webframeworks/elysia.ts
    • Added a new file defining the Elysia web framework integration for @fedify/init.
  • packages/init/src/webframeworks/express.ts
    • Added a new file defining the Express web framework integration for @fedify/init.
  • packages/init/src/webframeworks/hono.ts
    • Added a new file defining the Hono web framework integration for @fedify/init.
  • packages/init/src/webframeworks/mod.ts
    • Added a new file to export all web framework configurations.
  • packages/init/src/webframeworks/next.ts
    • Added a new file defining the Next.js web framework integration for @fedify/init.
  • packages/init/src/webframeworks/nitro.ts
    • Added a new file defining the Nitro web framework integration for @fedify/init.
  • packages/init/src/webframeworks/utils.ts
    • Added a new file defining utility functions for web framework integrations.
  • pnpm-workspace.yaml
    • Added packages/astro and examples/astro to the workspace.
    • Updated astro version in catalog.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces excellent support for the Astro framework by adding a new @fedify/astro package, a comprehensive example project, and updating @fedify/init. The code is well-structured, particularly the refactoring within the init package. I've identified a few areas for improvement, mainly within the new example code, including some configuration issues, invalid SVG files, and unsafe type assertions that could be made more robust. Overall, this is a valuable contribution to the project.

@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
packages/init/src/action/utils.ts 48.48% <ø> (ø)
packages/init/src/utils.ts 15.50% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class Astro support to Fedify by introducing a new @fedify/astro integration package, an Astro example app, and refactoring @fedify/init to scaffold Astro projects alongside existing frameworks.

Changes:

  • Added @fedify/astro package providing an Astro integration (fedifyIntegration) and middleware (fedifyMiddleware).
  • Added a full examples/astro demo and wired it into the examples test runner.
  • Refactored @fedify/init web-framework registry into per-framework modules and added Astro scaffolding/templates.

Reviewed changes

Copilot reviewed 65 out of 72 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds new package/example to the workspace and catalogs Astro.
packages/init/src/webframeworks/utils.ts Extracts shared init instruction + PM→runtime helper.
packages/init/src/webframeworks/nitro.ts Moves Nitro init config into its own module.
packages/init/src/webframeworks/next.ts Moves Next.js init config into its own module.
packages/init/src/webframeworks/mod.ts New registry module for supported web frameworks.
packages/init/src/webframeworks/hono.ts Moves Hono init config into its own module.
packages/init/src/webframeworks/express.ts Moves Express init config into its own module.
packages/init/src/webframeworks/elysia.ts Moves Elysia init config into its own module.
packages/init/src/webframeworks/const.ts Centralizes default deps used by framework initializers.
packages/init/src/webframeworks/astro.ts Adds Astro scaffolding logic, deps, templates, and tasks.
packages/init/src/webframeworks.ts Removes old monolithic webframeworks registry.
packages/init/src/utils.ts Adds/expands internal utility docs and helpers.
packages/init/src/types.ts Expands types/docs for init data structures and registries.
packages/init/src/test/utils.ts Adjusts init test logging output.
packages/init/src/test/lookup.ts Updates imports to new webframework registry; tweaks error handling.
packages/init/src/test/create.ts Updates imports; improves failure output; updates dry-run flag.
packages/init/src/templates/astro/src/middleware.ts.tpl Adds init template for Astro middleware.
packages/init/src/templates/astro/astro.config.node.ts.tpl Adds init template for Astro Node config.
packages/init/src/templates/astro/astro.config.deno.ts.tpl Adds init template for Astro Deno config.
packages/init/src/mod.ts Adds module-level documentation and re-exports.
packages/init/src/lib.ts Refactors shared helpers/docs; moves instruction helper out.
packages/init/src/const.ts Adds Astro to supported web frameworks and documents constants.
packages/init/src/command.ts Adds/updates command option docs; keeps --dry-run.
packages/init/src/ask/wf.ts Updates import to new webframework registry module.
packages/init/src/ask/pm.ts Updates import to new webframework registry module.
packages/init/src/ask/mod.ts Adds docs for prompt orchestration.
packages/init/src/action/utils.ts Adds docs for small action predicates/helpers.
packages/init/src/action/set.ts Updates import to new webframework registry module.
packages/init/src/action/notice.ts Reorders imports and adds extensive notice docs/output.
packages/init/src/action/install.ts Minor import reordering + docs for install step.
packages/init/src/action/env.ts Adds docs for env recommendation step.
packages/init/src/action/deps.ts Adjusts deps logic for test-mode local linking; minor refactor.
packages/init/src/action/const.ts Documents PACKAGES_PATH usage for test mode.
packages/init/src/action/configs.ts Refactors Deno version detection + unstable/links generation logic.
packages/fedify/README.md Lists @fedify/astro among published packages.
packages/astro/tsdown.config.ts Adds tsdown build config for the new package.
packages/astro/src/mod.ts Implements Astro integration hook + middleware wrapper for Fedify.
packages/astro/package.json Defines npm packaging/exports for @fedify/astro.
packages/astro/deno.json Defines JSR export/tasks for @fedify/astro.
packages/astro/README.md Adds usage docs for the new Astro integration package.
mise.toml Adds a dedicated test:init task.
examples/test-examples/mod.ts Adds Astro example to the examples test matrix.
examples/astro/tsconfig.json Adds Astro strict TS config for the example app.
examples/astro/src/pages/users/[identifier]/posts/index.astro Adds posts list + create form page to the Astro demo.
examples/astro/src/pages/users/[identifier]/posts/[id].astro Adds post detail page to the Astro demo.
examples/astro/src/pages/users/[identifier]/index.astro Adds user profile page to the Astro demo.
examples/astro/src/pages/index.astro Adds home page to the Astro demo.
examples/astro/src/middleware.ts Wires fedifyMiddleware into Astro’s middleware entrypoint.
examples/astro/src/lib/store.ts Adds simple in-memory stores for demo state.
examples/astro/src/lib/federation.ts Implements demo federation logic (actor/inbox/object dispatchers).
examples/astro/src/layouts/Layout.astro Adds demo layout + global styling.
examples/astro/public/fedify-logo.svg Adds static asset for the demo UI.
examples/astro/public/astro-square.svg Adds static asset for the demo UI.
examples/astro/public/astro-horizonal.svg Adds static asset for the demo UI.
examples/astro/public/astro-fedify-logo.svg Adds static asset for the demo UI.
examples/astro/package.json Defines Node-based Astro scripts and deps for the demo.
examples/astro/deno.json Defines Deno tasks/imports for running the demo under Deno.
examples/astro/astro.config.node.ts Adds Astro Node config for the demo.
examples/astro/astro.config.deno.ts Adds Astro Deno config for the demo.
examples/astro/README.md Adds full documentation for running/testing the Astro demo.
examples/astro/.gitignore Ignores .astro build artifacts.
docs/package.json Adds @fedify/astro to docs workspace deps.
docs/manual/integration.md Documents Astro integration in the manual.
docs/cli.md Updates CLI docs to list Astro as an init option.
docs/.vitepress/config.mts Adds @fedify/astro to references list.
deno.json Adds new workspace members and pins astro import.
CONTRIBUTING.md Documents the new package and updates init-testing instructions.
CHANGES.md Adds changelog entries for @fedify/astro + init Astro support.
AGENTS.md Notes packages/astro uses tsdown like other integrations.

Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Could you upgrade Hongdown to v0.3.7 and reformat Markdown documents?

@dahlia dahlia added this to the Fedify 2.1 milestone Mar 1, 2026
@dahlia dahlia added type/enhancement Improvements to existing features component/integration Web framework integration integration/astro Astro integration (@fedify/astro) labels Mar 1, 2026
Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Great work! Thanks!

@dahlia dahlia merged commit be63873 into fedify-dev:main Mar 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/integration Web framework integration integration/astro Astro integration (@fedify/astro) type/enhancement Improvements to existing features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Astro integration

3 participants