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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@per-diem-calculator/vanilla

v1.1.0

Published

Open source per diem calculator for both domestic and international trips. Built in TypeScript with Tailwind. Rates sourced from GSA, State Dept., and DOD.

Readme

Introduction

This is an open source per diem calculator to lookup lodging and meals per diem rates, and account for deductions, for both domestic and international trips. A demo can be found here: https://perdiemcalc.org.

There are a few issues with the tools available as of May 2025:

  • No existing calculators for end users that pull both domestic and international rates and deductions
  • The General Services Administration (GSA) has an API that provides CONUS (48 states) rates--however, no API is available for OCONUS rates by Department of Defense (DOD) (Alaska, Hawaii, US territories) or by the State Dept. (all other locations).
  • No existing calculators for developers to easily pull domestic and international rates/deductions into their application
  • Many existing calculators limited to a single location and can't be used in one go for multi-destination trips

This calculator was built to address all the above issues. It's a single tool that:

  • Pulls both domestic and international rates, and provides the ability to select deductions for each rate
  • Gets rates directly from federal sources via GSA's API; and via downloading OCONUS rate zip files from the Dept. of Defense (which includes the State Department's OCONUS rates), unpacking them using JSZIP, and parsing the rate XML file using DOMParser and XPathEvaluator
  • Accounts for multi-destination trips
  • Easily incorporates into existing projects by being built with native Javascript web components

Usage

Add to your project:

npm install @per-diem-calculator/vanilla

Setup the accompanying CORS/API proxy and use the following environment variables:

VITE_PROXY_URL="URL_FROM_PROXY"
VITE_PROXY_KEY="KEY_FROM_PROXY"

Add to your frontend markup:

<!-- index.html -->
<div id="perDiemCalc"></div>
<script type="module" src="script.js"></script>
/// script.js
import { Pdc } from '@per-diem-calculator/vanilla';

const container = document.querySelector('#perDiemCalc');

new Pdc(container);

The rates and expenses can be outputted to an object for further use in your application (see your console in this demo, and the Expense Object and Rates Object sections):

import { Pdc } from '@per-diem-calculator/vanilla';

const container = document.querySelector('#perDiemCalc');

const pdc = new Pdc(container);

pdc.addEventListener('expenseUpdate', e => {
    const { expenses, rates } = e.detail;
    console.table(expenses);
    console.table(rates);
});

Additional Features

  • Save an expense report PDF that includes daily breakdown, rates used, and links to the original federal source
  • Full keyboard-only navigation support
  • API calls are reduced via both memoization by the calculator, and caching results in Cloudflare by the proxy
  • All features usable in both mobile and desktop widths

Expense Object

{
  date: "2025-05-27",
  country: "AR", // for domestic rates, states are counted as countries
  city: "Hot Springs",
  deductions: {
    FirstLastDay: true,
    breakfastProvided: true,
    lunchProvided: true,
    dinnerProvided: false,
  },
  rates: {
    effDate: "2025-05-01",
    deductionBreakfast: 16,
    deductionLunch: 19,
    ​deductionDinner: 28,
    maxIncidental: 5,
    maxLodging: 114,
    maxMie: 68,
    maxMieFirstLast: 51,
  },
  lodgingAmount: 114,
  mieAmount: 16,
  totalAmount: 130,
  source: "https://www.gsa.gov/travel/plan-book/per-diem-rates/per-diem-rates-results?action=perdiems_report&fiscal_year=2025&state=AR&city=Hot Springs"
}

Rates Object

{
  eff_date: "05/2025",
  location: "Hotsprings, AR",
  maxLodging: 114,
  maxMie: 68,
  maxMieFirstLast: 51,
  maxIncidental: 5,
  deductionBreakfast: 16,
  deductionLunch: 19,
  ​deductionDinner: 28,
  source: "https://www.gsa.gov/travel/plan-book/per-diem-rates/per-diem-rates-results?action=perdiems_report&fiscal_year=2025&state=AR&city=Hot Springs"
}

Built With

Planned Updates

  • Accessibility improvements to reach full WCAG compliance
  • CSS paths for an easy way to style shadowDOM elements
  • Option to mark personal days and remove them from the final expense amount
  • React version - I used this project as a way to get familiar with native web components, but a React version will be shared soon
  • CDN option
  • Tests