“If Racket is so great, why isn't it more widely used in web development?”
You’d love to make a site in Racket, the hottest Lisp out there. The Racket developers have built up a truly impressive system that’s a real pleasure to use.
All the ingredients appear to be there:
Built in web-server? Check.
High-quality, thorough documentation? Check and check.
A Lisp that feels like it comes from the future? Oh yeah.
But there’s precious little guidance out there on how to make real-world web sites with the Racket web server.
Sure, the official documentation contains a handful of simple examples. They’re a good start. But you’re not sure how to move from them to making a more complex site. There’s a big gap.
Maybe you start to suspect that Racket’s HTTP server is just a fancy toy.
Maybe you’ve even given up on the idea of hacking the web in Lisp.
That would be a real shame, because the Racket web server—while fairly lean compared with other web frameworks out there—is powerful and flexible.
And when you combine Racket’s HTTP server with the cutting-edge features of Racket, we’re talking about a system that web developers can drool over.
Even if you’re new to the web, Racket’s direct approach gives you a delightful way to dip your toes in without getting bogged down in a bazillion different frameworks and dependencies.
Enter Server: Racket
Server: Racket is an ebook all about real-world web development with Racket. In this ebook, you will learn how to make real-world web sites using the built-in Racket HTTP server.
We will build up a full-fledged site, step-by-step, and find out how to solve problems that the official documentation doesn’t talk about (not in detail, anyway, and not in any full-length tutorial).
We’ll dig in to these web development topics and see how to deal with them in Racket.
Part 1: HTTP à la Racket
Working with HTTP requests and responses entirely within Racket: no external systems, and using only modules that come standard with Racket.
- The servlet: In the beginning there was request? → response?
- Routes: URL-based dispatching
- Error handling
- Working with JSON data
- HTML templates
- Processing HTML forms
- Handling AJAX requests
Part 2: Connecting with external systems
Where we begin to connect to specialized systems running outside of Racket and use specialized packages that aren't included in a standard Racket installation.
- Using a relational database (db, sql)
- Session management (redis)
- Environment variables (dotenv)
- JSON Schema validation (argo)
- Models (object-relational mapping) (racquel)
- Sending HTTP requests (http)
- Caching with memcached (memcached)
- Database migrations with Phinx
- Racket and Docker
- A CRUD-style HTTP API
- Deploying a Racket site behind a proxy server
The ebook is a 184-page PDF, together with Racket starter code to help jump-start your Racket web adventures.
What others are saying
Server: Racket was essential reading as I built my first e-commerce site from scratch with Racket. It’s a terrific, practical book with lots of useful ideas and examples.
About the author
I’m Jesse Alama. I’ve been hacking Scheme and Lisp since 1996. And I love building web sites. I’m a full-stack developer by day. And by night, too. I write about these topics over at lisp.sh. I made the Argo (JSON Schema validator), json-pointer (a notation for referring to JSON data), and uri-template (RFC 6570) Racket packages. I'm the author of the entry on the lambda calculus in the Stanford Encyclopedia of Philosophy and have worked as a researcher in mathematics and computer science, primarily in automated theorem proving.
In my view, Lisp has a lot of potential for shaping how we develop for the web. The flexibility and power of Lisp is well-suited to taking on the web’s thorny problems.
I’m happy to share with you what I’ve learned so far about making web sites using Racket, a truly world-class Lisp.
You'll get: A 184-page PDF and sample code