Skip to content

GuicedEE/GuicedVertxWeb

Repository files navigation

GuicedVertxWeb

Java Maven Vert.x GuicedEE License

Reactive HTTP/HTTPS server bootstrap for GuicedEE applications using Vert.x 5.

Build high-performance RESTful APIs, WebSocket services, and web applications with dependency injection, automatic lifecycle management, and pluggable SPI configurators. Full support for TLS/HTTPS, static content serving, file uploads, CORS, and authentication.

✨ Features

  • πŸš€ Reactive: Built on Vert.x 5 for non-blocking, high-throughput request handling
  • πŸ’‰ Dependency Injection: Seamless GuicedEE integration with automatic lifecycle management via IGuicePostStartup
  • πŸ”Œ Extensible SPI: Three extension points for customizing server options, server instance, and router configuration
  • πŸ”’ Security-First: Native support for HTTPS/TLS with JKS and PKCS#12 keystores; pluggable authentication/authorization
  • πŸ“¦ Zero-Config Defaults: Sensible defaults with environment-based overrides (HTTP, HTTPS, TLS, ports)
  • 🎯 Recommended Addons: Leverage GuicedEE dedicated addons for REST, WebSocket, GraphQL, and web services
  • πŸ“Š Full Module System: JPMS (Java Module System) compliant with automatic SPI discovery via ServiceLoader
  • βœ… Best Practices: Built-in patterns for CORS, file uploads, static content, middleware composition, and error handling

🎯 Quick Start

1. Clone & Initialize

git clone https://github.com/GuicedEE/GuicedVertxWeb.git
cd GuicedVertxWeb
git submodule update --init --recursive  # Initialize enterprise rules repository

2. Configure Environment

cp .env.example .env
# Edit .env with your settings (ports, HTTPS keystore, debug flags, etc.)

3. Build & Run

mvn clean verify
mvn exec:java@run  # or your IDE's run configuration

The HTTP server starts on port 8080 (HTTPS on 8443 if enabled). Check logs for confirmation.

πŸ“š Documentation

Project Structure

  • RULES.md β€” Technology stack, deployment standards, and design patterns
  • GUIDES.md β€” How-to guides for common tasks (REST APIs, WebSockets, HTTPS, etc.)
  • GLOSSARY.md β€” Domain terminology with cross-references to enterprise topics
  • IMPLEMENTATION.md β€” Current implementation status and validation approach
  • PACT.md β€” Collaboration agreement and stage approval process
  • docs/PROMPT_REFERENCE.md β€” Stack traceability and prompt loading instructions

Architecture & Design

  • docs/architecture/README.md β€” Architecture decision records and diagrams
    • C4 context, container, and component diagrams
    • HTTP request sequence flow
    • Server startup sequence
    • Entity-relationship diagrams (configuration)

Enterprise Rules

πŸ› οΈ Development

Tech Stack

  • Java 25 LTS β€” Latest long-term support release
  • Maven 3.9+ β€” Build automation and dependency management
  • Vert.x 5 β€” Reactive, event-driven framework
  • GuicedEE Core + Client β€” Dependency injection and lifecycle management
  • JSpecify β€” Nullness annotations for static analysis
  • CRTP Fluent APIs β€” Type-safe builder patterns without Lombok
  • JPMS β€” Java Module System with automatic SPI discovery

Key SPI Surfaces

Three extension points for customizing the web server:

  1. VertxHttpServerOptionsConfigurator β€” Customize HttpServerOptions before server creation (ports, TLS, compression, etc.)
  2. VertxHttpServerConfigurator β€” Configure the HttpServer instance after creation (WebSocket handlers, metrics, custom bindings)
  3. VertxRouterConfigurator β€” Add routes to the Router (REST endpoints, static content, middleware, error handlers)

Implementations are discovered via ServiceLoader and executed in order. Register via JPMS provides...with or META-INF/services.

Startup Hook

  • VertxWebServerPostStartup implements IGuicePostStartup and orchestrates the full server initialization sequence
  • Automatic lifecycle management: server startup on app startup, graceful shutdown on app exit
  • Environment-based configuration via .env file or system properties

βš™οΈ Configuration

Environment Variables

All configuration is driven by .env file (or system properties/environment). Copy .env.example and customize:

