yttcom.net
Backend / Projects / Restructure to Norms
v1.0 · 07.13.26
Active
Restructure to Norms
Started 07/13/26
Owner Admin [00]
Phases 4
Systems Admin / Server / Builder
Align the CAI backend directory structure with standard web platform conventions. Current structure has gaps identified by comparison to platforms like cPanel, Strapi, Laravel Forge, and Directus — missing centralized logs, config, automation, and API organization. Four phases, each self-contained and deployable independently. No existing functionality is broken — additions and reorganization only.
Phases
P1
Foundation — Logs + Config
Active
Create backend/logs/ and backend/config/ — the two most fundamental missing directories on any standard platform. Everything else builds on these.
Why first
Every platform has a central log directory and a central config file. Right now error_logs are scattered across 10+ subdirs and there's no single platform config — paths and tokens are duplicated across session_open.php, per-system config files, and hardcoded in PHP. These two additions have zero risk and immediate value.
Create backend/logs/ directory with index.html stub
Server [40] jurisdiction — dir creation + .htaccess fence
[40]
Build backend/logs/log-viewer.php — aggregates error_logs from all subdirs into one readable page
Reads: backend/*/error_log, systems/*/error_log — sorted by recency
[02]
Create backend/config/ directory
Server [40] jurisdiction
[40]
Build backend/config/platform.php — single source of truth for token, server paths, system registry, DB paths
All other PHP files include this instead of hardcoding. Admin [00] owns and maintains.
[00]
Update server-map.php to include backend/logs/ and backend/config/ in $links
[00]
Update STANDARDS-S.md — document new directories and platform.php include pattern
[00]
P2
API Consolidation
Pending P1
Create a canonical API index at backend/api/ so there's one place to find every endpoint on the platform — without moving the actual API files.
Why second
APIs are currently spread across records/db/, tools/, sys-com/, systems/[NN]/data/, transfers/. Nothing breaks — files stay where they are. We add a redirect index and update TOOLS-INDEX.md to be the canonical machine-readable map. Depends on platform.php from P1 to avoid hardcoding paths.
Create backend/api/ directory
[40]
Build backend/api/index.html — human-readable API directory listing all platform endpoints with paths, actions, and auth method
[02]
Update TOOLS-INDEX.md — full endpoint map including new records/db/api.php task actions
[00]
Add backend/api/ to server-map.php $links
[00]
Update STANDARDS-S.md — document API index pattern and endpoint registration requirement for new APIs
[00]
P3
Automation — Jobs
Pending P1
Create backend/jobs/ for scheduled and automated platform tasks — starting with stubs, activating as needed.
Why third
Everything in CAI is currently manual or session-triggered. Backup rotation, trash lifecycle, inbox cleanup, and log rotation are all done by hand. This phase creates the infrastructure for automation — initially as PHP scripts that can be triggered manually or via cron. Depends on platform.php config from P1.
Create backend/jobs/ directory
[40]
Build jobs/backup-rotate.php — runs CURRENT→PREVIOUS rotation on all backup dirs
[40]
Build jobs/trash-lifecycle.php — moves trash items older than 3 days to archive/, deletes archive items older than 5 days
[40]
Build jobs/snapshot.php — triggered snapshot with correct PDT timestamp naming
[40]
Build jobs/index.html — job runner UI — trigger manually, see last run + result
[02]
Update STANDARDS-S.md — document jobs/ pattern and naming convention
[00]
P4
Cleanup + Standards Lock
Pending P1–P3
Clean up scatter, update all maps and standards docs to reflect the new structure, and lock it in as the platform standard going forward.
Why last
Final cleanup only makes sense after the new directories are live and stable. This phase consolidates error_logs, updates all navigation pages, and produces a final BACKEND-S.md that documents the complete structure so any future system or builder knows exactly where everything goes.
Consolidate scattered error_logs — archive or delete, then redirect to backend/logs/
[00]
Audit backend/ top-level — remove any stray files, verify all dirs have index.html or .htaccess
[00]
Update server-map.php — full backend/ directory tree reflecting all P1–P3 additions
[00]
Rewrite BACKEND-S.md — complete backend structure standard, every directory defined and owned
[00]
Update backend/info/index.html — reflect all current directories and remove stale refs
[02]
Final decision recorded — backend structure locked as platform standard (D-number TBD)
[00]
Backend Projects Restructure Norms Log Server Map Panel