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.
The application uses Dropwizard.
And the code organize as this:
apicontains the data transfer objects used in the REST services APIresourcescontains the REST resource classescorecontains the business logic implemented as service classes and domain model classesdbcontains the persistence layer (data access objects)securitycontains all the security related functionality (JWT)
Simple JWT filter integrated in Dropwizard auth mechanism based on JJWT library.
The JWT secret key can be configured in config.yml file.
The application uses PostgreSQL database.
You need Java 21 or greater installed.
- Build the application
mvn clean install - Start PostgreSQL database
docker-compose -f docker-compose up db - Migrate application database schema to latest version
java -jar target/dropwizard-realworld-example-app-1.0-SNAPSHOT.jar db migrate config.yml - Start the application
java -jar target/dropwizard-realworld-example-app-1.0-SNAPSHOT.jar server config.yml - 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
- Build your application
mvn clean install - Start containers
docker-compose -f docker-compose.yml up
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
