Can You Build an Entire Application Around a Single Boolean?

Can You Build an Entire Application Around a Single Boolean?

●2 ●25 ●87
calendar_today ago • schedule10 min read

Can You Build an Entire Application Around a Single Boolean?

There is something fascinating about the smallest decisions in software engineering. Sometimes, an entire system begins with a complicated architecture diagram, dozens of database tables, several API endpoints, and a collection of services communicating with one another. Other times, it begins with something remarkably small:

true or false.

A Boolean is one of the simplest data types in programming. It represents two possible states: true and false. There is no long list of values, no complicated structure, and no elaborate hierarchy. Just two possibilities.

Yet, behind those two possibilities lies an interesting engineering question: Can you build an entire application around a single Boolean?

At first, the idea sounds almost ridiculous. How could an application possibly operate with only two possible states? Where would the user accounts go? How would the application remember previous activities? How could it manage different operations, permissions, preferences, and business rules?

But consider the question from another perspective.

What if the application did not need to understand everything about the world? What if its entire purpose was to make one particular decision, observe the consequences, and respond accordingly?

Suddenly, a single Boolean becomes much more interesting.

The Architecture of Two Possibilities

Imagine building an application whose entire purpose is to answer one question:

Is the system active?

The answer can only be true or false.

let isActive = false;

function activate() {
    isActive = true;
}

function deactivate() {
    isActive = false;
}

function getStatus() {
    return isActive;
}

This is a tiny application, but it already has a recognizable purpose. It has a state, operations that modify that state, and a way to retrieve information about its current condition.

We could build a user interface around it, expose its functionality through an API, or connect it to other software.

For example:

app.get("/status", (req, res) => {
    res.json({
        active: isActive
    });
});

app.post("/activate", (req, res) => {
    isActive = true;

    res.json({
        active: isActive
    });
});

app.post("/deactivate", (req, res) => {
    isActive = false;

    res.json({
        active: isActive
    });
});

We now have the foundation of a small web application.

It might not look particularly impressive, but the important observation is that the application has a complete responsibility. It accepts commands, changes its internal state, and communicates the result.

The Boolean is not merely a variable anymore. It has become the central concept around which the entire application operates.

When One Bit Becomes a Product

Let's imagine a more interesting scenario.

Suppose we wanted to create an application called QuietMode.

Its purpose would be to help people control interruptions during focused working sessions.

The entire application could revolve around one Boolean:

let quietModeEnabled = false;

When the value is false, notifications are allowed.

When the value is true, notifications are suppressed.

Everything else becomes a consequence of that decision.

The application could provide:

  • A button to activate quiet mode.
  • A dashboard displaying the current state.
  • An API for other applications to check the setting.
  • Integrations with notification services.
  • Automatic activation during scheduled periods.
  • A history of activation and deactivation events.

Notice something interesting here.

The application could eventually have hundreds of lines of code, multiple database tables, a frontend, a backend, and external integrations. Yet its central business concept would remain a single Boolean.

This reveals an important distinction between the size of an application and the complexity of its central idea.

An application does not necessarily need a large collection of independent concepts to become useful. Sometimes, a very small concept can generate an entire ecosystem of functionality.

The engineering challenge is not necessarily to create more states. It is to create meaningful behavior around the states that already exist.

The Boolean as a State Machine

One of the most interesting ways to understand this architecture is through state machines.

A state machine describes a system through its possible states and the transitions between them.

Our Boolean application has two states:

       false
         |
         | activate()
         v
        true
         |
         | deactivate()
         v
       false

The application can transition between these states whenever an operation occurs.

This is an extremely simple state machine, but it demonstrates an important software engineering principle: behavior can emerge from transitions between states.

Consider a smart lighting application.

The central state might be:

let lightIsOn = false;

When the state changes to true, the system activates the light.

When it changes to false, the system deactivates it.

A similar design could control a garage door, an automated irrigation system, a maintenance switch, or a publishing feature.

In each case, the Boolean represents a meaningful condition in the application domain.

The application does not become interesting because the Boolean contains complicated information. It becomes interesting because other components understand what that information means.

The Database Problem: Where Does the Boolean Live?

A variable stored in memory disappears when an application restarts.

That creates an interesting engineering problem.

