This project provides a Deno-based API for querying Steam application data using the steam-user
npm package. It supports Redis caching, Steam account authentication, and can be deployed across multiple platforms. The API allows fetching detailed information about Steam apps by their appId
, with fallback support for anonymous queries.
- Query Steam app data using the Steam Client protocol, supporting both authenticated and anonymous logins.
- Cache responses in Redis to improve performance.
- Multi-platform support with Deno's compile feature.
- Customizable login behavior based on credentials sent via headers.
- Retry mechanism when tokens are missing from authenticated logins.
- Error handling and logging to track issues.
- Build tasks for macOS, Linux, and Windows binaries.
- Deno >= 2.00
- Steam account (optional, for authenticated access)
- Redis (optional, for caching)
-
Clone the repository:
git clone https://github.com/denizkoekden/steamcmd-deno.git cd steamcmd-deno
-
Install dependencies: Deno automatically installs required npm dependencies when the project runs. You don’t need to manually install anything except for Deno.
-
Set up environment variables: Create a
.env
file in the root directory and configure the following:PORT=8000 REDIS_HOST=localhost REDIS_PORT=6379 REDIS_PASSWORD=your_password # Optional if your Redis instance requires authentication CACHE_EXPIRATION=3600 LOG_LEVEL=INFO
To start the API locally, run:
deno task start
This will start the server on the specified port (8000
by default).
You can query app information by appId
using the following endpoint:
GET http://localhost:8000/v1/info/{appId}
The API exposes the following routes:
GET /v1/info/:appId
: Fetches app information for a given SteamappId
. Supports both authenticated and anonymous logins.GET /v1/version
: Retrieves the current API version.
The API supports both authenticated and anonymous logins when querying Steam app data.
- Authenticated Login: When Steam credentials are provided in the request headers (
username
andpassword
), the API logs in with these credentials to fetch the app data. - Anonymous Login: If no credentials are provided, the API falls back to anonymous login for querying the Steam app data.
To make an authenticated request, send the username
and password
in the request headers:
curl -X GET http://localhost:8000/v1/info/{appId} \
-H "username: your_steam_username" \
-H "password: your_steam_password"
If no credentials are sent, the request is handled anonymously by default:
curl -X GET http://localhost:8000/v1/info/{appId}
Certain Steam applications require a token to fetch more detailed information. If an authenticated request returns a missingToken: true
response, the API automatically retries the request as anonymous, and logs a warning if the token is still missing after retrying.
This behavior ensures the API delivers the most complete app data available, whether using authenticated or anonymous login.
You can compile this Deno project into standalone binaries for different platforms. Available build tasks are defined in the deno.json
file.
To build binaries for all platforms:
deno task build_all
Or, for specific platforms:
# macOS x86_64
deno task build_mac_x86
# macOS ARM
deno task build_mac_arm
# Windows
deno task build_win
# Linux x86_64
deno task build_linux_x86
# Linux ARM
deno task build_linux_arm
The binaries will be output to the bin/
directory.
Here are the available tasks defined in deno.json
:
deno task start
: Starts the API server.deno task lint
: Lints the codebase.deno task build
: Builds the project for all platforms.deno task build_mac_x86
: Builds the macOS (x86) binary.deno task build_mac_arm
: Builds the macOS (ARM) binary.deno task build_win
: Builds the Windows binary.deno task build_linux_x86
: Builds the Linux (x86) binary.deno task build_linux_arm
: Builds the Linux (ARM) binary.
Contributions are welcome! Please fork the repository and submit a pull request with your changes. Ensure that you follow the code style by running deno lint
and deno fmt
before submitting.
- Fork the repo.
- Create a new branch:
git checkout -b feature-branch-name
. - Commit your changes:
git commit -m 'Add some feature'
. - Push to the branch:
git push origin feature-branch-name
. - Open a pull request.