A simple website that tracks player counts for Norwegian video games on Steam, inspired by SteamDB.
- Data Collection: The backend uses the Steam Web API (
ISteamUserStats/GetNumberOfCurrentPlayers) to fetch real-time player counts for a predefined list of Norwegian games. - Storage: Historical data is stored in a local SQLite database.
- Visualization: A frontend built with Chart.js displays current player counts and historical trends.
- Install dependencies:
npm install
- Start the server and collector:
The server will start at
npm start
http://localhost:3000. It will also automatically start a background job that collects data every 10 minutes.
You can add or remove games in src/config.js.
module.exports = {
games: [
{ id: 440900, name: "Conan Exiles", developer: "Funcom" },
// Add more here
],
databasePath: "./src/data/stats.db",
collectionInterval: "*/10 * * * *" // Cron format
};- Backend: Node.js, Express
- Database: SQLite
- Frontend: HTML/CSS/JS, Chart.js
- Scheduler: node-cron
- API Client: Axios
The recommended way to deploy this with automatic updates is using Railway. It connects directly to your GitHub repository and handles persistent storage (volumes) which is required for the SQLite database.
- Push your code to a GitHub repository.
- Login to Railway.app.
- Click New Project > Deploy from GitHub repo.
- Select your repository.
- Railway will automatically detect the
Dockerfileand start building. - Crucial for SQLite Persistence:
- Go to your service settings in Railway.
- Click on the Volumes tab.
- Click Add Volume.
- Set the Mount Path to
/app/src/data.
- Your app will be live at a
.up.railway.appdomain.
- Connect your GitHub repository to Render.
- Select Docker as the Runtime.
- Add a Disk with mount path
/app/src/data(requires a paid plan).
Heroku uses an ephemeral filesystem, meaning your SQLite database will be wiped every time the app restarts. To use Heroku, you would need to switch to a managed database like Heroku Postgres.
This repository includes a GitHub Action in .github/workflows/deploy.yml that ensures your code builds correctly on every push. You can also configure it to trigger a deployment to Railway.
- Install the Railway CLI locally.
- Run
railway login. - Run
railway linkin your project folder to link it to your Railway project. - Get your Railway API Token:
- Go to your Railway Account Settings > Tokens.
- Create a new token.
- In your GitHub Repository, go to Settings > Secrets and variables > Actions.
- Add a new secret named
RAILWAY_TOKENand paste your token.
Now, every time you push to the main branch, the GitHub Action will verify the build and trigger a deployment to Railway.
If you want to change the port, set the PORT environment variable in your deployment platform's dashboard.
While Netlify and Vercel are excellent for static sites, this project requires a persistent server to:
- Run the background collection job (cron).
- Store data in a database.
Render, Railway, and Heroku are all good options for this architecture.