Glotela
A single-binary batteries-included web server based on the Fiber framework, embedding Clojure (Glojure) for dynamic content. With nREPL and a reasonably complete library of functions for productive web development
Why Glotela?
Web development involves two distinct concerns:
- Server scaffolding: HTTP handling, middleware, routing, databasesβundifferentiated infrastructure work
- Domain logic: Business rules, data modeling, content generationβthe unique value of your application
Most frameworks force you to use one language for both. Glotela separates these concerns:
- Go handles infrastructure: Fast, type-safe HTTP server with common middleware built-in
- Glojure handles logic: Expressive, dynamic language for your application code
The result is a single static binary that’s easy to deploy, with hot-reloading during development.
Features
- Single binary deployment - No runtime dependencies, just deploy and run
- Hot-reloading - Changes to Clojure files reload automatically during development
- SQLite3 integration - Embedded database with auto-migrations
- Batteries included - Common middleware configured, not scaffolded:
- Request logging
- CORS
- Compression
- Static file serving
- Caching (planned)
- EDN configuration - Configure your application in
glotela.edn - Go interop - Call Go functions directly from Clojure when needed
Getting Started
Prerequisites
- Go 1.21 or later
Installation
# Clone the repository
git clone https://github.com/yourusername/glotela.git
cd glotela
# Build the application
go build -o glotela ./cmd/glotela
Running
# Run the server
./glotela
# Server starts on port 3000 by default
# Visit http://localhost:3000
Project Structure
.
βββ cmd/glotela/ # Application entry point
β βββ main.go
βββ pkg/
β βββ config/ # EDN configuration parsing
β βββ clojure/ # Glojure environment management
β βββ handlers/ # HTTP request handlers
βββ site/ # Your Clojure application code
β βββ index.clj # Request handler
βββ glojure/ # Embedded Glojure implementation
βββ glotela.edn # Application configuration
Configuration
Configure your application in glotela.edn:
{:server {:port 3000
:host "0.0.0.0"}
:site {:directory "site"}}
Writing Handlers
Create Clojure files in the site/ directory. Here’s a simple handler:
(ns site.index)
(defn -main [request]
{:status 200
:content-type "text/html"
:body "<h1>Hello from Glojure!</h1>"})
The request map contains:
- :method - HTTP method (GET, POST, etc.)
- :uri - Request path
- :headers - Request headers as a map
- :params - Query parameters
- :body - Request body
Return a map with:
- :status - HTTP status code
- :content-type - Response content type
- :body - Response body
Development
Changes to .clj files are automatically detected and reloaded. No server restart needed.
License
MIT