A simple blog application built with the JAQ Stack (Java, Angular, Helidon, MongoDB).
- Java: 21
- Helidon MP: 4.3.1
- Angular: 20.0.0
- MongoDB: 3.9.1 (Java Driver)
- Maven: For build and dependency management
- Create, read blog posts
- RESTful API backend with Helidon MP
- Modern Angular 20 frontend
- MongoDB database integration
- CORS support for cross-origin requests
- JDK 21 or higher
- Maven 3.6+
- Node.js 18+ (for Angular development)
- MongoDB (running locally on default port 27017)
The application uses MongoDB with the following configuration:
- Database:
jaqstack - Collection:
blogposts
Make sure MongoDB is running before starting the application.
mvn clean packageThis will create an executable JAR file at target/simpleblog.jar.
cd ui.resources
npm install
ng buildThe built frontend will be in ui.resources/dist/ and will be automatically copied to the JAR during the Maven build.
Make sure MongoDB is running on localhost:27017.
java -jar target/simpleblog.jarThe server will start on http://localhost:8080.
cd ui.resources
ng serveThe Angular app will be available at http://localhost:4200.
- GET
/blog/posts- Get all blog posts - GET
/blog/post/{id}- Get a blog post by ID - POST
/blog/post- Create a new blog post
curl -X POST http://localhost:8080/blog/post \
-H "Content-Type: application/json" \
-d '{"title":"My Blog Post","content":"This is the content","author":"John Doe"}'curl http://localhost:8080/blog/postssimpleblog/
├── src/
│ └── main/
│ ├── java/
│ │ └── com/jaqstack/helidon/simpleblog/
│ │ ├── BlogPost.java # Blog post model
│ │ ├── BlogResource.java # REST endpoints
│ │ ├── BlogService.java # Business logic
│ │ ├── DataService.java # MongoDB operations
│ │ └── Main.java # Application entry point
│ └── resources/
│ └── META-INF/
│ ├── beans.xml # CDI configuration
│ └── microprofile-config.properties
├── ui.resources/ # Angular frontend
│ ├── src/
│ │ └── app/
│ │ ├── app.component.* # Root component
│ │ ├── home/ # Home page component
│ │ ├── blog-detail/ # Blog detail component
│ │ └── blog.service.ts # API service
│ └── dist/ # Built frontend (copied to JAR)
└── pom.xml # Maven configuration
The application includes CORS headers to allow the Angular frontend (running on port 4200) to communicate with the backend (running on port 8080). CORS is configured in BlogResource.java with support for preflight OPTIONS requests.
The generation of native binaries requires an installation of GraalVM 22.1.0+.
You can build a native binary using Maven as follows:
mvn -Pnative-image install -DskipTestsThe generation of the executable binary may take a few minutes to complete depending on your hardware and operating system. When completed, the executable file will be available under the target directory.
curl -s -X GET http://localhost:8080/health# Prometheus Format
curl -s -X GET http://localhost:8080/metrics
# JSON Format
curl -H 'Accept: application/json' -X GET http://localhost:8080/metricsdocker build -t simpleblog .docker run --rm -p 8080:8080 simpleblog:latestMIT