NioFlow: A Configurable Java Micro-Framework.
NioFlow is a minimalistic Java HTTP framework focusing on explicit programmatic configuration. It utilizes a hybrid architecture: NIO Selector for connection acceptance and a bounded thread pool for blocking request processing.
$ npm install -g @jhanvi857/nioflow-cli
[INFO] nioflow: Linked global binary successfully.
$ nioflow dev
[INFO] Watcher: Monitoring src/main/java...
[INFO] Bootstrap: Starting NioFlow v1.4.0
[INFO] NIO: ServerSocketChannel on 0.0.0.0:8080
[READY] Application live with Hot Reload enabled.
$ curl http://localhost:8080/metrics
HTTP/1.1 200 OK
{ "req_total": 1205, "p95_ms": 47.7 }
Fast Track Installation
Get up and running in seconds. The NioFlow CLI manages your Java environment, dependencies, and project scaffolding so you can focus on building routes.
- ✓ No manual JAR downloads required
- ✓ Automatic Maven Wrapper integration
- ✓ Cross-platform support (Windows, macOS, Linux)
# Install the CLI
npm install -g @jhanvi857/nioflow-cli
# Scaffold & Start
nioflow new my-app
cd my-app
nioflow dev
Production Resilience Pack
Stop worrying about infrastructure. NioFlow ships with native middleware for resilience and observability that you normally spend weeks configuring.
Chaos Injection
Validate frontend resilience by injecting latency and errors into your routes.
Circuit Breaker
Fast-fail when downstream services are struggling to prevent cascading outages.
Request Replay
Record and replay production-like requests locally for rapid debugging.
Audited for CVEs post-release. CRLF injection, XFF spoofing, JWT gaps, and HTTP request smuggling patched in v1.4.0.
Under the Hood: System Mechanics
Built on Java NIO and robust architectural patterns, NioFlow provides an incredibly fast, non-blocking foundation for building scalable web applications and RESTful APIs.
Hybrid NIO Architecture
Built on Java's java.nio. Connection tracking and event loops use efficient Selectors, while request processing is handled by a bounded worker pool.
Native HTTPS Security
Direct SSLContext integration allows raw SocketChannel handoffs to SSLSocketFactory, dropping the requirement for Nginx proxies entirely for HTTPS.
Zero-Copy Memory
Hardware-accelerated Direct Memory Access via FileChannel.transferTo(). Static files hit the socket without crossing into JVM user-space memory.
Async Database Offload
Prevent worker thread blocking using CompletableFuture. Operations hit HikariCP and PostgreSQL on a dedicated secondary loop, ensuring maximum throughput.
Request Hedging
Native tail-latency reduction. Automatically fire backup requests when primary executions cross latency thresholds to keep p99s consistently low.
Observability Pack
Native OpenTelemetry tracing, Prometheus metrics, and structured JSON logging. Get full visibility into your distributed system with zero external agents.
Clean Controller Abstraction
While the engine is complex at the socket layer, registering business logic remains declarative and heavily typed. Look at how easy it is to spin up new HTTP endpoints.
1public class ServerApp {2 public static void main(String[] args) {3 // Automatically loads .env file using io.github.cdimascio:dotenv-java4 NioFlowApp app = new NioFlowApp();56 // Middleware Stack7 app.use(new LoggerMiddleware());8 app.use(new RateLimitMiddleware(100, Duration.ofMinutes(1)));910 // Handlers & Async DB offload11 app.get("/api/orders", new OrderController()::list);1213 // Global Error Intercept14 app.onError((err, ctx) -> ctx.status(500).json("Fail"));1516 // Graceful Shutdown17 Runtime.getRuntime().addShutdownHook(new Thread(() -> {18 app.drainAndStop(30, TimeUnit.SECONDS);19 }));2021 // Native TLS & Environment config22 int port = Env.getAsInt("PORT", 8080);23 app.listen(port);24 }25}
Built for engineers who want to understand the stack, not hide from it.
The framework avoids reflection and hidden dependency injection containers. Authored by Jhanvi Patel, NioFlow ensures all dependencies and middleware flows are explicit and predictable.
<dependency> <groupId>io.github.jhanvi857</groupId> <artifactId>nioflow-framework</artifactId> <version>1.4.0</version> </dependency>