{"id":14978082,"url":"https://github.com/xamfy/x-server-stats","last_synced_at":"2025-07-19T10:38:12.748Z","repository":{"id":60385666,"uuid":"542762427","full_name":"xamfy/x-server-stats","owner":"xamfy","description":"A simple web server(and library) to display server stats over HTTP and Websockets/SSE or stream it to other systems.","archived":false,"fork":false,"pushed_at":"2023-12-15T02:36:14.000Z","size":1147,"stargazers_count":12,"open_issues_count":10,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-07T10:18:22.590Z","etag":null,"topics":["css","hacktoberfest","hacktoberfest2022","html","hugo","javascript","mqtt","raspberry-pi-3","raspberry-pi-4","rust","rust-crate","rustlang"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/x-server-stats","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xamfy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing/branch-naming-convention.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-28T19:36:03.000Z","updated_at":"2023-03-04T10:47:21.000Z","dependencies_parsed_at":"2023-12-15T03:50:29.758Z","dependency_job_id":null,"html_url":"https://github.com/xamfy/x-server-stats","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":"0.11764705882352944","last_synced_commit":"b29f8b070bbdddc6207835fa83f0e900be935654"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/xamfy/x-server-stats","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamfy%2Fx-server-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamfy%2Fx-server-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamfy%2Fx-server-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamfy%2Fx-server-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xamfy","download_url":"https://codeload.github.com/xamfy/x-server-stats/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xamfy%2Fx-server-stats/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265919043,"owners_count":23849290,"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","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":["css","hacktoberfest","hacktoberfest2022","html","hugo","javascript","mqtt","raspberry-pi-3","raspberry-pi-4","rust","rust-crate","rustlang"],"created_at":"2024-09-24T13:56:50.423Z","updated_at":"2025-07-19T10:38:12.711Z","avatar_url":"https://github.com/xamfy.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# x-server-stats\n\nA simple web server(and library) to display server stats over HTTP and Websockets/SSE or stream it to other systems. x-server(in x-server-stats) is not to be confused with X Window System.\n\n### Getting started\n\n##### Installing the crate\n```bash\n$ cargo install x-server-stats\n```\n\n##### Installing via npm\n\nYou can also install x-server-stats via npm, the npm install command will install rust and the x-server-stats binary in your path.\nThis is useful if you want to get started quickly via npm. But we recommend to go with the cargo install command.\nThe npm package is called `rust-x-server-stats`\n\n```bash\n$ npm install -g rust-x-server-stats\n```\n\n##### Installing Rust\n\nYou can install Rust by following the instructions from the rust lang [website](https://www.rust-lang.org/tools/install).\nThe command to install rust using bash looks like below on the website, it's always advisable to follow the instructions on the official website.\nWe don't recommend using the command below as it may not be the latest version and other repos can have malicious bash script as well.\n\n```bash\n# Just for reference, please always head over to the official website for the instructions.\n$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\n##### Install PostgreSQL 14\n\nYou can install PostgreSQL 14 by following the instructions from the PostgreSQL [website](https://www.postgresql.org/download/).\nWe use PostgreSQL 14 for the database, you can use any other databases as well, but we don't provide any support for other databases as of now(please raise an issue if you have a usecase for some other database).\n\n```bash\n# Just for reference, please always head over to the official homebrew/postgres website for the instructions for your OS.\n$ brew install postgresql@14\n```\n\n##### Setting up environment variables\n\nYou need to export below environment variables to run the server.\nThe environment variables prefixed with `PG` are for PotsgreSQL database. Currently, only PostgreSQL is supported for storing stats.\n\n```bash\nexport SERVER_ADDR=localhost:8082\nexport PG__USER=PG_USERNAME\nexport PG__PASSWORD=PG_PASSWORD\nexport PG__HOST=PG_HOST_URL\nexport PG__PORT=5432\nexport PG__DBNAME=PG_DB_NAME\nexport PG__POOL__MAX_SIZE=20\nexport BASE_ADDR=http://localhost:8082\n```\n\n##### Building(and running) the application\n\nBefore running the application, you need to build it. You can do this by running the following command:\n\n```bash\n$ cargo build --release \n```\n\nRun the binary with the following command:\n\n```bash\n$ ./target/release/x-server-stats\n```\n\n##### Running the application directly\n\nYou can run the application directly by running the following command:\n\n```bash\n$ cargo run --release\n```\n\n##### Running the application with Docker\n\nFirst copy the `Dockerfile.example` file to `Dockerfile` and fill in the environment variables. Then run the below commands to build and run the Docker image.\n\n```bash\n$ docker build -t x-server-stats .\n$ docker run -p 8082:8082 x-server-stats\n```\n\n\n### Features\n\n##### Web page for server stats\nTODO - Need to work on this. The web page will be built using just HTML, CSS, JS with the whole page under 14KB gzipped and minified(due to initcwnd of TCP on linux servers).\n\n##### Request throttling\nx-server-stats uses actix-governor to throttle incoming requests based on IP address.\nThe config is present at `src/main.rs` and can be changed accordingly.\nThrottling is important if you don't want to overwhelm the server with too many requests by internal systems.\nWe plan to make this configurable in the future, so you don't have to build from source to change the config.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxamfy%2Fx-server-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxamfy%2Fx-server-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxamfy%2Fx-server-stats/lists"}