Welcome to Beer

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.

Features

Simple route handling

Define GET, POST, PUT, DELETE handlers with ease.

WebSocket handling

Define WebSocket handlers just as easily.

Wildcard routes

Match dynamic paths effortlessly.

Path parameters support

Use patterns like /myPath/:param.

Filters & CORS

Add pre-processing, logging, or CORS in one line.

Serve static files

Host static content alongside your API.

HTTPS support

Configure SSL out of the box for secure communication.

Centralized exception handling

Return clear JSON error responses with minimal effort.

Runs on Jetty

Robust, proven, and production-ready engine.

Request & JSON Utilities

Parse requests, query parameters, headers, and easily generate JSON responses.

File Management

Upload, download, delete, and list files with simple helper methods.

Authentication Helpers

Generate and verify JWT tokens and create secure random keys for authentication.

Server Configuration

Manage server IP, port, Jetty thread settings, SSL certificates, and logging.