Commit Graph

10 Commits

Author SHA1 Message Date
Krystie
ac23b2e093 refactor(routes): Phase 3.6 - standardize sites.js 2026-03-29 20:16:08 -07:00
Krystie
cabcbcf98a refactor(routes): Phase 3.5 - standardize logs.js 2026-03-29 20:14:33 -07:00
Krystie
8b1492142f refactor(routes): Phase 3.4 - standardize browse.js 2026-03-29 20:13:25 -07:00
Krystie
e6e788fdce refactor(routes): Phase 3.3 - standardize notifications.js (explicit deps) 2026-03-29 20:06:36 -07:00
Krystie
f6b103aed7 refactor(routes): Phase 3.2 - standardize tailscale.js (explicit deps + throw-based errors) 2026-03-29 20:06:13 -07:00
Krystie
4e96c62708 refactor(routes): Phase 3.1 - standardize updates.js (explicit deps) 2026-03-29 20:05:06 -07:00
Krystie
5da1e572a1 refactor(server): Complete Phase 2.1 - Split monolithic server.js
MASSIVE REFACTOR:
- Created src/app.js (17KB) - Express setup, middleware, routes
- Slimmed server.js from 1997 lines → 230 lines (88% reduction!)
- Backed up original as server-old.js for reference

NEW STRUCTURE:
src/
├── app.js (Express application factory)
├── config/ (paths, site config, constants)
├── context/ (DI container, domain modules)
└── utils/ (http, logging, responses, async-handler)

STATS:
- Old server.js: 1997 lines (monolith)
- New server.js: 230 lines (entry point only)
- Modular code: 1729 lines across 14 files in src/
- Total reduction: 88% in main file

server.js now ONLY handles:
- App creation
- License loading
- HTTP server startup
- Feature module initialization
- Graceful shutdown

All business logic moved to src/ modules. Clean, testable, maintainable.

Phase 2.1 COMPLETE 
2026-03-29 19:46:41 -07:00
Krystie
fa7a78388a refactor(utils): Extract utilities from server.js
- Create src/utils/http.js - fetchT and HTTP helpers
- Create src/utils/logging.js - Structured logging and error logging
- Create src/utils/responses.js - Standard API responses
- Create src/utils/async-handler.js - Async wrapper with error handling
- Create src/utils/index.js - Consolidated exports

Removes scattered helper functions from server.js
2026-03-29 19:40:18 -07:00
Krystie
173dafa2f3 refactor(context): Extract context modules from god object
- Create src/context/docker.js - Docker operations
- Create src/context/caddy.js - Caddyfile manipulation
- Create src/context/dns.js - DNS token management and API calls
- Create src/context/session.js - Session wrapper
- Create src/context/index.js - Context assembly (DI container)

Breaks up the 50+ property ctx god object into domain-specific modules
2026-03-29 19:39:17 -07:00
Krystie
6c3d2baede refactor(config): Extract configuration into src/config/ module
- Create src/config/paths.js for all file paths and env vars
- Create src/config/site.js for site configuration loading
- Create src/config/index.js as unified config export
- Prepare for server.js modularization (Phase 2.1)

Part of deslopification roadmap: break 1997-line server.js into layers
2026-03-29 19:36:43 -07:00