Skip to content

Files

Latest commit

078fb20 · Mar 23, 2025

History

History
74 lines (50 loc) · 2.72 KB

README.md

File metadata and controls

74 lines (50 loc) · 2.72 KB

RealWorld Example App

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

How it works

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:

Getting started

Prerequisites

  • Java 24 or above
  • MyBatis (can be installed with SDKMAN)
  • Docker

Usage

1. Start up postgres container

$ docker compose up -d

2. Apply the migrations to the database

$ cd migrations
$ migrate up
$ cd ..

3. Run the server

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.