Schematra: A Sinatra love letter in Scheme

https://news.ycombinator.com/rss Hits: 9
Summary

Schematra A minimal web framework for CHICKEN Scheme, inspired by Sinatra. Schematra is currently an early exploration project created for learning purposes, but hopefully it will grow into something more useful over time. Why Schematra? I created Schematra because I wanted to: Improve my knowledge of scheme : Building a web framework is a great way to explore a language's capabilities and idioms : Building a web framework is a great way to explore a language's capabilities and idioms Create something simple : Most web frameworks are complex beasts. Schematra aims to be minimal and understandable : Most web frameworks are complex beasts. Schematra aims to be minimal and understandable Enable modern web development: The framework is designed to work well with modern tools like Tailwind CSS and htmx, making it easy to build interactive web applications without heavy JavaScript frameworks. Although tbh this is completely agnostic to how the framework works, it's what most of my examples will use. Features Simple route definition with get and post functions and functions URL parameter extraction (e.g., /users/:id ) & body parsing ) & body parsing Middleware support Included naive session middleware (cookie storage) Development mode with REPL integration (leveraging emacs run-scheme ) ) Very simple hiccup inspired template system Built on top of the solid Spiffy web server Installation First, make sure you have CHICKEN Scheme installed. Once you have it installed, you can install schematra as an egg: git clone https://github.com/rolandoam/schematra cd schematra chicken-install That will download the dependencies and install the core modules so that they're available system-wide. Quick Start Here's a simple "Hello World" application: (import schematra) ; ; Define routes (get " / " ( lambda ( req params ) "Hello, World!")) (get " /users/:id " ( lambda ( req params ) ( let ((user-id (alist-ref " id " params equal?))) (format " User ID: ~A " user-id)))) (post " /submit " ( l...

First seen: 2025-08-03 23:19

Last seen: 2025-08-04 07:21