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

happo-connect

v1.0.5

Published

The official JavaScript SDK for Happo.gg social login

Readme

Happo.js – The Official Social Login SDK for Happo

What is Happo.js?

Happo.js is a lightweight and easy-to-use JavaScript SDK that allows websites and applications to integrate Happo social login just like Facebook or Google OAuth.

With this, users can authenticate via Happo.gg and retrieve their account details securely without needing to create a separate login system.

🔹 No API keys required
🔹 Secure popup-based authentication
🔹 Simple event-driven approach

🚀 Features

✅ One-click authentication via Happo
✅ Handles popup closures & errors automatically
✅ Event-driven API (onConnect, onError)
✅ Fully Promise-based for async/await support


📦 Installation

Using a CDN (Recommended)

Simply include the following script in your HTML file:

<script src="https://www.happo.gg/connect/sdk.js"></script>

Via NPM

npm install happo-connect

Then import it in your project:

import Happo from "happo-connect"

🛠️ Usage

Quick Example

Happo.onConnect(user=>console.log("Connected as:",user))
Happo.onError(()=>console.log("Login failed or closed"))

Happo.connect().then(user=>{
    console.log("User data received:",user)
}).catch(err=>{
    console.error("Authentication failed:",err)
})

Advanced Example

For more control, you can handle login and display user details dynamically:

document.getElementById("login-btn").addEventListener("click",async()=>{
    try{
        const user=await Happo.connect()
        document.getElementById("user-name").innerText=`Welcome, ${user.name}!`
    }catch(err){
        console.error("Failed to login:",err)
    }
})

🧑‍💻 API Reference

Happo.connect(): Promise<User>

Opens the Happo authentication popup and returns a Promise with the logged-in user’s details.

Example

const user=await Happo.connect()
console.log(user.name) /// "Player1"

Returned User Object

| Property | Type | Description | |--------------|----------|-------------| | id | number | Unique user ID | | name | string | User’s display name | | motto | string | User's bio/status | | email | string | Email (if permitted) | | figure | string | User's avatar figure | | club | boolean | Whether the user has Happo Club | | rank | number | User rank/level | | session | string | Session token for backend validation | | timestamp | number | Login timestamp |


Happo.onConnect(callback: (user: User) => void): void

Fires when a user successfully logs in. Provides the user object as an argument.

Example

Happo.onConnect(user=>{
    console.log("User logged in:",user)
})

Happo.onError(callback: () => void): void

Fires when login fails (e.g., popup blocked, user closes it, or an error occurs).

Example

Happo.onError(()=>{
    console.log("Login process was canceled or failed.")
})

🔒 How It Works

  1. Happo.connect() opens a popup for authentication.
  2. The user logs in via Happo.gg.
  3. Happo sends the user’s details securely via window.postMessage().
  4. The SDK captures the message, validates it, and resolves the Promise.
  5. You can access the user’s details in onConnect() or via the Promise response.

📌 Full Code Example

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>Happo Login Demo</title>
</head>
<body>
    <button id="login-btn">Connect with Happo</button>
    <h2 id="user-name"></h2>

    <script src="https://www.happo.gg/connect/sdk.js"></script>
    <script>
        document.getElementById("login-btn").addEventListener("click",async()=>{
            try{
                const user=await Happo.connect()
                document.getElementById("user-name").innerText=`Welcome, ${user.name}!`
            }catch(err){
                console.error("Failed to login:",err)
            }
        })
    </script>
</body>
</html>

🌟 Why Use Happo.js?

No extra dependencies – Works out-of-the-box
Secure – Uses postMessage & auto-closes popups
Event-driven – Listen for onConnect & onError
Works with any front-end framework (React, Vue, Vanilla JS)


📄 License

MIT License © 2025 Happo.gg