How dambor/bench-flow works
Project type and purpose
• This is a full-stack web application (“NoSQLBench Flow”) that provides a single interface for parsing Cassandra CQL schemas, generating NoSQLBench YAML, running data‐loading (via NoSQLBench and DSBulk), exporting data, and validating consistency.
• The frontend is built in React (Vite) and the backend is a FastAPI server in Python.
File structure
• Top-level Makefile coordinates install, start, build, and clean tasks for both frontend and backend.
• backend/
• main.py: FastAPI app entrypoint exposing /api/* endpoints
• dsbulk_utils.py, nb5_executor.py, read_yaml_generator.py, schema_parser.py: modules for JAR orchestration and YAML/schema handling
• requirements.txt, Dockerfile, logs/: build and runtime artifacts
• frontend/
• package.json, vite.config.js: React/Vite setup
• src/components, src/views: UI building blocks and pages (Dashboard, Migrate, ReadYaml, WriteYaml, etc.)
• src/context: React Context providers managing application state
• src/services/api.js: fetch wrappers for backend endpoints
README for additional insights
• Features list confirms key components: schema parsing, write-YAML generation, data load, DSBulk export, read-YAML generation, read validation, CDM migration prep.
• API endpoints:
• /api/parse-schema
• /api/generate-yaml
• /api/dsbulk/*
• /api/nb5/*
• /api/health
• Local dev ports: backend on 8000, frontend on 3000, with a proxy for /api/*.
a. Main components
• Frontend (React SPA)
• Backend (FastAPI server)
• External services and artifacts:
• NoSQLBench JAR (nb5.jar)
• DSBulk JAR (dsbulk-1.11.0.jar)
• Cassandra cluster (target for data load/read)
• File system (for generated YAML files and logs)
b. Relationships and interactions
1. User interacts with React UI → triggers action in a View component
2. View calls service layer (src/services/api.js) → sends HTTP request to FastAPI /api/...
3. FastAPI routes to corresponding handler in main.py
4. Handler invokes one or more modules:
• schema_parser.py → parse CQL schema files
• read_yaml_generator.py / write-YAML generator → produce YAML files
• nb5_executor.py → run NoSQLBench JAR (bench run)
• dsbulk_utils.py → run DSBulk JAR for export/import
5. Modules read/write files on disk and write logs under backend/logs/
6. NoSQLBench and DSBulk processes communicate with external Cassandra cluster
7. FastAPI returns operation results/status to frontend
8. React UI updates via Context/state and displays results or errors
c. Architectural patterns and design principles
• Clear separation of concerns:
• Presentation layer (React Views & Components)
• State management (React Contexts: AppContext, DSBulkContext, NB5Context, etc.)
• Service layer for API calls
• Backend modularization of business logic into parser/generator/executor utilities
• Micro-services-style separation (even though only one backend service) between frontend and backend via typed REST API
• External process orchestration: backend spawns and manages long-running jobs (NoSQLBench, DSBulk)
d. Technologies and frameworks
• Frontend: React, Vite, Context API, ESLint
• Backend: Python 3.8+, FastAPI, Uvicorn, pip dependencies
• External: NoSQLBench JAR, DSBulk JAR, Cassandra
• DevOps: Docker for containerization, Makefile for task automation