Liking cljdoc? Tell your friends :D

platform

Infrastructure layer for HTTP routing/interceptors, database integration, CLI/runtime wiring, and shared platform adapters used by feature modules.

Key namespaces

NamespacePurpose

boundary.platform.shell.http.interceptors

HTTP interceptor composition and execution

boundary.platform.shell.interfaces.http.routes

Normalized route handling and dispatch

boundary.platform.shell.adapters.database.*

Database setup, context, and shared persistence infrastructure

HTTP interceptors

Declarative cross-cutting concerns (auth, rate limiting, audit):

;; Define an interceptor
(def require-admin
  {:name  :require-admin
   :enter (fn [ctx]
            (if (admin? (get-in ctx [:request :session :user]))
              ctx
              (assoc ctx :response {:status 403 :body {:error "Forbidden"}})))
   :leave (fn [ctx] ctx)   ; optional response processing
   :error (fn [ctx err]    ; optional error handling
            (assoc ctx :response {:status 500 :body {:error "Internal error"}}))})

;; Attach interceptors to routes
[{:path "/api/admin"
  :methods {:post {:handler     'handlers/create-resource
                   :interceptors ['auth/require-admin
                                  'audit/log-action]
                   :summary "Create admin resource"}}}]

Built-in interceptors

  • :auth/require-authenticated — JWT validation

  • :auth/require-role — role-based access control

  • :rate-limit/per-ip — rate limiting by IP

  • :audit/log-request — request audit logging

  • :validation/validate-body — request body validation

Interceptor phases

  • :enter — request processing (auth, validation, transformation)

  • :leave — response processing (audit, metrics, transformation)

  • :error — exception handling (custom error responses)

Enter phases run in order; leave phases run in reverse order.

Testing

clojure -M:test:db/h2 :platform

Can you improve this documentation?Edit on GitHub

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close