Kyrux
Back

System Flow

Request flow

Request
  → Recovery (catches panics)
  → Allowed Hosts (validates the host — production)
  → CSRF (validates the token on POST/PUT/PATCH/DELETE)
  → Router (finds the view)
  → View middleware (if any)
  → View (developer logic)
    → Service / Model (queries via ORM or raw SQL)
    → DB / Cache
    → EventBus.Publish()
    → Realtime.Replace() / Append() / Prepend()
  → Render (SSR — renders the HTML)
    → Injects liveScript (WebSocket)
    → Injects reloadScript (hot reload — dev only)
  → Response

Development flow

.go file changed
  → Air detects the change
  → Recompiles the project
  → Restarts the server

.html / .css / .js file changed
  → hot reload detects it via inotify
  → Sends an event via SSE (/__kyrux_reload__)
  → Browser reloads automatically

Realtime flow

User A sends POST /posts/criar/
  → View saves to the database
  → render.Partial() renders "partials/lista.html"
  → fw.Realtime.Replace("lista-posts", html)
    → JSON sent over WebSocket to every connected client
    → Each client's browser updates [kyrux-target="lista-posts"]
  → DOM updated with no reload and no manual JS