Variable Default Purpose
HTTP_ENABLED true Enable HTTP server
HTTP_PORT 8080 HTTP listen port
HTTPS_ENABLED false Enable HTTPS server
HTTPS_PORT 8443 HTTPS listen port
HTTPS_KEYSTORE β€” Path to JKS or PKCS#12 keystore file
HTTPS_KEYSTORE_PASSWORD β€” Keystore password
BASE_URL β€” Public base URL (for absolute links)
LOG_LEVEL INFO Logging level (DEBUG, INFO, WARN, ERROR)
ENABLE_DEBUG_LOGS false Verbose Vert.x activity logging
VERTX_EVENT_LOOP_POOL_SIZE β€” Event loop thread pool size
VERTX_WORKER_POOL_SIZE β€” Worker thread pool size

For secrets management, see rules/generative/platform/secrets-config/env-variables.md.

HTTPS/TLS Setup

GuicedVertxWeb auto-detects keystore format by file extension:

  • .jks β†’ JKS keystore
  • .pfx, .p12, .p8 β†’ PKCS#12 keystore

Generate a self-signed certificate for development:

# JKS keystore
keytool -genkey -alias selfsigned -keyalg RSA -keysize 2048 \
  -validity 365 -keystore keystore.jks -storepass changeit

# PKCS#12 keystore
keytool -genkey -alias selfsigned -keyalg RSA -keysize 2048 \
  -validity 365 -keystore keystore.p12 -storetype PKCS12 -storepass changeit

πŸš€ Using GuicedEE Addons (Recommended)

For common use cases, GuicedEE provides higher-level addons with automatic features:

  • guicedee-rest β€” REST/CRUD APIs with OpenAPI/Swagger documentation, parameter validation, content negotiation, role-based access control
  • guicedee-websocket β€” WebSocket connections with lifecycle management, message routing, automatic reconnection
  • guicedee-webservice β€” SOAP/XML web services with automatic WSDL generation, MTOM attachments
  • guicedee-graphql β€” GraphQL schemas with automatic introspection, query validation, subscriptions
  • GuicedEE Security β€” Authorization, authentication, RBAC with declarative annotations

See use-cases.rules.md for implementation examples and when to use lower-level Vert.x Web APIs directly.

πŸ”„ CI/CD

Continuous integration via GitHub Actions ([.github/workflows/ci.yml](.github/workflows/ci.yml)):

name: Maven Package
on:
  workflow_dispatch:
  push:
jobs:
  GuicedInjection:
    uses: GuicedEE/Workflows/.github/workflows/projects.yml@master
    with:
      baseDir: ''
      name: 'Guiced Vert.x Web'
    secrets:
      USERNAME: ${{ secrets.USERNAME }}
      USER_TOKEN: ${{ secrets.USER_TOKEN }}
      SONA_USERNAME: ${{ secrets.SONA_USERNAME }}
      SONA_PASSWORD: ${{ secrets.SONA_PASSWORD }}

Required repository secrets:

  • USERNAME β€” GitHub username for deployments
  • USER_TOKEN β€” GitHub personal access token
  • SONA_USERNAME β€” Sonatype (Maven Central) username
  • SONA_PASSWORD β€” Sonatype password

Do not commit secrets. Configure via GitHub repository settings β†’ Secrets and variables β†’ Actions.

🀝 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork & Branch: Create a feature branch (git checkout -b feature/my-feature)
  2. Follow the Pact: Review PACT.md for collaboration standards and approval stages
  3. Run Tests: mvn clean verify (Java 25 required)
  4. Update Rules: If behavior changes, update relevant .rules.md files in rules/generative/backend/guicedee/web/
  5. Commit & Push: Descriptive commit messages, push to your fork
  6. Pull Request: Open a PR with clear description and reference relevant issues

Development Workflow

# Build and test locally
mvn clean install

# Run the application
mvn exec:java@run

# Format code
mvn spotless:apply

# Run only tests
mvn test

πŸ“‹ Project Status

  • Current Version: See pom.xml for latest release
  • Java Compatibility: Java 25 LTS minimum
  • Maven Compatibility: Maven 3.9+
  • Vert.x Compatibility: Vert.x 5.0+
  • Status: Active development with enterprise rules maintained in submodule

πŸ“œ License

This project is licensed under the Apache License 2.0. See LICENSE file for details.

About

A Vertx Web Configuration module

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages