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:

Most frameworks force you to use one language for both. Glotela separates these concerns:

The result is a single static binary that’s easy to deploy, with hot-reloading during development.

Features

Getting Started

Prerequisites

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