Skip to content

refactor: reduce codebase size — largest files analysis #217

@melvincarvalho

Description

@melvincarvalho

Current state

JSS is ~18K LoC across src/. Breakdown by area:

Area Lines % Notes
IdP 3,870 22% views.js (776), interactions.js (662), accounts.js (451), provider.js (455)
Handlers 2,666 15% pay.js (1,031), resource.js (1,023), container.js (343)
Auth 1,814 10% middleware.js (426), solid-oidc.js (344), nostr.js (270)
ActivityPub 1,534 9% routes + core
Patch 940 5% n3-patch.js (539), sparql-update.js (401)
RDF 659 4% turtle.js (442), conneg.js (217)
server.js 678 4% Main setup
Other 5,342 31% config, utils, db, tunnel, webrtc, nostr, etc.

Candidates for reduction

pay.js — 1,031 lines

Largest single handler. Contains HTTP 402, deposits, secondary market, AMM, multi-chain — all in one file. Could split or simplify.

idp/views.js — 776 lines

HTML templates as template literals. Could move to external HTML files or a simple template system.

idp/interactions.js — 662 lines

Login/consent flow handlers. Complex but functional.

token.js — 412 lines

Standalone at root level, could potentially merge with auth/.

mrc20.js — 335 lines

State chain verification. Specialized, probably fine as-is.

Goal

Not all of these need reducing — some complexity is inherent. But pay.js and idp/views.js are the clearest candidates for splitting or simplifying.

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