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

@tenderlift/simap-client

v0.2.0

Published

SIMAP TypeScript API Client

Readme

@tenderlift/simap-client

npm version License: MIT Bundle Size

TypeScript client for the SIMAP (Swiss Public Procurement) API, auto-generated from the official OpenAPI specification.

⚠️ Non-affiliation Notice: This is an unofficial, open-source library for the SIMAP API. It is developed and maintained independently by TenderLift. While SIMAP has graciously approved the open-sourcing of this library, they do not control, endorse, or bear any responsibility for it. For official information, visit simap.ch.

Features

  • Full TypeScript support with comprehensive type definitions
  • Multi-runtime compatible: Node.js 20+, Cloudflare Workers, Vercel/Netlify Edge
  • Lightweight: <10KB gzipped (5.3KB ESM, 7.28KB CJS)
  • Auto-generated from official SIMAP OpenAPI specification
  • Built-in error handling with typed error responses
  • Authentication helpers for token-based auth
  • Well tested: 67 tests across Node.js and Worker environments

Try it Online

Open in GitHub Codespaces

Launch a pre-configured development environment in your browser with GitHub Codespaces to explore the SIMAP client examples instantly.

Installation

npm install @tenderlift/simap-client
# or
pnpm add @tenderlift/simap-client
# or
yarn add @tenderlift/simap-client

Quick Start

Basic Usage (Node.js/Edge)

import { client, listCantons, getPublicProjectSearch } from '@tenderlift/simap-client';

// Configure the client (optional - defaults to SIMAP API)
client.setConfig({
  baseUrl: 'https://www.simap.ch/api',
  headers: {
    // Add authentication if needed
    // 'Authorization': `Bearer ${token}`
  },
});

// Fetch reference data
const cantons = await listCantons();
console.log(cantons.data); // List of Swiss cantons

// Search for projects
const projects = await getPublicProjectSearch({
  query: {
    orderAddressCantons: ['TI', 'GR'],
    search: 'construction'
  }
});
console.log(projects.data?.projects);

Error Handling

import { ensureOk, HttpError } from '@tenderlift/simap-client';

try {
  const response = await listCantons();
  const data = ensureOk(response); // Throws HttpError if response is not ok
  console.log(data);
} catch (error) {
  if (error instanceof HttpError) {
    console.error(`HTTP ${error.status}: ${error.message}`);
    console.error('Error data:', error.data);
  }
}

Authentication

import { withAuth } from '@tenderlift/simap-client';

// Add authentication to all requests
const auth = { token: 'your-api-token' };
client.interceptors.request.use((request) => {
  return withAuth(auth)(request);
});

Browser Support

Direct browser usage is not supported because the SIMAP API does not send CORS headers.

If you need to use this client in a browser application, you must:

  1. Set up a proxy server (your backend, edge function, or development server)
  2. Route SIMAP API requests through your proxy
  3. Configure the client to use your proxy URL

Example proxy setup with Vite:

// vite.config.js
export default {
  server: {
    proxy: {
      '/api': {
        target: 'https://www.simap.ch',
        changeOrigin: true,
      }
    }
  }
}

API Documentation

Available Endpoints

Reference Data

  • listCantons() - Get all Swiss cantons
  • listCountries() - Get all countries
  • listLanguages() - Get supported languages
  • listActivities() - Get TED activity codes
  • listCriteria() - Get selection criteria

Project Search

  • getPublicProjectSearch(options) - Search public procurement projects
  • getProjectHeaderById(options) - Get project details by ID
  • getPublicationDetail(options) - Get publication details

Classification Codes

  • listCPVCodes() - Common Procurement Vocabulary codes
  • listCPCCodes() - Central Product Classification codes
  • listBKPCodes() - Swiss construction classification codes
  • listNPKCodes() - Swiss standard position catalog codes

Response Structure

All API methods return a response object with the following structure:

interface ApiResponse<T> {
  data?: T;        // Response data (undefined on error)
  error?: unknown; // Error information
  response: Response; // Raw fetch Response object
}

Development

See CONTRIBUTING.md for development setup and guidelines.

Scripts

  • pnpm build - Build the library
  • pnpm test - Run all tests
  • pnpm typecheck - Type checking
  • pnpm lint - Run linter
  • pnpm size - Check bundle size

Troubleshooting

Common Issues

TypeScript Types Not Found

Ensure your tsconfig.json includes:

{
  "compilerOptions": {
    "moduleResolution": "node",
    "esModuleInterop": true
  }
}

Network Errors in Node.js

For Node.js versions before 20, you may need a fetch polyfill:

npm install node-fetch

Authentication Errors

Ensure your API token is valid and properly formatted in the Authorization header.

License

MIT © TenderLift

See LICENSE file for details.

Links


Built with ❤️ for the Swiss open-source community