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

@monarkmarkets/api-client

v1.3.55

Published

This package provides a TypeScript client for interacting with the Monark Markets API.

Downloads

1,621

Readme

@monarkmarkets/api-client

This package provides a TypeScript client for interacting with the Monark Markets API.

Installation

npm install @monarkmarkets/api-client

Usage

To use this client, you'll need to set up a simple proxy server that forwards requests to the Monark API with the appropriate authentication.

Important: API Proxy Server Requirement

This client requires a server running under the /api path that forwards requests to the Monark API with authentication. This proxy server:

  1. Injects authentication credentials
  2. Forwards all requests to the Monark API
  3. Returns the responses to the client

Setting up a Proxy Server

Below is an example of a minimal Express.js server that forwards requests to the Monark API:

// server.js
import express from 'express';
import axios from "axios";
import * as dotenv from 'dotenv';
dotenv.config();

const app = express();

const API_BASE_URL = process.env.API_BASE_URL || 'https://demo-api.monark-markets.com';
const AUTH_TOKEN = process.env.AUTH_TOKEN;

// Parse JSON payloads
app.use(express.json());

// API router for forwarding requests
const apiRouter = express.Router();

apiRouter.use('*', async (req, res) => {
  try {
    // Build the target URL by combining base URL and original path
    let targetUrl = `${API_BASE_URL}${req.originalUrl}`;
    targetUrl = targetUrl.replace("/api/", "/");

    // Forward the request to the target API
    const response = await axios({
      method: req.method,
      url: targetUrl,
      data: req.body,
      headers: {
        // Add the authorization header
        'Authorization': `Bearer ${AUTH_TOKEN}`
      },
      // Forward query parameters
      params: req.query,
      // Handle binary responses
      responseType: 'arraybuffer'
    });

    // Set response headers
    Object.entries(response.headers).forEach(([key, value]) => {
      // Skip Transfer-Encoding header to prevent conflicts with Express
      if (key.toLowerCase() !== 'transfer-encoding') {
        res.set(key, value);
      }
    });

    // Send response
    res.status(response.status).send(response.data);

  } catch (error) {
    // Handle errors from the target API
    if (error.response) {
      res.status(error.response.status).send(error.response.data);
    } else {
      res.status(500).json({
        error: 'Internal Server Error',
        message: error.message
      });
    }
  }
});

// Mount API router - all API routes will be prefixed with /api
app.use('/api', apiRouter);

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(`API proxy server running on port ${PORT}`);
});

Environment Variables

Create a .env file in your project root:

API_BASE_URL=https://demo-api.monark-markets.com
AUTH_TOKEN=your_auth_token_here

Using the Client

import { Client } from '@monarkmarkets/api-client';

// Initialize the client with the proxy API URL
const client = new Client('/api');

// Example: Get all PreIPOCompanies
async function getAllPreIPOCompanies() {
  try {
    // You can add optional parameters for search, pagination, etc.
    const result = await client.preIpoCompany2(
      undefined, // searchTerm (optional)
      undefined, // sortOrder (optional)
      1,         // page
      10         // pageSize
    );
    
    console.log(`Found ${result.pagination?.totalRecords || 0} companies`);
    console.log('Companies:', result.items);
    
    return result;
  } catch (error) {
    console.error('Error fetching PreIPO companies:', error);
    throw error;
  }
}

// Call the function
getAllPreIPOCompanies();

Authentication

The API client itself doesn't handle authentication. Instead, authentication happens at the proxy server level by including the AUTH_TOKEN in the forwarded requests.

API Methods

The client provides methods for all API endpoints in the Monark API. Some examples include:

  • preIpoCompany2() - Get all PreIPO companies
  • preIpoCompany(id) - Get a PreIPO company by ID
  • indicationOfInterestPOST(body) - Create an indication of interest
  • investorGET(id) - Get investor information
  • And many more...

For the full list of available methods, refer to the TypeScript definitions in the client code.

The full API documentation can be found here: https://api-docs.monark-markets.com/