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

@tryline/interface

v1.0.13

Published

Shared TypeScript interface definitions for API responses across the Tryline platform.

Readme

@tryline/interface

Shared TypeScript interface definitions for API responses across the Tryline platform.

Overview

This package contains shared type definitions for API responses only used across the Tryline ecosystem:

  • Backend API (tryline-backend-api)
  • React Native App (tryline-app)
  • Future web applications

Important: This package contains only TypeScript interfaces and types. It does NOT include:

  • API client implementations
  • HTTP request/response handling
  • Backend-specific logic (database queries, etc.)

Structure

src/
├── api/              # API response and request types
│   ├── competitions.ts  # Competition-related response types
│   ├── test.ts         # Test endpoint response types
│   └── index.ts        # Exports all API types
├── common/           # Common shared types
│   ├── response.ts   # ApiResponse<T> interface
│   └── index.ts      # Exports common types
└── index.ts         # Main entry point

Usage

When building NPM package

cd tryline-Interface && npm run build && npm version patch && npm publish --access public

In Backend (tryline-backend-api)

import {
  Competition,
  Season,
  GetAllCompetitionsForSportResponse,
} from "@tryline/interface";
// or specifically:
import { GetSentenceByIdResponse } from "@tryline/interface";

In Frontend (tryline-app)

import { GetAllCompetitionsForSportResponse } from "@tryline/interface";
// or:
import { Competition, Season } from "@tryline/interface";

Development Workflow

Initial Setup

The package is installed locally using file references in both frontend and backend:

{
  "dependencies": {
    "@tryline/interface": "file:../../tryline-Interface"
  }
}

Building the Package

After making changes to type definitions, you must rebuild:

cd tryline-Interface
npm run build

You also add the route to package.json.

This compiles TypeScript to JavaScript in the dist/ folder and generates .d.ts declaration files.

Watch Mode (Recommended for Development)

For active development, use watch mode in a separate terminal:

cd tryline-Interface
npm run watch

This automatically rebuilds whenever you save changes to source files.

Reinstalling in Consumer Projects

After building, reinstall in the backend and/or frontend to pick up changes:

# Backend
cd tryline-API/tryline-backend-api
npm install

# Frontend
cd tryline-RN/tryline-app
npm install

Note: For production builds, as long as the dist/ folder exists with compiled output, the consuming projects will import the types correctly. The local file reference ensures the latest built version is always used.

Adding New API Response Types

Step 1: Create or Update Type File

Create a new file in src/api/ for your domain or update an existing one:

// src/api/teams.ts
export interface Team {
  team_id: number;
  display_name: string;
  slug: string;
  // ... other fields
}

export interface GetAllTeamsForCompetitionResponse {
  teams: Team[];
}

Step 2: Export from API Index

Add the export to src/api/index.ts:

export * from "./competitions";
export * from "./test";
export * from "./teams"; // Add this line

Step 3: Rebuild the Package

cd tryline-Interface
npm run build

Step 4: Use in Backend

Backend query result types stay in backend, shared response types use the interface:

// Backend: src/types/teams.ts (backend-specific)
export interface GetAllTeamsQueryResult {
  // Raw database query result
}

// Backend: src/services/teams.service.ts
import { GetAllTeamsForCompetitionResponse } from "@tryline/interface";

static async getAllTeams(): Promise<ApiResponse<GetAllTeamsForCompetitionResponse>> {
  // ... implementation
}

Step 5: Use in Frontend

// Frontend: api/services/teams.ts
import { GetAllTeamsForCompetitionResponse } from "@tryline/interface";

export const teamsService = {
  getAllTeams: async (): Promise<
    ApiResponse<GetAllTeamsForCompetitionResponse>
  > => {
    const response = await apiClient.get("/teams");
    return response.data;
  },
};

Production Builds

For production deployments:

  1. Ensure the package is built before deploying consuming applications:

    cd tryline-Interface && npm run build
  2. The dist/ folder must exist - consuming projects reference the compiled output

  3. File references work in production as long as the relative path structure is maintained:

    /project-root
      /tryline-Interface/dist/  ← Must exist
      /tryline-API/tryline-backend-api/
      /tryline-RN/tryline-app/
  4. Both backend and frontend package.json files reference "file:../../tryline-Interface", which will resolve correctly in any environment with this folder structure

Type Categories

API Response Types (src/api/)

  • Endpoint-specific response structures
  • Returned directly from API calls
  • Shared between backend return types and frontend consumption
  • Examples: GetAllCompetitionsForSportResponse, GetSentenceByIdResponse

Common Types (src/common/)

  • Generic wrapper types used across all APIs
  • Examples: ApiResponse<T> (standardized response wrapper)

NOT Included

  • Database query result types (these stay backend-specific)
  • API client logic (axios/fetch implementations)
  • Backend helper functions (createSuccessResponse, etc.)

Notes

  • All types are compiled to the dist/ folder
  • The package uses ES modules (ES2022)
  • TypeScript declaration files (.d.ts) are automatically generated
  • Changes require rebuilding the package to take effect
  • Use watch mode during active development for automatic rebuilds