Skip to content

Prepare DrFed for collaborative development#14

Open
dahlia wants to merge 9 commits into
fedify-dev:mainfrom
dahlia:main
Open

Prepare DrFed for collaborative development#14
dahlia wants to merge 9 commits into
fedify-dev:mainfrom
dahlia:main

Conversation

@dahlia

@dahlia dahlia commented Jun 20, 2026

Copy link
Copy Markdown
Member

This pull request sets up the project so other contributors can work against the same local workflow, package boundaries, and contribution rules.

It adds the first installable server and model packages, wires the GraphQL layer to the database schema, and gives contributors a documented path for building, running, formatting, and reviewing changes.

What changed

  • Added @drfed/models, including the Drizzle schema for accounts, instances, and instance members, database type exports, email normalization, migration support, and the initial generated migration under packages/models/drizzle.
  • Added @drfed/drfed, the main server package with the drfed-server npm binary, Optique-based CLI parsing, PGlite and PostgreSQL database options, automatic migration support, and GraphQL Yoga serving through srvx.
  • Expanded @drfed/graphql with a Pothos schema builder, Drizzle integration, Relay node support, DateTime, Email, and UUID scalars, Account and Instance object types, and an accountByUuid query.
  • Replaced the inline dev task with scripts/dev.mts, which cleans package dist directories, starts recursive tsdown --watch builds, waits for the packages to build, starts the server, and handles shutdown more reliably.
  • Added the contributor guide in CONTRIBUTING.md, with AGENTS.md and CLAUDE.md pointing to it, so people and coding agents read the same project instructions.
  • Added formatting and workspace support through mise.toml, pnpm-workspace.yaml, .oxfmtrc.json, .hongdown.toml, and editor settings under .zed/settings.json.

Checks

  • mise run check
  • mise run build

AI disclosure

scripts/dev.mts and CONTRIBUTING.md were written with GPT-5.5 assistance. The README.md file in each package was written with Claude Sonnet 4.6. assistance. No AI assistance was used for the other changes in this pull request.

dahlia added 5 commits June 20, 2026 23:33
- New @drfed/models package with Drizzle ORM schema defining accounts,
  instances, and instance_members tables (PostgreSQL), with support for
  both PGlite (local file-based) and PostgreSQL backends, plus
  database/transaction type definitions and an initial migration
- New @drfed/drfed package: main server CLI using srvx and GraphQL
  Yoga, with @optique-based argument parsing for database backend
  selection (--pglite-data-path or --postgres-url), listen address
  (--listen), and migration control (--no-migrate)
- Expanded @drfed/graphql with a Pothos SchemaBuilder integrated with
  the Drizzle plugin for type-safe GraphQL schema generation, and a
  createYogaServer() factory function wiring it all together
- Added .oxfmtrc.json formatter config and .zed/settings.json with
  per-language format-on-save via oxfmt
- Updated mise.toml and pnpm workspace to include the new packages
- Add @pothos/plugin-relay and graphql-scalars dependencies
- Add DateTime, Email, UUID custom scalar types to the schema builder
- Rename PothosTypes to SchemaTypes and add Scalars definition
- Implement Account drizzleNode with UUID, email, created fields
- Add accountByUuid query field
- Refactor Instance to drizzleNode with slug, expires, created fields
- Add normalizeEmail() utility function to @drfed/models
- Export normalizeEmail from @drfed/models package index
Replace the Nushell-based dev task with a Node.js/TypeScript script
(scripts/dev.mts) that provides more robust process management:

- Remove dist directories before starting builds
- Spawn tsdown in watch mode across all packages
- Poll until all packages have built their dist directories
- Start the drfed server once builds are ready
- Propagate SIGINT/SIGTERM gracefully to child process groups,
  with a 5-second timeout before force-killing
- Handle double Ctrl+C with an immediate forced kill
- Cross-platform support (Windows taskkill, Unix process groups)

Also handle SIGINT (in addition to SIGTERM) in the server's main()
to ensure clean shutdown when running under node --watch.

Assisted-by: Codex:gpt-5.5
Document the DrFed development workflow, including mise-based tasks,
package boundaries, AGPL source headers, npm packaging expectations,
and AI usage disclosure rules.

Point AGENTS.md and CLAUDE.md at the same guide, and exclude those
symlinks from Hongdown so Markdown checks validate the source document
once.

Assisted-by: Codex:gpt-5.5
Add package-level tsconfig files with strict no-emit type checking
and allowImportingTsExtensions enabled for local .ts imports.

Wire Node 26 types through the pnpm catalog, add the mise type check,
and update imports that must be type-only under verbatimModuleSyntax.

Also fix the development script's child-process error result typing and
process lookup error handling so it passes the stricter checks.
@dahlia dahlia requested a review from a team June 20, 2026 15:25
@dahlia dahlia self-assigned this Jun 20, 2026
@dahlia dahlia moved this from Todo to In progress in NLnet NGI0 Commons Fund (2026) Jun 20, 2026

@2chanhaeng 2chanhaeng left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great! The code and the flow seem solid. I think it would be even better if more documentation for the code were added.

  • CONTRIBUTING.md: descriptions for each package
  • README.md for each package
    • @drfed/models: descriptions for each model and their relationships
    • @drfed/graphql: descriptions for each node

Comment thread .zed/settings.json
Comment thread mise.toml
Comment thread CONTRIBUTING.md
Comment thread packages/graphql/src/account.ts
Comment thread packages/models/src/schema.ts
@dahlia dahlia requested review from 2chanhaeng, dodok8 and sij411 June 21, 2026 03:10
Added a concise README.md to each of the three packages:

- packages/drfed/README.md: documents the CLI options, server
  startup behavior, and source file layout for @drfed/drfed.
- packages/graphql/README.md: documents the custom scalars,
  source layout, and createYogaServer usage for @drfed/graphql.
- packages/models/README.md: documents the database schema,
  source layout, and migration generation for @drfed/models.

Added a Packages section to CONTRIBUTING.md with a table
summarising each package's directory path, npm name, and
one-line description.

Also added README.md to the files list in each package.json
so the documentation is included in published npm packages.

Assisted-by: Claude Code:claude-sonnet-4-6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants