Getting Started
Everything a new user needs to download, install, and run NioFlow quickly.
Prerequisites
Before starting, ensure you have the following installed on your machine:
- Java 17+: Download Eclipse Temurin
- Node.js (for CLI): Download Node.js
Installation
NioFlow CLI (Recommended)
The fastest way to get started. The CLI handles scaffolding, environment setup, and Maven management for you.
install-cli
1# Install globally2npm install -g @jhanvi857/nioflow-cli34# Scaffold a new project5nioflow new my-app6cd my-app78# Start development with hot-reload9nioflow dev
Manual Maven Dependency
If you prefer managing your own pom.xml, add the dependency directly.
pom.xml
1<dependency>2 <groupId>io.github.jhanvi857</groupId>3 <artifactId>nioflow-framework</artifactId>4 <version>1.4.0</version>5</dependency>
Setup Your First App
App.java
1import io.github.jhanvi857.nioflow.NioFlowApp;23public class App {4 public static void main(String[] args) {5 NioFlowApp app = new NioFlowApp();67 app.get("/", ctx -> ctx.send("NioFlow is running"));89 app.listen(8080);10 }11}
Feature Flags (Safe Defaults)
.env
1# disabled by default2NIOFLOW_CHAOS_ENABLED=false3NIOFLOW_REPLAY_ENABLED=false4NIOFLOW_WATCH=false56# enable intentionally in non-prod debugging sessions7# NIOFLOW_CHAOS_ENABLED=true8# NIOFLOW_REPLAY_ENABLED=true9# NIOFLOW_WATCH=true10
Port Registration
In cloud providers, use PORT env var. In local, default to 8080.
port-config
1int port = 8080;2String value = System.getenv("PORT");3if (value != null && !value.isBlank()) {4 port = Integer.parseInt(value);5}6app.listen(port);
Suggested Layout
project-structure
1my-app/2 src/main/java/com/example/3 App.java4 controller/5 TaskController.java6 auth/7 AuthController.java8 repository/9 TaskRepository.java10 model/11 Task.java12 src/main/resources/public/13 index.html14 pom.xml