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

exist-sdk-typescript

v3.1.0

Published

Zero-dependency typescript wrapper for authenticating and querying the exist.io API.

Downloads

24

Readme

Exist.io TypeScript SDK

A TypeScript SDK for interacting with the Exist.io API. Exist.io is a personal analytics platform that integrates data from multiple services to help users track and understand various aspects of their lives.

Features

OAuth2 Authentication – Handles access tokens and refresh tokens.
Full API Coverage – Supports attributes, averages, correlations, insights, and user profiles.
Strongly Typed Models – Uses TypeScript interfaces and enums to ensure type safety.

Installation

To install the package for a Node.js project using npm, run:

npm install exist-sdk-typescript

To install in a Deno project,run:

deno add jsr:@leonschreiber96/exist-sdk-typescript

Getting Started

0️⃣ Import the SDK

Using NPM:

import { ExistAuthorizer, ExistClient } from "exist-sdk-typescript";

Using Deno:

import { ExistClient, ExistAuthorizer } from "@leonschreiber96/exist-sdk-typescript";

1️⃣ Authentication

To interact with the Exist.io API, you must authenticate using OAuth2. Follow this guide to create an API client.

Use the ExistAuthorizer class to provide authentication tokens in one of three ways:

const authorizer = new ExistAuthorizer("your-client-id", "your-client-secret");

// Option 1: Provide tokens directly
authorizer.useTokens("your-access-token", "your-refresh-token");

// Option 2: Load tokens from a JSON file
authorizer.useAuthorizationFile("path/to/tokens.json");

// Option 3: Use OAuth2 flow to obtain a token dynamically
authorizer.useOAuthFlow(["mood_read", "activity_read"], "http://localhost:8000");

Authentication JSON File

If you're using Option 2 (loading tokens from a JSON file), the JSON file should look like this:

{
  "oAuthToken": "your-access-token",
  "refreshToken": "your-refresh-token"
}

The oAuthToken is the access token, and the refreshToken is the refresh token that can be used to obtain new access tokens when they expire.

OAuth2 Flow

For Option 3, the useOAuthFlow method requires two arguments:

  1. Scopes: A list of scopes that define the level of access your client has. Scopes can be read or write permissions (for example, ReadScope.MOOD, WriteScope.ACTIVITY, etc.). The first argument to useOAuthFlow should be an array of the scopes your client will need. You can choose to give your client read, write, or both types of permissions, depending on your use case.

  2. Redirect URI: This must be a free port on localhost (e.g., http://localhost:8000/) and must match the redirect uri you entered when creating your developer client. Your client will listen for the OAuth response from Exist on this port and automatically extract the access and refresh tokens. After completing the OAuth flow, be sure to save the tokens that the client displays.

  3. Callback (optional): Function that will be executed after the oAuth flow has been completed. Gets the oAuth token response passed as a parameter. You can use this for example to save your tokens to a file, using authorizer.dumpAuthorizationToFile("filename.json")

Here is an example:

authorizer.useOAuthFlow(
  [ReadScope.FINANCE, WriteScope.FINANCE], // Scopes
  "http://localhost:8000/", // Redirect URI
  (tokens) => { console.log(tokens) } // Callback function
);

2️⃣ Initialize the ExistClient

Once authenticated, initialize ExistClient to make API calls:

const client = new ExistClient(authorizer);

3️⃣ Fetch Data from Exist.io

📌 Get User Profile

const profile = await client.users.getUserProfile();
console.log(profile);

📌 Get Owned Attributes

const attributes = await client.attributes.getOwned();
console.log(attributes);

📌 Update an Attribute

await client.attributes.updateValues([{ name: "steps", value: 5000, date: "2025-03-05" }]);

API Reference

The SDK provides structured access to the Exist.io API through these modules:

| Module | Description | |--------|-------------| | attributes | Manage tracked attributes (e.g., mood, steps, sleep). | | averages | Get attribute averages over time. | | users | Access user profile data. | | correlations | Find correlations between tracked attributes. | | insights | Retrieve generated insights. |

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch (feature/my-feature).
  3. Commit your changes.
  4. Push to the branch.
  5. Open a Pull Request.

License

This project is licensed under the GNU GPL-3.0 license.