This project uses Quarkus and a React application based on Create React App in a monorepo. GraphQL is used as the API, with MongoDB as the main store and styled with Tailwind CSS and components.
Developing both front-end and back-end in tandem needs some connecting. The GraphQL schema is accessible while the back-end is running, typically at localhost:8080/graphql/schema.graphql
. Pantry uses the graphql-codegen
library to query for that endpoint and automatically generate types for the front-end to utilize schema changes. This can be run from the src/main/webui
directory:
yarn codegen
You can run the application in dev mode that enables live coding using:
mvn quarkus:dev
You must have Yarn installed for Quinoa to build the front-end into the server resources, or set the following environment variables:
QUARKUS_QUINOA_PACKAGE_MANAGER_INSTALL=true
QUARKUS_QUINOA_PACKAGE_MANAGER_INSTALL_NODE_VERSION=19.4.0 #e.g.
You can create a native executable using:
mvn package -Pnative
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
mvn package -Pnative -Dquarkus.native.container-build=true
You can then execute your native executable with: ./target/pantry-1.0.0-SNAPSHOT-runner
If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.
There are separate Dockerfiles available for different use cases in building Pantry. Dockerfile.multistage
was created in order to build the entire application from source with Docker as the only dependency. It uses a distroless image so the image size is small. Other options are available as well (JVM, native, etc.) but require Yarn and Maven to prep the source for the image.
For instance, to build a JVM Docker image of Pantry, run:
# Build the Java jar - Quinoa runs `yarn` to build the front-end
maven package
# Build the Docker image based on the jar
docker build -t kjhoerr/pantry:jvm -f src/main/docker/Dockerfile.jvm .
This project is licensed under the Blue Oak Model License 1.0.0.