Skip to content

ERD-Codegen/java-liquibase

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RealWorld Example App using Java 11 and Dropwizard

Dropwizard + JDBI3 codebase that tries to adhere to the RealWorld spec and API.

This codebase was created to demonstrate a backend application built with Dropwizard including CRUD operations, authentication, pagination and more.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

How it works

The application uses Dropwizard.

And the code organize as this:

  1. api contains the data transfer objects used in the REST services API
  2. resources contains the REST resource classes
  3. core contains the business logic implemented as service classes and domain model classes
  4. db contains the persistence layer (data access objects)
  5. security contains all the security related functionality (JWT)

Security

Simple JWT filter integrated in Dropwizard auth mechanism based on JJWT library.

The JWT secret key can be configured in config.yml file.

Database

The application uses PostgreSQL database.

Getting started

You need Java 21 or greater installed.

How to start the RealWorld application

  1. Build the application
    mvn clean install
    
  2. Start PostgreSQL database
    docker-compose -f docker-compose up db
    
  3. Migrate application database schema to latest version
    java -jar target/dropwizard-realworld-example-app-1.0-SNAPSHOT.jar db migrate config.yml
    
  4. Start the application
    java -jar target/dropwizard-realworld-example-app-1.0-SNAPSHOT.jar server config.yml
    
  5. To verify that the application is running check the following URLs
    http://localhost:8081 -> metrics/health checks
    http://localhost:8080/api/ -> APIs
    

or use docker

  1. Build your application
    mvn clean install
    
  2. Start containers
    docker-compose -f docker-compose.yml up
    

How to run Sonar code quality check

Sonar can be used to analyse code quality. You can start a local Sonar server (accessible on http://localhost:9001) with:

docker-compose -f sonar.yml up -d

Wait for Sonar to start (check http://localhost:9001), then run a Sonar analysis:

 mvn clean install sonar:sonar -Dsonar.password=admin -Dsonar.login=admin -Dsonar.host.url=http://localhost:9001 

About

Simple case of a RealWorld app REST api using Dropwizard

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Java 99.0%
  • Other 1.0%