Skip to content

This package is an easy way to access a static data like countries, job roles etc needed for Saas products

License

Notifications You must be signed in to change notification settings

tryfinancially/static-data-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Static Data Kit

NPM Downloads Version

A TypeScript-first utility library for accessing and using high-quality static reference data in SaaS, B2B, and analytics applications.


✨ Why Static Data Kit?

When building SaaS platforms, you often need consistent, high-quality static data for:

  • Countries
  • Currencies
  • States or provinces
  • Job roles and industries
  • Regional formats

But existing datasets are often:

  • Incomplete or poorly structured
  • Behind paywalls or APIs
  • Unreliable or inconsistently formatted

Static Data Kit solves this by offering a clean, typed, offline-friendly dataset with standardized fields β€” perfect for use in onboarding flows, settings screens, or seed data in any modern app.


πŸ“¦ Installation

npm install @financially/static-data-kit
# or
yarn add @financially/static-data-kit
# or
pnpm add @financially/static-data-kit

🌍 Countries

βœ… Methods

getAllCountries(): Country[]
getCountryByAlpha2Code(code: string): Country | undefined
getCountryByAlpha3Code(code: string): Country | undefined

πŸ” Example

import {
  getAllCountries,
  getCountryByAlpha2Code,
} from '@financially/static-data-kit';

const countries = getAllCountries();
const india = getCountryByAlpha2Code('IN');
console.log(india?.flagFile); // "IN.svg" - you can append this to your S3 bucket domain and use it

πŸ“˜ Interface

interface Country {
  commonName: string;
  officialName: string;
  isoAlpha2Code: string;
  isoAlpha3Code: string;
  countryNumericCode: string;
  isoAlpha2SubDivisionCode: string;
  region: string;
  subRegion: string;
  regionCode: string;
  subRegionCode: string;
  flagUnicode: string;
  flagFile: string;
  phonePrefix: string;
}

πŸ’± Currencies

βœ… Methods

getAllCurrencies(): Currency[]
getCurrencyByAlpha3Code(code: string): Currency | undefined
getCurrenciesByCountryCode(countryCode: string): Currency[]

πŸ” Example

import {
  getCurrencyByAlpha3Code,
  getCurrenciesByCountryCode,
} from '@financially/static-data-kit';

const usd = getCurrencyByAlpha3Code('USD');
const swiss = getCurrenciesByCountryCode('CH');

πŸ“˜ Interface

interface Currency {
  name: string;
  isoAlpha3Code: string;
  symbol: string;
  isoNumericCode: string;
  minorUnit: string;
  supportedCountryCodes: string[];
}

πŸ—ΊοΈ States / Provinces

βœ… Methods

getAllStates(): State[]
getStateByCode(code: string): State | undefined
getStatesByCountryCode(countryCode: string): State[]

πŸ” Example

import { getStatesByCountryCode } from '@financially/static-data-kit';

const usStates = getStatesByCountryCode('US');

πŸ“˜ Interface

interface State {
  name: string;
  code: string;
  countryCode: string;
  type: string;
}

🏭 Industries

βœ… Methods

getAllIndustries(): Industry[]
getIndustryBySlug(slug: string): Industry | undefined

πŸ” Example

import { getAllIndustries } from '@financially/static-data-kit';

const industries = getAllIndustries();

πŸ“˜ Interface

interface Industry {
  name: string;
  slug: string;
}

πŸ‘¨β€πŸ’Ό Job Roles

βœ… Methods

getAllJobRoles(): JobRole[]
getJobRoleBySlug(slug: string): JobRole | undefined
getJobRolesByCategorySlug(slug: string): JobRole[]

πŸ” Example

import { getJobRolesByCategorySlug } from '@financially/static-data-kit';

const execRoles = getJobRolesByCategorySlug('executive-leadership');

πŸ“˜ Interface

interface JobRole {
  title: string;
  slug: string;
  category: string;
  categorySlug: string;
}

🌐 Regional Settings

βœ… Methods

getAllRegionalSettings(): RegionalSetting[]
getRegionalSettingByCountryCode(code: string): RegionalSetting | undefined

πŸ” Example

import {
  getRegionalSettingByCountryCode,
  getAllRegionalSettings,
} from '@financially/static-data-kit';

const usSettings = getRegionalSettingByCountryCode('US');
const all = getAllRegionalSettings();

πŸ“˜ Interface

export interface RegionalSetting {
  countryCode: string;
  dateFormat: DateFormat;
  timeFormat: TimeFormat;
  weekStartsOn: WeekStart;
  defaultTimeZone: string; // e.g. "Asia/Phnom_Penh"
  numberFormat: {
    format: string; // e.g. "comma-thousand-dot-decimal"
    example: string; // e.g. "1,234.56"
    groupingStyle: number[]; // e.g. [3]
    decimalSeparator: string; // e.g. "."
    thousandSeparator: string; // e.g. ","
  };
}

All the timezone values are used according to proper ISO format. We use the package: https://github.com/vvo/tzdb/


πŸ§ͺ Type Safety

All datasets are fully typed with TypeScript. You get complete IntelliSense, validation, and autocomplete support out-of-the-box.


πŸ“ Asset Access (Flags)

All country flags are stored as SVGs with filenames like:

IN.svg
US.svg
...

Each country object includes a flagFile field:

"flagFile": "IN.svg"

You can use this to construct the full flag URL using your own asset CDN or static hosting service.

βœ… Usage Example

import { getCountryByAlpha2Code } from '@financially/static-data-kit';

const CDN_BASE_URL = 'https://assets.your-domain.com/countries/';
const country = getCountryByAlpha2Code('IN');

const flagFile = `${CDN_BASE_URL}${country.flagFile}`;
console.log(flagFile);
// Output: https://assets.your-domain.com/countries/IN.svg

🀝 Contributing

PRs are welcome! Please follow these guidelines:

  • Keep entries alphabetically sorted where appropriate
  • Ensure field consistency and valid JSON
  • Add new types to src/types/index.ts
  • Store new country flags in src/assets/countries/XX.svg

See CONTRIBUTING.md for more details.


πŸ‘€ Author

Suprith Reddy – Creator & Maintainer github.com/suprith-s-reddy

Built with ❀️ at Financially modern SaaS products.


πŸ“„ License

MIT

About

This package is an easy way to access a static data like countries, job roles etc needed for Saas products

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published