If our application is expected to remember its state, we need persistence.

Fortunately, a Boolean can be stored in a database just as easily as other data types.

Consider a simple SQL table:

CREATE TABLE application_state (
    id INTEGER PRIMARY KEY,
    is_active BOOLEAN NOT NULL DEFAULT FALSE
);

We can initialize the application:

INSERT INTO application_state (id, is_active)
VALUES (1, FALSE);

And retrieve its state:

SELECT is_active
FROM application_state
WHERE id = 1;

Updating the state becomes equally straightforward:

UPDATE application_state
SET is_active = TRUE
WHERE id = 1;

The database now acts as the application's persistent memory.

However, something important happens when multiple users or processes interact with the same application.

Two requests might attempt to change the Boolean simultaneously. One request could activate the application while another deactivates it.

This introduces concurrency.

For a production application, we would need to think about transaction boundaries, atomic updates, access permissions, and the ordering of operations.

Even a single Boolean can introduce serious engineering considerations when it becomes shared state.

The simplicity of the data does not eliminate the complexity of the environment in which that data operates.

Building an API Around a Single Decision

An application built around one Boolean could expose an entire API.

For example:

Endpoint Responsibility
GET /state Retrieve the current state
POST /enable Activate the feature
POST /disable Deactivate the feature
POST /toggle Reverse the current state

This API could be consumed by a mobile application, a web dashboard, a desktop utility, or another backend service.

Imagine a developer integrating our application into an existing software platform.

They would not need to understand its internal implementation. They would only need to communicate with its API.

The application becomes a small, specialized service.

This is where the idea becomes particularly interesting for backend engineering.

We often discuss microservices in terms of large business capabilities: payment processing, authentication, inventory management, or communication.

But a service can also be designed around a very narrow responsibility.

A feature switch service, for example, could manage whether particular application capabilities are enabled.

The Boolean becomes a configuration primitive that other systems can consume.

Of course, a real feature management platform would eventually require additional information such as environment, user targeting, rollout percentages, and version history. But the underlying enabled-or-disabled decision remains Boolean in nature.

The User Interface: Making Two States Feel Like an Experience

A Boolean application does not need a complicated interface.

In fact, the best interface might consist of one button.

function QuietMode() {
    const [enabled, setEnabled] = React.useState(false);

    return (
        <main>
            <h1>Quiet Mode</h1>

            <p>
                Status: {enabled ? "Enabled" : "Disabled"}
            </p>

            <button
                onClick={() => setEnabled(!enabled)}
            >
                {enabled ? "Turn Off" : "Turn On"}
            </button>
        </main>
    );
}

This interface has almost nothing to distract the user.

There is one responsibility, one state, and one primary interaction.

But good interface design is not simply about displaying a value. It is about helping people understand what happens when they interact with the application.

For example, activating quiet mode might display a confirmation, update an icon, change the interface theme, or communicate with a notification service.

The Boolean becomes the source of truth for several visual and functional decisions.

This is a useful approach when building focused software products. A product does not necessarily become better because it contains more buttons, more settings, and more screens.

Sometimes, removing unnecessary decisions creates a better experience.

The Hidden Complexity of True and False

There is, however, a subtle problem with building applications around Boolean values.

Two possible values do not necessarily describe every possible situation.

Consider a payment system.

A payment might be:

  • Successful.
  • Unsuccessful.
  • Still processing.
  • Waiting for confirmation.
  • Cancelled.
  • Reversed.

Trying to represent all these conditions using a single Boolean would create confusion.

For example:

let paymentSuccessful = false;

Does false mean the payment failed?

Or does it mean the payment has not been completed yet?

These are two very different situations.

A better design might use an explicit state:

const paymentStatus = "pending";

With possible values such as:

"pending"
"successful"
"failed"
"cancelled"
"reversed"

This illustrates an important architectural lesson.

A Boolean is powerful when the domain genuinely has two meaningful possibilities. It becomes problematic when developers force a complicated reality into an oversimplified representation.

Good software engineering involves identifying the correct boundaries of a concept.

Sometimes, the best architecture is a Boolean.

Sometimes, it is an enumeration, a state machine with several states, or an entirely different data structure.

