Skip to content

S1D007/Boson

Repository files navigation

⚡ Boson Framework – High-Performance C++ Web Framework

Release Stars License: MIT C++: 17 Documentation

Boson is a blazing-fast, modern web framework for C++17. Build scalable APIs and web applications with the raw power of C++, a clean developer experience, and zero runtime bloat.

Think Express.js, but C++ fast.

Performance Optimized Memory Efficient Developer Friendly


🚀 Why Boson?

  • 🔋 Built for Speed – Zero-overhead routing, optimized HTTP handling.
  • 💡 Intuitive API – Inspired by modern frameworks like Express and FastAPI.
  • 🧠 Modern C++17 Design – Clean, safe, and familiar to experienced C++ devs.
  • 📦 Lightweight & Flexible – Perfect for microservices or monoliths.
  • 🔧 Developer Ergonomics – Clean interfaces that make web development in C++ accessible.
  • 🔒 Memory Safety – Smart design patterns that help prevent common memory errors.

✨ Features

Core Features

  • Fast HTTP Server – Built from scratch for performance
  • 🔀 Expressive Routing – Define endpoints effortlessly with parameter capture
  • 🧩 Middleware Support – Compose your request pipeline with global and route-specific middleware
  • 📦 JSON Support – Parse and return JSON with ease using the integrated libraries
  • 🧭 MVC-style Controllers – Keep code organized with controller architecture
  • 🛠️ Robust Error Handling – Built-in exception handling and custom error responses

Advanced Features

  • ⚙️ CLI Tooling – Scaffold projects, controllers, and more

🧑‍💻 Who's it For?

  • Devs needing high-performance web backends
  • C++ teams building modern web APIs
  • Systems where low latency matters (finance, games, IoT, etc.)
  • Projects with resource constraints where memory efficiency is critical
  • Developers who want predictable performance without garbage collection pauses

⚡ Hello World in Boson

#include <boson/boson.hpp>

int main() {
    boson::initialize();
    
    boson::Server app;

    app.get("/", [](const boson::Request& req, boson::Response& res) {
        res.send("Hello, Boson!");
    });

    // JSON response
    app.get("/api/user", [](const boson::Request& req, boson::Response& res) {
        res.jsonObject({
            {"id", 1},
            {"name", "John Doe"},
            {"email", "john@example.com"}
        });
    });

    app.configure(3000, "127.0.0.1");
    return app.listen();
}

✅ Use Boson CLI, run, and visit http://localhost:3000.


🏛️ Architecture

Boson is built on a clean, modular architecture that prioritizes performance and flexibility:

  1. Core Foundation Layer – Memory management, event loops, threading
  2. HTTP Layer – Connection handling, HTTP parsing, protocol implementation
  3. Server Layer – Request lifecycle, connection pooling, timeout management
  4. Middleware Layer – Request processing pipeline
  5. Routing Layer – URL pattern matching and dispatching
  6. Controller Layer – Resource organization and response generation
  7. Application Layer – Configuration, authentication, authorization

🚀 Getting Started

Prerequisites

  • C++ Compiler with C++17 support (GCC 7.3+, Clang 6.0+, or MSVC 2017+)
  • CMake 3.14 or higher
  • OpenSSL 1.1.1 or higher (for HTTPS support)

Quick Installation

Linux/macOS

curl -sSL https://raw.githubusercontent.com/S1D007/boson/main/install.sh | bash

Windows (PowerShell)

iwr -useb https://raw.githubusercontent.com/S1D007/boson/main/install.ps1 | iex

Create a New Project

boson new my-project
cd my-project

Build and Run

cd my-project
mkdir build && cd build
cmake ..
make
./my-project

Read the Full Installation Guide


📊 Performance

Boson delivers exceptional performance compared to other web frameworks:

  • 5-20x higher request throughput than Ruby/Python frameworks
  • 2-5x higher throughput than Node.js/Java/Go/Rust frameworks
  • Significantly lower latency and smaller memory footprint

Detailed benchmarks coming soon: Boson vs Go-Gin vs Node.js vs Drogon


🔍 Example Projects


📚 Documentation

Comprehensive documentation is available at bosonframework.vercel.app/docs


🤝 Contribute

We welcome contributions from the community! If you'd like to help make Boson better:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

🏷️ Tags

C++ Web Framework · High Performance · Express-style · Modern C++ · REST API · Fast HTTP Server · Embedded Web · Low Latency · Microservices · JSON API

About

BOSON: Fastest Router Based Web API Framework

Topics

Resources

Stars

Watchers

Forks

Contributors