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

@mrck-labs/vanaheim-shared

v0.7.0

Published

Shared types, constants, and utilities for Vanaheim apps

Readme

@mrck-labs/vanaheim-shared

Shared types, constants, utilities, and state management for the Vanaheim ecosystem

This package provides common code used by both Vanaheim Desktop (Electron) and MobileHorizon (React Native/Expo).

Installation

npm install @mrck-labs/vanaheim-shared

Peer Dependencies:

  • jotai (optional) - Required only if using the /atoms module

Modules

Types (/types)

Database entity types matching the Supabase schema:

import type {
  // Focus
  FocusSession,
  NewFocusSession,
  FocusCategory,
  FocusSessionFilters,

  // Expenses & Income
  Expense,
  NewExpense,
  ExpenseCategory,
  Income,
  NewIncome,
  IncomeCategory,

  // Health
  HealthHabit,
  HealthCategory,
  HealthCompletion,

  // And more...
} from "@mrck-labs/vanaheim-shared/types";

Constants (/constants)

Shared constants and enums:

import {
  CURRENCIES, // ['CHF', 'USD', 'EUR', 'PLN']
  CURRENCY_SYMBOLS, // { CHF: 'CHF', USD: '$', ... }
  FREQUENCIES, // ['monthly', 'yearly', '6-monthly', ...]
  DEFAULT_FOCUS_DURATIONS, // [15, 25, 30, 45, 60, 90]
  FOCUS_STATUS, // ['active', 'completed', 'abandoned']
  SETTING_KEYS,
  API_URLS,
} from "@mrck-labs/vanaheim-shared/constants";

Utilities (/utils)

Common utility functions:

import {
  formatTime, // (seconds) => "02:05"
  formatTotalTime, // (seconds) => "1h 30m"
  formatCurrency, // (amount, currency) => "CHF 1'234.56"
  formatRelativeTime, // (dateStr) => "2h ago"
  generateId, // () => UUID v4
  truncate, // (str, maxLength) => "Hello..."
} from "@mrck-labs/vanaheim-shared/utils";

Query Keys (/query)

Centralized TanStack Query cache key factory:

import { queryKeys } from "@mrck-labs/vanaheim-shared/query";

// In query hooks
useQuery({ queryKey: queryKeys.focusSessions.today() });
useQuery({ queryKey: queryKeys.expenses.list({ isActive: true }) });

// Invalidating
queryClient.invalidateQueries({ queryKey: queryKeys.focusSessions.all });

Covered modules: expenses, expenseCategories, expensePayments, incomes, incomeCategories, incomePayments, exchangeRates, focusSessions, focusCategories, settings, lieuDays, efLinks, bankConnections, bankTransactions, healthCategories, healthHabits, healthCompletions, healthStats, promptCategories, promptLabels, prompts, trainingActivities, trainingSessions, plannedSessions, races, trainingStats, strava, journalEntries, journalData, chatConversations, chatMessages, googleCalendar, linear

Focus Atoms (/atoms)

Jotai atoms for focus timer state management:

import {
  // Types
  type TimerStatus, // 'idle' | 'running' | 'paused' | 'completed'
  type ActiveSession,

  // Core atoms
  timerStatusAtom,
  targetSecondsAtom,
  elapsedSecondsAtom,
  activeSessionAtom,

  // Derived atoms
  remainingSecondsAtom,
  progressAtom, // 0 to 1
  progressPercentAtom, // 0 to 100
  formattedRemainingAtom, // "24:59"
  formattedElapsedAtom, // "00:01"
} from "@mrck-labs/vanaheim-shared/atoms";

Date Utilities (/date)

Comprehensive date manipulation:

import {
  // Core
  getTodayString, // "2024-12-16"
  parseLocalDate, // Avoids timezone issues
  formatDateString, // Date => "2024-12-16"

  // Checks
  isToday,
  isOverdue,
  isDueSoon, // Within N days

  // Arithmetic
  addDays,
  subtractDays,
  getYesterdayString,
  getTomorrowString,

  // ISO helpers (for DB queries)
  getStartOfDayISO,
  getEndOfDayISO,

  // Week utilities
  getWeekStartString,
  getWeekEndString,
  formatWeekRange,

  // Display formatting
  formatFullDate, // "Monday, December 15, 2024"
  formatDateHeader, // "Today" | "Tomorrow" | "Overdue"
  formatRelativeDueDate, // "Due in 3 days"
} from "@mrck-labs/vanaheim-shared/date";

Usage in Projects

Vanaheim Desktop

// src/lib/queryClient.ts
export { queryKeys } from '@mrck-labs/vanaheim-shared/query'

// src/atoms/focus.ts
export { timerStatusAtom, ... } from '@mrck-labs/vanaheim-shared/atoms'

MobileHorizon

// src/hooks/queries/useFocusQueries.ts
import { queryKeys } from '@mrck-labs/vanaheim-shared/query'

// src/atoms/focus.ts
export { timerStatusAtom, ... } from '@mrck-labs/vanaheim-shared/atoms'

Development

# Install dependencies
npm install

# Build
npm run build

# Watch mode
npm run dev

# Type check
npm run typecheck

# Clean build artifacts
npm run clean

Release

This package uses changesets for version management.

See RELEASE_GUIDE.md for detailed release instructions.

License

MIT