The objective is not to use the smallest possible data type. It is to represent reality accurately.

Can a Boolean Application Scale?

Now comes the more ambitious question.

What happens when the application grows?

Suppose QuietMode becomes popular. Thousands of people start using it. Mobile applications connect to its API, businesses integrate it into their internal systems, and developers build automation around it.

Does the original architecture still make sense?

Surprisingly, it can.

The application could introduce authentication, user-specific preferences, caching, database indexing, monitoring, rate limiting, and horizontal scaling without changing the central Boolean concept.

For example, instead of having one global variable:

let quietModeEnabled = false;

We could have a Boolean associated with each user:

const userSettings = {
    101: true,
    102: false,
    103: true
};

The application now manages multiple independent Boolean values.

Its central idea remains the same, but its scope has expanded.

We could introduce a database table:

CREATE TABLE user_settings (
    user_id INTEGER PRIMARY KEY,
    quiet_mode BOOLEAN NOT NULL DEFAULT FALSE
);

Now the application supports multiple users while preserving its original responsibility.

This is an important distinction: scaling an application does not always require changing its fundamental concept.

Sometimes, it simply requires supporting more instances of that concept.

A Boolean Is Not the Whole Application

There is another way to interpret our original question.

Can an entire application be built around a single Boolean?

Yes, if we are referring to its central business concept.

But no, if we mean that an application can operate entirely without other information.

Even a small application requires some combination of instructions, inputs, outputs, execution logic, and possibly external dependencies.

A user interface needs to know what to display.

An API needs to know how to process requests.

A database needs a way to identify records.

An authentication system needs to identify users.

A production environment needs configuration and operational monitoring.

These supporting structures do not invalidate the original idea.

They simply demonstrate that a central concept and its supporting infrastructure are two different things.

Think of a musical instrument.

A guitar has a relatively straightforward purpose: produce sound through vibrating strings. Yet an entire musical experience can emerge from that simple mechanism.

The instrument does not need to become a piano, a drum kit, and a synthesizer to produce something interesting.

Likewise, a Boolean-based application does not need to become a massive collection of unrelated features to deliver value.

Its strength can come from how effectively it performs its specific responsibility.

The Engineering Beauty of Small Ideas

Software engineering has an interesting relationship with simplicity.

We regularly build systems that contain thousands of functions, complicated database relationships, multiple programming languages, and sophisticated infrastructure.

Yet many useful applications can be traced back to a very small idea.

A switch.

A counter.

A timestamp.

A location.

A Boolean.

These small building blocks become powerful when they are connected to meaningful operations.

A Boolean can control access to a feature. It can determine whether a device is operating. It can represent whether a document has been published, whether a task is complete, or whether a particular service should accept new requests.

Its usefulness comes from the relationship between its value and the behavior of the system.

This is also why understanding data types is more important than simply memorizing their syntax.

A Boolean is not merely a programming language feature. It is a way of representing a decision.

And decisions are everywhere in software.

Final Thoughts: How Much Software Can Fit Inside One Bit?

The idea of building an entire application around a single Boolean is a useful exercise in architectural thinking.

It challenges us to separate the central purpose of a system from the infrastructure required to support it.

It also encourages us to think about the relationship between data, behavior, persistence, interfaces, and state transitions.

A single Boolean can become the foundation of a web application, a mobile utility, an automation service, or a specialized backend system.

It can control thousands of operations without necessarily becoming more complicated at its conceptual center.

But the real lesson is not that every application should be built around one Boolean.

It is that a small, well-defined idea can support a surprisingly large amount of engineering.

Perhaps the next interesting software product does not need another complicated architecture.

Perhaps it needs one excellent question, two possible answers, and a developer who understands exactly what should happen next.

Sometimes, the smallest variable in the codebase has the biggest responsibility.

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Merancang Backend Bisnis ISP: API Pelanggan, Paket Internet, Invoice, dan Tiket Support

Masbadar - Mar 13

Frameworks Are Institutional Memory

Ken W. Algerverified - Sep 17

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelski - Apr 9
chevron_left
2.5k Points • 114 Badges
Kapiri Mposhi, Zambia. • zambianmillenial.com
54Posts
10Comments
382Connections
Derek Mwale — Where Code Meets Creativity.

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!