Avaje + Ebean + JDK HTTP Server codebase containing real world examples (CRUD, JWT auth, advanced patterns, etc) that adheres to the RealWorld spec and API.
This codebase was created to demonstrate a lightweight fully modular backend application built with the JDK HTTP Server including CRUD operations, authentication, routing, pagination, and more.
For more information on how this works with other frontends/backends, head to the RealWorld repo.
It is deployed to https://avaje-httpserver-realworld.onrender.com
This is built up of a few components. Primarily:
- The
jdk.httpserver
module as the HTTP Server implementation. - Avaje Jex to configure and provide routing abstraction over the
jdk.httpserver
. This is the API programmed against - Ebean ORM for the Connection Pooling and ORM
- Postgresql as the database
- RainbowGum for logging
Then, serving specific tasks:
- Avaje Jsonb for reading and writing JSON
- Avaje HTTP Server for generating routing code for Jex from Jax-RS style controllers
- Avaje Inject for Dependency Injection
- Avaje Config for reading configuration files
- Avaje Validation for bean validation
- dev.mccue.jdbc for
SQLFragment
- java-jwt for JWT token validation
- org.slf4j as a logging facade
- slugify for turning text into a url sage slug
- Java 21 or above
- MyBatis (can be installed with SDKMAN)
- Docker
$ docker compose up -d
$ cd migrations
$ migrate up
$ cd ..
You can either
- open the project in your editor
- run it through terminal (
./run.sh"
) - run it through docker
$ docker build -t real .
$ docker run real
You can then use the provided postman collection to send requests.
The .env
file for this project is committed to the repo. Note that in general this is a bad idea/practice, but the
only secrets here are for the local database connection so it's fine.