HUB
Sign inSign up
fastjson-aggregator logo

sage17rebirth/fastjson-aggregator

By sage17rebirth

•Updated over 1 year ago

FastJSON Aggregator is a high-performance C++17 web app that aggregates large JSON arrays.

Image
API management
Web servers
0

10K+

sage17rebirth/fastjson-aggregator repository overview

⁠FastJSON Aggregator

A high-performance C++17 web application for aggregating large JSON arrays, providing sum, average, min, max, count, and frequency statistics. Features a Crow-based backend and a minimal frontend for easy JSON analysis and visualization.

⁠Table of Contents

⁠Features

  • POST /aggregate endpoint: Accepts JSON arrays (numbers or objects), returns sum, average, min, max, count, and frequency (if categorical fields).
  • Modern C++17 codebase, modular and efficient.
  • Minimal frontend for easy testing and visualization.
  • Docker support for easy deployment.

⁠Pre-requisites

  • C++17 compatible compiler (e.g., GCC 10+, Clang, MSVC)
  • CMake 3.10+
  • Crow⁠ (single-header)
  • nlohmann::json⁠ (single-header)
  • (For Docker) Docker Engine

⁠Local Setup

  1. Clone the repository
  2. Download dependencies (if not present):
    get_deps.bat
    
  3. Build the project:
    cmake -S . -B build
    cmake --build build --config Release
    
  4. Run the server:
    build\Release\aggregator.exe   # On Windows
    # or
    ./build/aggregator              # On Linux/Mac
    
  5. Access the frontend: Open your browser at http://localhost:18080/⁠

⁠Docker Setup

  1. Build the Docker image:
    docker build -t fastjson-aggregator .
    
  2. Run the container:
    docker run -p 18080:18080 fastjson-aggregator
    
  3. Access the frontend: Open your browser at http://localhost:18080/⁠

⁠Usage

  • Test the API with cURL:
    curl -X POST http://localhost:18080/aggregate -H "Content-Type: application/json" -d "[1,2,3,4,5]"
    
  • Example JSON arrays:
    • [1, 2, 3, 4, 5]
    • [{"score": 10, "grade": "A"}, {"score": 20, "grade": "B"}]

⁠Project Structure

  • main.cpp — Crow server and /aggregate endpoint, static file serving
  • aggregator.h/cpp — Aggregation logic
  • frontend/ — Minimal HTML/JS frontend
  • Dockerfile — Containerization

⁠Contributing

Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.

⁠Issues

If you encounter any bugs or have feature requests, please raise an issue in the repository.


Tag summary

Content type

Image

Digest

sha256:8164a7065…

Size

467.7 MB

Last updated

over 1 year ago

docker pull sage17rebirth/fastjson-aggregator