Buntal JS

repository·main·Indexed 41 days ago

https://github.com/mgilangjanuar/buntal

An ultra-lightweight, type-safe, full-stack web framework built on Bun, React, and TypeScript. It features file-based routing, SSR, SPA support, and a dedicated CLI for scaffolding and development. Currently in an early development stage (version 0.1.20) and not recommended for production use.

Tokens
14.2K
Snippets
56
Records
70
Agent score
100%

What's inside Buntal JS

  1. Overview of Buntal JS features

    main

    Buntal JS is an ultra-lightweight, type-safe, modern full-stack web framework designed to work with TypeScript, React, and Bun. It aims to provide high performance without unnecessary bloatware.

    Key features include:

    • Blazing Fast: Leverages the Bun runtime for maximum performance.
    • HTTP Server: Provides type-safe HTTP servers using Bun's native implementation.
    • File-based Routing: Allows you to define routes based on your file structure (similar to Next.js).
    • SSR: Supports Server-Side Rendering for dynamic content.
    • SPA: Supports Single Page Applications using Bun's built-in bundler.
    WARNING

    Buntal JS is in an Early Development Stage. It is recommended NEVER to use Buntal JS in production unless you are a pufferfish 🐡.

  2. Understand benchmark output and reporting

    main

    The benchmark suite provides three distinct reporting sections:

    1. Individual Run Results: Displays progress, a results table (latency and RPS), and an ASCII performance chart for each specific run.
    2. Comprehensive Recap: A summary following all runs that includes a Statistics Table (showing avg/min/max for latency and RPS) and a Performance Ranking (services ordered by average RPS).
    3. Machine Information: Metadata including OS, architecture, CPU, memory, and timestamp.
  3. Create a new Buntal JS application

    main

    You can scaffold a new Buntal JS project using the bun create command. This will set up a modern full-stack web framework environment using TypeScript, React, and Bun.

    bun create buntal@latest my-app
  4. Prepare services for benchmarking

    main

    Before running the benchmark, all target services must be active and reachable at their respective endpoints. It is recommended to use the ./run-services.sh script to start all services simultaneously.

    Target Endpoints:

    • py-fastapi: http://localhost:3103/json
    • node-express: http://localhost:3100/json
    • go-gin: http://localhost:3102/json
    • elysia: http://localhost:3104/json
    • buntal: http://localhost:3101/json
  5. Install and run the buntal project

    main

    To set up the project environment and execute the main entry point, use the following commands with the Bun runtime:

    1. Install dependencies: bun install
    2. Run the project: bun run index.ts

    Note: This project was initialized using bun init in Bun v1.2.15.

    bun install
    bun run index.ts
  6. Run the Multi-Run Benchmark Suite

    main

    Use the ./test.sh script to execute performance benchmarks across multiple services. The script performs multiple runs to ensure statistical reliability, calculating average, minimum, and maximum values for latency and Requests Per Second (RPS).

    # Run with default settings (3 runs, 100 requests per service per run)
    ./test.sh
  7. Integrate MDX with Buntal using Bun macros

    main

    Buntal leverages Bun's macro system to load MDX content at compile time. This approach improves performance by processing MDX files during the build step rather than at runtime. You can import the mdx function as a macro to transform .mdx files into usable components.

    import { mdx } from './render.tsx' with { type: 'macro' }
    
    const Post = mdx('./example-post.mdx')