Giter VIP home page Giter VIP logo

quarkus-monorepo's Introduction

Quarkus PrimeReact


License: MIT Actions CI Quarkus React.js Typescript

If you like this project, please consider supporting me โค๏ธ

GitHub Sponsor PayPal

This monorepo is a minimal CRUD service exposing a couple of endpoints over REST, with a front-end based on React so you can play with it from your browser.

While the code is surprisingly simple, under the hood this is using:

  • RESTEasy to expose the REST endpoints and documented with OpenAPI
  • Hibernate ORM with Panache to perform the CRUD operations on the database
  • PostgreSQL database; automatically starts an embedded DB
  • Liquibase to automatically update database
  • Quinoa to handle allowing this monorepo to serve React and Java code
  • React + PrimeReact for a top notch user interface including lazy datatable
  • TanStack Query for powerful asynchronous state management for TypeScript
  • Orval to generate TanStack Query client Typescript from OpenAPI definition
  • React Hook Forms to validate user input data

Requirements

To compile and run this demo you will need:

  • JDK 17+
  • Docker

In addition, you will need either a PostgreSQL database, or Docker to run one.

Developing

Live coding with Quarkus

The Maven Quarkus plugin provides a development mode that supports live coding. To try this out:

$ ./mvnw quarkus:dev

Watch as it starts up a temporary PostreSQL database just for this session. In this mode you can make changes to the code and have the changes immediately applied, by just refreshing your browser.

๐Ÿ’ก Hot reload works add a new REST endpoint and see it update in realtime. Try it!

Now open your web browser to http://localhost:8080/ to see it in action.

Quarkus Monorepo

Building

Run Quarkus in JVM mode

When you're done iterating in developer mode, you can run the application as a conventional jar file.

First compile it:

$ ./mvnw package

Connection properties for the Agroal datasource are defined in the standard Quarkus configuration file, src/main/resources/application.properties.

Then run it with:

$ java -jar ./target/quarkus-app/quarkus-run.jar

Navigate to: http://localhost:8080/

๐Ÿ’ก Have a look at how fast it boots. Or measure total native memory consumption...

Run Quarkus as a native application

You can also create a native executable from this application without making any source code changes. A native executable removes the dependency on the JVM: everything needed to run the application on the target platform is included in the executable, allowing the application to run with minimal resource overhead.

Compiling a native executable takes a bit longer, as GraalVM performs additional steps to remove unnecessary codepaths. Use the native profile to compile a native executable:

$ mvn -Pnative

After getting a cup of coffee, you'll be able to run this binary directly where ${version} is the current project version:

$ docker run -i --rm -p 8080:8080 melloware/quarkus-primereact:${version}

๐Ÿ’ก Please brace yourself: don't choke on that fresh cup of coffee you just got. Now observe the time it took to boot, and remember: that time was mostly spent to generate the tables in your database and import the initial data.

See it in your browser

Navigate to: http://localhost:8080/index.html

quarkus-monorepo's People

Contributors

dependabot[bot] avatar melloware avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.