| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| ids.js | ||
| index.js | ||
| nlw.js | ||
| package-lock.json | ||
| package.json | ||
| persistance.js | ||
| README.md | ||
nlw-api
A simple API that caches and allows you to fetch data from the Non-Listworthy Extreme Demons spreadsheet (and Insane Demon Spreadsheet!) running on https://nlw.oat.zone/. Originally made for the NLW Integration Geode mod, but free for anyone to use.
Documentation
Endpoints
/list?type={type}
Fetches the entire list as a JSON, including levels of type type. type can be regular, pending, platformer or all and defaults to regular.
Returns: An array of NLWLevels.
/ids?type={type}
Fetches the IDS list as a JSON, including levels of type type. type can be regular, platformer or all and defaults to regular. Experimental.
Returns: An array of IDSLevels.
/status
Returns internal service info
totalLevels: Total amount of tracked levels.levelsWithMetadata: Levels with fetched and validated metadata (IDs).timeSinceFetch: Time it's been since the last cache refresh, in seconds.
Objects
Level
Represents a generic level.
sheetIndex: The row index of the level on the associated spreadsheet. 0-indexed.id: The ID of the level, manifested from the sheet using dark magic. Can beundefinedvery rarely.name: The name of the level. Standardized to the in-game level name.creator: The creator(s) of the level, as listed on the sheet.description: Descriptions and notes as listed on the sheet.checkpoints: For platformer levels;nullor a string.video: A link to a video of the level;nullif not given.
NLWLevel : Level
Represents an NLW level.
tier:"Fuck","Beginner","Easy","Medium","Hard","Very Hard","Insane","Extreme","Remorseless","Relentless"or"Terrifying".skillset: Level skillset, as listed on the sheet.enjoyment: Level enjoyment sampled from EDEL as a number, ornull.broken: If the level is broken in 2.2. Legacy value, alwaysnull.
IDSLevel: Level
Represents an IDS level.
tier:"Fuck","Super Beginner","Beginner","Easy","Medium","Hard","Very Hard","Insane"or"Extreme".skillset: Level skillset, as listed on the sheet.broken: If the level is broken in 2.2."no","yes", or rarelynullif unknown.
Self-hosting
You can self-host the API yourself, if you so wish! Here's the rough steps:
- Grab yourself a Google Sheets API key. This may sound extremely intimidating, but you can create a read-only Sheets API key with not much hassle with this guide.
- Install, either with NPM or Nix:
- With NPM, run:
Then, you can start it with:npm install
However, take note of the environment variables available to use.API_KEY=... node index.js - Use Nix to either just plainly run it:
Or import it into your system flake like so:API_KEY=... nix run git+https://git.oat.zone/oat/nlw-api
Afterwards, you can use it as a regular NixOS service:nlw-api.url = "git+https://git.oat.zone/oat/nlw-api"; # in your `nixosConfiguration`: imports = [ inputs.nlw-api.nixosModules.nlw-api ];services.nlw-api = { enable = true; domain = "nlw.oat.zone"; apiKey = builtins.readFile /etc/sheets-api-key; port = 1995; };
- With NPM, run:
- You're done! It will take a while to fetch every level and their IDs initially, but in time you will have yourself the caches set up and the server up and running.
Environment variables
You can pass these into the server as config (an .env file will not work):
API_KEY: A Google API key - see this guide to see how to get one hassle-freePORT: The HTTP port to host the server onCACHE_DIR: The directory to store cached data in, defaults to./cache/