Skip to content

HeyItsBablu/flux-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flux CLI

A command-line tool for the Flux cross-platform native UI framework.
Write your app once in C++ and run it on Windows, Linux, and Android.


What is Flux

Flux is a C++ UI framework inspired by Flutter. You write a single main.cpp using Flux widgets and the CLI handles building and running it on each platform.

#include <flux/flux.hpp>

class MyApp : public Widget {
public:
    WidgetPtr build() override {
        return Scaffold(
            AppBar("My App"),
            Center(Text("Hello World")));
    }
};

WidgetPtr createApp(FluxUI *app) {
    return FluxApp(
        "My App",
        std::make_shared<MyApp>(),
        AppTheme::light(),
        false, 900, 700, false, false);
}

Prerequisites

All platforms

Windows

  • Visual Studio 2019 or later with Desktop development with C++ workload

Linux

  • GCC or Clang
sudo apt install build-essential cmake git curl

Installation

Windows

  1. Download flux.exe from Releases
  2. Move it to a folder of your choice, for example:
C:\tools\flux\flux.exe
  1. Add that folder to your system PATH:
    • Open Start → search Environment Variables
    • Click Environment Variables
    • Under System variables find Path → click Edit
    • Click New → paste C:\tools\flux
    • Click OK on all dialogs
  2. Open a new terminal and verify:
flux

Linux

curl -LO https://github.com/HeyItsBablu/flux-cli/releases/latest/download/flux
chmod +x flux
sudo mv flux /usr/local/bin/

Verify:

flux

macOS

curl -LO https://github.com/HeyItsBablu/flux-cli/releases/latest/download/flux-macos
chmod +x flux-macos
sudo mv flux-macos /usr/local/bin/flux

Verify:

flux

Creating an app

flux create my_app
cd my_app

This downloads the template from GitHub and generates:

my_app/
├── main.cpp          ← only file you need to edit
├── flux.json         ← app config, do not edit manually
├── windows/          ← platform build files, do not edit
└── linux/            ← platform build files, do not edit

Writing code

Open main.cpp in any editor (VS Code recommended) and write your app:

#include <flux/flux.hpp>

class MyApp : public Widget {
public:
    WidgetPtr build() override {
        return Scaffold(
            AppBar("My App"),
            Center(
                Container(
                    Center(Text("Hello World")))
                ->setWidth(300)
                ->setHeight(200)
                ->setBackgroundColor(Color::fromRGB(10, 10, 200))
                ->setBorderRadius(10)));
    }
};

WidgetPtr createApp(FluxUI *app) {
    return FluxApp(
        "My App",
        std::make_shared<MyApp>(),
        AppTheme::light(),
        false, 900, 700, false, false);
}

Running your app

Windows

flux run windows

This will:

  1. Locate your Visual Studio installation automatically
  2. Configure the build with CMake
  3. Build the app in Release mode
  4. Launch build/Release/app.exe

Your app folder will look like this after building:

my_app/
├── main.cpp
├── flux.json
├── windows/
├── linux/
└── build/              ← generated, do not commit
    └── Release/
        └── app.exe

Linux

flux run linux

This will:

  1. Configure the build with CMake
  2. Build the app in Release mode
  3. Launch build/app

App config — flux.json

Generated automatically by flux create. Do not edit manually.

{
    "name": "my_app",
    "package": "com.example.my_app"
}
Field Description
name App name shown in build output
package Android package identifier (for future Android support)

Project structure explained

my_app/
├── main.cpp
│   └── Your entire app lives here.
│       Implement createApp() to return your root widget.
│
├── flux.json
│   └── App config generated by flux create.
│
├── windows/
│   └── CMakeLists.txt
│       Platform build file for Windows.
│       Pulls flux framework via FetchContent.
│       Compiles main.cpp + flux/src/main_win32.cpp.
│       Do not edit.
│
└── linux/
    └── CMakeLists.txt
        Platform build file for Linux.
        Pulls flux framework via FetchContent.
        Compiles main.cpp + flux/src/main_linux.cpp.
        Do not edit.

How it works

flux create

  1. Downloads a zip of the flux-cli repo from GitHub using curl
  2. Extracts only the templates/ folder into your app directory
  3. Generates flux.json with your app name

flux run windows

  1. Searches common paths to find your Visual Studio installation
  2. Calls VsDevCmd.bat to set up the MSVC compiler environment
  3. Runs cmake -S windows -B build from your app root
  4. Runs cmake --build build --config Release
  5. Launches build/Release/app.exe

flux run linux

  1. Runs cmake -S linux -B build from your app root
  2. Runs cmake --build build
  3. Launches build/app

Troubleshooting

flux create fails

  • Make sure curl is available in your terminal
  • Make sure you have internet access
  • Make sure the HeyItsBablu/flux-cli repo is public on GitHub

flux run windows — Visual Studio not found

  • Make sure Visual Studio is installed with the Desktop development with C++ workload
  • Supported versions: VS 2019, VS 2022, VS 2026

flux run windows — CMake configure failed

  • Make sure CMake 3.22+ is installed and in PATH
  • Make sure Git is installed and in PATH (needed for FetchContent)

flux run linux — build failed

  • Make sure build tools are installed:
sudo apt install build-essential cmake git curl

App builds but does not launch

  • Make sure you are running flux run from your app root directory (where flux.json is)

Building flux CLI from source

git clone https://github.com/HeyItsBablu/flux-cli
cd flux-cli
cmake -B build -S .
cmake --build build --config Release

Binary will be at:

  • Windows: build/Release/flux.exe
  • Linux: build/flux

Roadmap

  • flux create — scaffold a new app
  • flux run windows — build and run on Windows
  • flux run linux — build and run on Linux
  • flux run android — build and run on Android
  • flux run ios — build and run on iOS
  • flux build — build without running
  • flux clean — clean build artifacts
  • Install script (curl | sh)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors