npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@datagutt/kanpla

v1.3.0

Published

Kanpla cantina app api

Readme

Kanpla API Client

npm version License: MIT

An unofficial Node.js API client for the Kanpla cantina app. Access menu information programmatically with TypeScript support.

⚠️ Disclaimer: This is an unofficial client. Use at your own risk.

Installation

npm install @datagutt/kanpla
pnpm add @datagutt/kanpla
yarn add @datagutt/kanpla
bun add @datagutt/kanpla

Quick Start

import Kanpla from '@datagutt/kanpla';

const kanpla = new Kanpla({
  FIREBASE_API_KEY: 'your-firebase-api-key',
  FIREBASE_USERNAME: 'your-username',
  FIREBASE_PASSWORD: 'your-password',
  MODULE_ID: 'your-module-id',
  LANGUAGE: 'nb',
});

const menu = await kanpla.getMenusForToday();
console.log(menu);

Configuration

Environment Variables

Create a .env file in your project root:

FIREBASE_API_KEY=your-firebase-api-key
FIREBASE_USERNAME=your-username
FIREBASE_PASSWORD=your-password
MODULE_ID=your-module-id

Options

| Option | Type | Required | Default | Description | | ------------------- | ------ | -------- | ------- | -------------------------------------- | | FIREBASE_API_KEY | string | Yes | - | Firebase API key for authentication | | FIREBASE_USERNAME | string | Yes | - | Your Kanpla account username | | FIREBASE_PASSWORD | string | Yes | - | Your Kanpla account password | | MODULE_ID | string | Yes | - | The module/location ID for the cantina | | LANGUAGE | string | No | 'en' | Language code (e.g., 'nb', 'en') | | API_BASE_URL | string | No | - | Custom API base URL (optional) |

API Methods

getMenusForToday()

Fetch today's available menus.

const todaysMenus = await kanpla.getMenusForToday();

Returns: Promise<MenuData[] | null>

getMenusForDate(date: Date)

Fetch menus for a specific date.

const date = new Date('2025-10-15');
const menus = await kanpla.getMenusForDate(date);

Returns: Promise<MenuData[] | null>

getAllMenus()

Fetch all available menus.

const allMenus = await kanpla.getAllMenus();

Returns: Promise<any[] | null>

getFrontend()

Get raw frontend data from the Kanpla API.

const frontendData = await kanpla.getFrontend();

Returns: Promise<any>

forceRefreshToken()

Manually refresh the authentication token.

await kanpla.forceRefreshToken();

Returns: Promise<boolean>

TypeScript Support

This package is written in TypeScript and includes type definitions.

MenuData Type

type MenuData = {
  available: boolean;
  menu: {
    productId: string;
    moduleId: string;
    dateSeconds: number;
    pictograms: Record<string, unknown>;
    name: string;
    labels: Record<string, unknown>;
    allergens: Record<string, boolean>;
    description: string;
  };
};

Example Usage

import Kanpla from '@datagutt/kanpla';
import dotenv from 'dotenv';

dotenv.config();

const kanpla = new Kanpla({
  FIREBASE_API_KEY: process.env.FIREBASE_API_KEY as string,
  FIREBASE_USERNAME: process.env.FIREBASE_USERNAME as string,
  FIREBASE_PASSWORD: process.env.FIREBASE_PASSWORD as string,
  MODULE_ID: process.env.MODULE_ID as string,
  LANGUAGE: 'nb',
});

async function main() {
  const todaysMenu = await kanpla.getMenusForToday();

  if (todaysMenu) {
    todaysMenu.forEach((item) => {
      console.log(`${item.menu.name}: ${item.menu.description}`);
      console.log(`Allergens:`, item.menu.allergens);
      console.log('---');
    });
  }

  const tomorrow = new Date();
  tomorrow.setDate(tomorrow.getDate() + 1);
  const tomorrowsMenu = await kanpla.getMenusForDate(tomorrow);
  console.log('Tomorrow:', tomorrowsMenu);
}

main();

License

MIT © Thomas Lekanger

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any issues or have questions, please open an issue on GitHub.