Skip to content

Rebuild webhooktimer from scratch with lightweight scheduler and minimal UI#3

Merged
XHyperDEVX merged 3 commits intomainfrom
cto/rebuild-from-scratch-ultra-lightweight
May 3, 2026
Merged

Rebuild webhooktimer from scratch with lightweight scheduler and minimal UI#3
XHyperDEVX merged 3 commits intomainfrom
cto/rebuild-from-scratch-ultra-lightweight

Conversation

@cto-new
Copy link
Copy Markdown

@cto-new cto-new Bot commented May 3, 2026

Summary

Rebuilt the project end-to-end with a new implementation focused on simplicity, robustness, and low resource usage.

Core backend rewrite

  • Replaced the previous SQLite + dependency-heavy stack with a pure Go standard-library architecture.
  • Added a new in-memory scheduler manager with durable JSON persistence:
    • Fixed interval mode
    • Random interval mode (min/max)
    • Sleep window support (including overnight ranges like 23:00 -> 06:00)
    • Per-entry enable/disable
    • Manual execute-now API with immediate result payload
    • Last execution timestamp + status tracking
    • Per-entry execution logs retained to last 10 entries
  • Added per-entry execution locking to avoid overlapping webhook calls for the same entry.
  • Added graceful shutdown and hardened HTTP server timeouts.

Storage/persistence

  • Introduced atomic JSON state file persistence (STATE_PATH, default /data/state.json).
  • State writes are done via temp file + rename for resilience.
  • Runtime-only countdown state is kept in memory and not persisted.
  • Old DB compatibility intentionally dropped (per ticket allowance).

API redesign

Implemented a new minimal API surface used by the UI:

  • GET /api/entries
  • POST /api/entries
  • PUT /api/entries/{id}
  • DELETE /api/entries/{id}
  • POST /api/entries/{id}/toggle
  • POST /api/entries/{id}/execute
  • GET /api/entries/{id}/logs
  • GET /healthz

Frontend rewrite

  • Replaced the previous UI with a new dependency-free single-page interface (web/index.html):
    • Minimal, intuitive form for create/edit
    • Fixed/random interval controls
    • Sleep window controls
    • Entry enable/disable toggles
    • Live countdown display (updates every second)
    • Last execution display
    • Per-entry logs display (up to 10)
    • Run now button with immediate toast feedback

Container and footprint

  • Replaced runtime image with a scratch-based static binary image.
  • Added CA bundle copy for HTTPS webhook support.
  • Added .dockerignore to reduce build context.
  • Updated docker-compose.yml env vars to new state settings.

Documentation and repo hygiene

  • Updated README for the rebuilt architecture and new configuration.
  • Updated .gitignore for data/state artifacts.
  • Removed old implementation packages/files and go.sum/dependency chain.

Validation performed

  • Built and ran with Docker Compose successfully.
  • Verified runtime image footprint is ~9 MB (well below 35 MB target).
  • Performed browser validation using agent-browser:
    • Created entry
    • Observed entry rendering/countdown behavior
    • Triggered execute-now and confirmed immediate result + log update
    • Toggled entry enabled/disabled and confirmed UI/state changes

Powered by CTO.new

@XHyperDEVX XHyperDEVX merged commit 38854b4 into main May 3, 2026
@XHyperDEVX XHyperDEVX deleted the cto/rebuild-from-scratch-ultra-lightweight branch May 3, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant