Skip to content

[P2][server/maintainability] main.rs is a 10,776-line god-file mixing routing, handlers, auth, git, CUE, storage and tests #86

Description

@rawkode

Follow-up from the thermo-nuclear review round 2 (see PR #70 / tracking #73).

Location: crates/server/src/main.rs:1-10776

Issue: Single file of 10,776 lines / ~400 KB containing the router, every HTTP handler, the Runtime god-struct with relations/comments/layouts/git/auth/rate-limit methods, git plumbing helpers (git_refs, git_commits, commit_diff_payload, ...), CUE overlay logic, extension loading, and the full test suite.

Why it matters: Directly violates CLAUDE.md 'Prefer small, focused files organized around behavior/protocol boundary' and 'Flag god-files/functions'. It impedes review (this file exceeds the tooling read limit), local reasoning, and ownership boundaries.

Proposed fix: Split into modules by responsibility (e.g. http/routing.rs, http/handlers/{graphql,git,oidc,events,extensions}.rs, runtime/{relations,comments,layouts,auth}.rs, git/*) keeping main.rs to process bootstrap + router assembly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions