{"id":29840621,"url":"https://github.com/graphform/nstream-railroad","last_synced_at":"2025-07-29T14:17:32.765Z","repository":{"id":224633568,"uuid":"738748196","full_name":"graphform/nstream-railroad","owner":"graphform","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-29T19:13:43.000Z","size":17038,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-06-23T03:54:30.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-01-04T00:36:10.000Z","updated_at":"2025-06-20T22:37:46.000Z","dependencies_parsed_at":"2024-05-29T22:26:35.568Z","dependency_job_id":null,"html_url":"https://github.com/graphform/nstream-railroad","commit_stats":null,"previous_names":["nstreamio/nstream-railroad","graphform/nstream-railroad"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/graphform/nstream-railroad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fnstream-railroad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fnstream-railroad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fnstream-railroad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fnstream-railroad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphform","download_url":"https://codeload.github.com/graphform/nstream-railroad/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fnstream-railroad/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267701746,"owners_count":24130458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-29T14:16:55.919Z","updated_at":"2025-07-29T14:17:32.755Z","avatar_url":"https://github.com/graphform.png","language":"JavaScript","readme":"# Railroad Demo\n\nA tutorial application for teaching core Swim concepts.  See a hosted version\nof this app running at [https://railroad.nstream-demo.io](https://railroad.nstream-demo.io/).\n\n## Architecture\n\n![nstream railroad architecture](info/NStream_RailRoad_Arch.png)\n\n### Goal of this Demo\n\n* Demonstrate via a realistic mocked demo, how Nstream enables railroads and adjacent players to efficiently build their own solutions in their existing Java development stacks leveraging their streaming data sources with Nstream’s developer framework.\n* This demo includes a map of the United States that can drill into cities with Rail yards and show the current and changing location and health status of the RCL assets on the Railroad track.\n\n#### Details of terms in the Architecture Diagram\n\n* RCU Agent\n  * Loads metadata (id, RCL id)\n  * Receives metrics  (CPU, Memory, Battery, Signal, Temp, Alerts) for a given RCU\n  * Statefully models the current state of the RCU\n  * Continuously analyzes and computes status as it changes in real-time\n  * Retains a history of metric data\n* Locomotive Agent\n  * Loads metadata (id, RCL id)\n  * Receives metrics  (Brake Level, Throttle, Engine Temperature, Location) for a given Locomotive \n  * Statefully models the current state of the Locomotive \n  * Continuously analyzes and computes status as it changes in real-time \n  * Retains a history of metric data\n* RCL Agent\n  * Loads metadata (id, yard id)\n  * Receives the real-time state of the RCU and Locomotive that is associated with it \n  * Statefully models the current state of the RCL \n  * Continuously analyzes and computes status as it changes in real-time based on the RCU and Locomotive status\n* Yard Agent\n  * Loads metadata (yard id, name)\n  * Receives the real-time state of every RCL unit that are in the yard \n  * Statefully models the current state of the Yard \n  * Continuously analyzes and computes new status based on all the RCL statuses as it changes in real-time\n\n## Prerequisites\n\n* [Install JDK 17+](https://www.oracle.com/technetwork/java/javase/downloads/index.html).\n  * Ensure that your `JAVA_HOME` environment variable is pointed to your Java installation location.\n  * Ensure that your `PATH` includes `$JAVA_HOME`.\n\n* [Install Node.js](https://nodejs.org/en/).\n  * Confirm that [npm](https://www.npmjs.com/get-npm) was installed during the Node.js installation.\n\n## Repository Structure\n\n### Key files\n\n- [build.gradle](build.gradle) — backend project configuration script\n- [gradle.properties](gradle.properties) — backend project configuration variables\n- [package.json](ui/package.json) — frontend project configuration\n- [rollup.config.js](ui/rollup.config.js) — frontend bundle configuration script\n\n### Key directories\n\n- [src](src) — backend source code, and configuration resources\n  - [main/java](src/main/java) — backend source code\n  - [main/resources](src/main/resources) — backend configuration resources\n- [ui src](ui/src) — frontend source code\n- [gradle](gradle) — support files for the `gradlew` build script\n\n\n## Run\n\n### Running on Linux or MacOS\n\n```bash\n$ ./gradlew run\n```\n\n### Viewing the UI\nOpen a web browser to [http://localhost:9001](http://localhost:9001).\n\n\n## Streaming APIs\n\nThe [swim-cli](https://www.swimos.org/backend/cli/) is the simplest way to fetch or stream data from  the web agents in this application\n\n### \"swim-cli\" installation\n**swim-cli** installation details available here: https://www.swimos.org/backend/cli/ \n\n### Application APIs\n**Note:** \n* Below **swim-cli** commands for introspection are for streaming locally running application.\n* There is a hosted version of this application running here: https://railroad.nstream-demo.io/\n* To stream APIs for the hosted version, replace `warp://localhost:9001` in below commands with `warps://railroad.nstream-demo.io` \n\n1. **YARD**:\n\n(Below, \"Bailey\" yard is used as an example)\n\n* Yard Info - provides latitude and longitude of a particular yard\n```\nswim-cli sync -h warp://localhost:9001 -n /yard/Bailey -l info\n```\n\n* Yard Status - provides total number of warnings and alerts. \n```\nswim-cli sync -h warp://localhost:9001 -n /yard/Bailey -l status\n```\n\n* Details of all the rails associated with the yard \n```\nswim-cli sync -h warp://localhost:9001 -n /yard/Bailey -l rails\n```\n\n* Details of all the warnings associated with the yard\n```\nswim-cli sync -h warp://localhost:9001 -n /yard/Bailey -l warningRcls\n```\n\n* Details of all the alerts associated with the yard\n```\nswim-cli sync -h warp://localhost:9001 -n /yard/Bailey -l alertRcls\n```\n\n2. **RCLs**:\n\n(Below, rcl \"32\" is used as an example)\n\n* Info of the rcl fetched from the rcls csv file \n```\nswim-cli sync -h warp://localhost:9001 -n /rcl/rcl32 -l info\n```\n\n* Current Status of the rcl\n```\nswim-cli sync -h warp://localhost:9001 -n /rcl/rcl32 -l status\n```\n\n* Current geographical coordinates of the rcl along-with related details\n```\nswim-cli sync -h warp://localhost:9001 -n /rcl/rcl32 -l geo\n```\n\n* Metrics of the rcl\n```\nswim-cli sync -h warp://localhost:9001 -n /rcl/rcl32 -l locomotiveMetrics\n```\n\n* Historical data of the rcl's metrics\n```\nswim-cli sync -h warp://localhost:9001 -n /rcl/rcl32 -l metricsHistory\n```\n\n* RCU metrics belonging to the rcl\n```\nswim-cli sync -h warp://localhost:9001 -n /rcl/rcl32 -l rcuMetrics\n```\n\n### Introspection APIs\nThe Swim runtime exposes its internal subsystems as a set of meta web agents.\n\nUse the `swim:meta:host` agent to introspect a running host. Use the `pulse`\nlane to stream high level stats:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:host -l pulse\n```\n\nThe `nodes` lane enumerates all agents running on a host:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:host -l nodes\n```\n\nThe fragment part of the `nodes` lane URI can contain a URI subpath filter:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:host -l nodes#/\n```\n\n#### Node Introspection\n\nYou can stream the utilization of an individual web agent:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fBailey -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fOakland -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fFortWorth -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fWestColton -l pulse\n```\n\nAnd discover its lanes:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fBailey -l lanes\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fOakland -l lanes\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fFortWorth -l lanes\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fWestColton -l lanes\n```\n\nSome additional examples:\n\n* Locomotive\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2frcl%2frcl17 -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2frcl%2frcl17 -l lanes\n```\n\n* Introspection of details for Yards, Yard-Rails and Locomotive stored in CSV format\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fcsv%2fyard-rails -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fcsv%2fyard-rails -l lanes\n\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fcsv%2fyards -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fcsv%2fyards -l lanes\n\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fcsv%2frcls -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fcsv%2frcls -l lanes\n```\n\n* Map coordinates\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fmap%2f84024,321683,19 -l pulse\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fmap%2f84024,321683,19 -l lanes\n```\n\n#### Mesh introspection\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:edge -l meshes\n```\n\n#### Log introspection\n\nYou can stream log message for a particular web agent:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:node/%2fyard%2fBailey -l debugLog\n```\n\nOr stream all log messages for a host:\n\n```sh\nswim-cli sync -h warp://localhost:9001 -n swim:meta:host -l debugLog\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphform%2Fnstream-railroad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphform%2Fnstream-railroad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphform%2Fnstream-railroad/lists"}