Beer is a lightweight Java web framework built on Jetty. It provides WebSocket support, REST routing, static file serving, filters, and more, allowing you to quickly create scalable Java backend services. Its main usage is to build RESTful APIs and serve static content, such as in SPA (Single Page Application) scenarios, all packaged and shipped as a single JAR.
Under the hood, Beer uses classic Java servlets but eliminates most of the boilerplate code, offering a clean API for defining routes and utilities for common request and response tasks. Inspired by Spark Java and Express.js, Beer is a thin layer that gives you more control and direct access to pure Java code. There is no hidden magic, heavy abstraction, or need to extend any classes.
Define GET, POST, PUT, DELETE handlers with ease.
Define WebSocket handlers just as easily.
Match dynamic paths effortlessly.
Use patterns like /myPath/:param.
Add pre-processing, logging, or CORS in one line.
Host static content alongside your API.
Configure SSL out of the box for secure communication.
Return clear JSON error responses with minimal effort.
Robust, proven, and production-ready engine.
Parse requests, query parameters, headers, and easily generate JSON responses.
Upload, download, delete, and list files with simple helper methods.
Generate and verify JWT tokens and create secure random keys for authentication.
Manage server IP, port, Jetty thread settings, SSL certificates, and logging.