LogoFlux Docs

Quick Start

Get started with Flux quickly by following these simple steps to set up your environment and run your first command.


Prerequisites

Before you begin, ensure you have the following prerequisites:

  • Installed Flux on your system
  • Node.js 16.0.0 or later
  • Basic familiarity with package managers and the command line

Creating a New Project

Create a New Project Directory

Let's start by creating a new project with Flux. Open your terminal and run the following command:

Terminal
flux init my-project

This command creates a new directory called my-project with a basic project structure and a default flux.config.js file.

Change into your project directory by running:

Terminal
cd my-project

Project Structure

The basic project structure created by Flux looks like this:

index.js
app.js
flux.config.js
package.json
README.md

The flux.config.js file contains the configuration for your Flux project. You can customize this file to suit your needs.


Installing Dependencies

Let's add some dependencies to our project. With Flux, you can use the add command to install packages:

Terminal
flux add react react-dom

This command installs the React and React-DOM packages and adds them to your project's dependencies.


Running Scripts

Add a Script to Your Project

You can add scripts to your project by modifying the package.json file. For example, you can add a script to start your development server:

{
    "scripts": {
        "dev": "tsx src/index.ts",
        "build": "tsx src/index.ts --build"
    }
}

Start the Development Server

To start your project, you can use the run command. For example, to start a development server, run:

Terminal
flux run dev

This command starts the development server.

Build Your Project

To build your project for production, you can run:

Terminal
flux run build

This command compiles your project and prepares it for deployment.


Common Commands

Here are some common Flux commands you can use:

Install packages using Flux
Terminal
flux install <package-name> 
Install all dependencies listed in your package.json:
Terminal
flux install
Uninstall packages using Flux
Terminal
flux uninstall <package-name>
Uninstall all dependencies listed in your package.json:
Terminal
flux uninstall
Run a script
Terminal
flux run <script-name>