Skip to content

avaje/avaje-httpserver-realworld

This branch is 16 commits ahead of bowbahdoe/jdk-httpserver-realworld:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1d39633 · Jan 25, 2025

History

32 Commits
Jan 21, 2025
Dec 4, 2024
Jan 19, 2025
Jan 19, 2025
Jan 25, 2025
Dec 5, 2024
Jan 19, 2025
Dec 5, 2024
Jan 21, 2025
Jan 21, 2025
Dec 5, 2024
Jan 21, 2025
Nov 27, 2024
Dec 5, 2024
Dec 5, 2024
Jan 25, 2025
Jan 19, 2025

Repository files navigation

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 21 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.

About

avaje jdk http server example

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 89.9%
  • PLpgSQL 7.7%
  • Dockerfile 2.3%
  • Shell 0.1%