🚧 FLIN is in active development. Coming soon! Thank you for your patience. Join Discord for updates

The 4-Line Counter

This is everything you need for a working counter app:

app/index.flin
count = 0

<button click={count++}>
    {count}
</button>

Run it:

$ flin dev embedded/starter

What's Happening?

count = 0

This declares a reactive variable. In React, you'd need useState. In Vue, you'd need ref. In FLIN, all variables are reactive by default.

click={count++}

This is an event handler. When the button is clicked, increment count. No arrow functions, no callbacks — just the action.

{count}

This is template interpolation. The button displays the current value of count, and updates automatically when it changes.

💡 No Imports

Notice there are no import statements. FLIN auto-discovers everything. Components, entities, and functions are all available automatically.

Adding More Features

Let's enhance the counter with increment and decrement:

app/index.flin
count = 0

<div>
    <button click={count--}>-</button>
    <span>{count}</span>
    <button click={count++}>+</button>
</div>

FLIN vs React

Here's the same counter in React for comparison:

Counter.jsx (React)
import { useState } from 'react';

export default function Counter() {
    const [count, setCount] = useState(0);

    return (
        <button onClick={() => setCount(count + 1)}>
            {count}
        </button>
    );
}
Aspect React FLIN
Lines of code 11 4
Import statements Required None
State management useState hook Automatic
Event handlers Arrow functions Direct expressions

Next Steps

Now that you understand the basics, try the built-in sample apps: