I just shipped Schematra 0.4 with some updates based on some usage and feedback.
Testing ergonomics: Went from 15+ lines of boilerplate to a one-liner by introducing structural testing. Routes can now return S-expressions (chiccup) instead of rendered HTML, so you test against data structures, not string parsing.
;; Assert against structure, not HTML strings
(test "returns greeting"
'(ccup [h1 "Hello"])
(test-route-body app 'GET "/hello"))
Structural middleware: Since routes return S-expressions and rendering happens at the framework boundary, middleware can inspect and transform the DOM structure before it becomes HTML. Want to inject CSRF tokens into every form? It's just an S-expression transform with sxml-transforms. No template engine plugins needed. (see the post for a complete example)
Performance notes: I benchmarked chiccup rendering at 145k ops/sec average (339k for simple elements, 2k for 50-row tables). Even worst case is 0.5ms - way below database/network latency, so no caching layer needed, at least not for now.
What's next: Besides the Redis-backed job queue and rqlite-based ORM mentioned in the full post, I'm working on improving route handling with automatic path parameter extraction:
(get "/posts/:id/comments"
;; :id automatically becomes a local variable
(display id)) ; just works, no (alist-ref 'id params) needed
Schematra is a Sinatra-inspired web framework for CHICKEN Scheme. Still pre-1.0, API is evolving based on real-world use.
All of it? probably not a small effort. Parts of it like chiccup html generation, maybe a couple of days, assuming there's something similar to sxml in the target scheme.
But for Guile in particular there's https://artanis.dev/ that's a pretty close cousin.
I just shipped Schematra 0.4 with some updates based on some usage and feedback.
Testing ergonomics: Went from 15+ lines of boilerplate to a one-liner by introducing structural testing. Routes can now return S-expressions (chiccup) instead of rendered HTML, so you test against data structures, not string parsing.
Structural middleware: Since routes return S-expressions and rendering happens at the framework boundary, middleware can inspect and transform the DOM structure before it becomes HTML. Want to inject CSRF tokens into every form? It's just an S-expression transform with sxml-transforms. No template engine plugins needed. (see the post for a complete example)Performance notes: I benchmarked chiccup rendering at 145k ops/sec average (339k for simple elements, 2k for 50-row tables). Even worst case is 0.5ms - way below database/network latency, so no caching layer needed, at least not for now.
What's next: Besides the Redis-backed job queue and rqlite-based ORM mentioned in the full post, I'm working on improving route handling with automatic path parameter extraction:
Schematra is a Sinatra-inspired web framework for CHICKEN Scheme. Still pre-1.0, API is evolving based on real-world use.Full post: https://schematra.com/blog/whats-new-in-schematra-0-4
Source: https://github.com/schematra/schematra
Benchmarks: https://github.com/schematra/schematra/tree/main/benchmarks
Thank you for writing this! Do you know how much work it would be to generalise to other Schemes, like say Guile?
All of it? probably not a small effort. Parts of it like chiccup html generation, maybe a couple of days, assuming there's something similar to sxml in the target scheme.
But for Guile in particular there's https://artanis.dev/ that's a pretty close cousin.
rqlite[1] creator here. Thanks for the shout-out in your blog post.
https://rqlite.io
thanks for creating it! I'm really impressed by how easy was to use for dev and prod.