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

@fundtel/contracts

v1.1.0

Published

FundTel API contract definitions using ts-rest

Readme

Fundtel REST API Client - GitHub Package

This GitHub package contains type definitions and API contracts used by both the backend and frontend applications. It's privately published to GitHub Packages.

Purpose

  • Provides API contract definitions using @ts-rest/core
  • Contains Zod schemas for validation
  • Defines TypeScript types for the API
  • Ensures type safety and contract consistency across the application

Frontend Usage

Adding & Updating Package

You must be a member of the GitHub org for this to work

# Adding package
yarn add @fundtel-portal/contracts

# Updating package
yarn contracts:update

Initializing Client

import { initClient } from '@ts-rest/core';
import { appContract } from '@fundtel-portal/contracts';
import { supabase } from '../supabase-client';
import { Session } from '@supabase/supabase-js';

// Get initial session
let currentSession: Session | null = null;
supabase.auth.getSession().then(({ data: { session } }) => {
  currentSession = session;
});

// Listen for auth changes
supabase.auth.onAuthStateChange((_event, session) => {
  currentSession = session;
});

if (!import.meta.env.VITE_API_URL) {
  throw new Error('Missing API URL environment variable');
}

// Initialize the client with proper configuration
export const api = initClient(appContract, {
  baseUrl: import.meta.env.VITE_API_URL,
  baseHeaders: {
    'Content-Type': 'application/json',
    accept: '*/*',
    get Authorization() {
      return currentSession?.access_token ? `Bearer ${currentSession.access_token}` : '';
    },
  },
});

Structure

packages/contracts/
├── src/
│   ├── database.types.ts             # Supabase database types
│   ├── fundtel-api-contracts.ts     # ts-rest REST API contract
│   └── schemas/                      # Zod schemas
├── package.json
├── tsconfig.json                     # TypeScript configuration
└── scripts/                          # Contains script for `yarn contracts:version:up`

Versioning

# From the ROOT directory...
yarn contracts:version:up patch         # +0.0.1    Patch
yarn contracts:version:up minor         # +0.1.0    New feature
yarn contracts:version:up major         # +1.0.0    Breaking change

Defaults to patch

Publishing

1. Develop

  • Follow the existing contract structure
  • Use Zod for validation
  • Keep contracts in sync with API implementation

2. Test & publish

# login to npm
https://www.npmjs.com/

# From the ROOT directory...

# Test build
yarn contracts:build

# Version up package.json
yarn contracts:version:up               # defaults to patch (+0.0.1)

#GitHub PR
git add packages/contracts/
git commit -m "Version X.X.X"           # match package.json
git push

# Minor version bump & Publish package
yarn contracts:publish

3. Update the frontend:

yarn contracts:update

Schema Implementation

Null vs Optional

.nullable() - allows null value .optional() - allows field to be omitted (undefined) .default(null) - if field is omitted (undefined), it will be set to null

.nullable().default(null):

  • You can explicitly set the value to null: { field: null }
  • If you omit the field, it becomes null: {} -> { field: null }

Date vs Date Time

  • z.string().date(): 2025-08-21
  • z.string().datetime(): 2025-08-21 18:40:13.586891+00