Skip to content

Minimal JHipster JDL Monolith Example

JHipster is a code generator that can produce modern web applications from textual models defined using the tool's JDL domain-specific language.

This post guides you through the process of generating and running a minimal monolitlhic blog web application like the one shown above.

  • Install JHipster
  • Create a new folder anywhere in your filesystem and a text file named blog.jdl in it
  • Add the following content to blog.jdl1, to specify the entities and configuration of the application
application {
  config {
    baseName blog
    applicationType monolith
    authenticationType jwt
    packageName com.jhipster.demo.blog
    prodDatabaseType mysql
    buildTool gradle
  }
  entities *
}

entity Blog {
  name String required minlength(3)
  handle String required minlength(2)
}

entity Post {
  title String required
  content TextBlob required
  date Instant required
}

entity Tag {
  name String required minlength(2)
}

relationship ManyToOne {
  Blog{user(login)} to User
  Post{blog(name)} to Blog
}

relationship ManyToMany {
  Post{tag(name)} to Tag{post}
}
Class Diagram

A graphical representation of the model above in the form of a UML class diagram is shown below.

  • In your terminal, run jhipster jdl blog.jdl
  • Start the web application by running gradle (or ./gradlew/gradlew.bat if Gradle is not installed in your system)
  • Open your browser and navigate to http://localhost:8080

  1. Based on Matt Raible's example


Last update: March 15, 2021