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

@tracio/svelte

v0.1.3

Published

Tracio Svelte 5 — store-based API for bot detection & device fingerprinting

Readme

@tracio/svelte

Svelte 5 wrapper for the Tracio bot detection SDK.

Install

npm install @tracio/svelte @tracio/sdk

(Svelte 5 must be installed separately.)

Quick start

<!-- +layout.svelte -->
<script>
  import { Tracio } from "@tracio/svelte";
  import { browser } from "$app/environment";

  if (browser) {
    Tracio.init({ publicKey: import.meta.env.VITE_TRACIO_KEY });
  }
</script>

<slot />
<!-- AnyComponent.svelte -->
<script>
  import { useVisitorId } from "@tracio/svelte";

  const visitor = useVisitorId();
</script>

{#if $visitor.isLoading}
  Loading…
{:else if $visitor.error}
  Error: {$visitor.error.message}
{:else}
  Visitor: {$visitor.data}
{/if}

($visitor is Svelte's auto-subscription syntax for stores.)

API

Tracio.init(config: TracioConfig): TracioInstance

Per-tree context wrapper around the core Tracio.init() — each call owns its own result store (no module singleton). Call once on app boot (client-side only — wrap in if (browser) for SvelteKit SSR safety).

useVisitorId(): Readable<{ data, isLoading, error }>

Svelte store. Access via $store syntax in .svelte components.

  • data: string | undefined
  • isLoading: boolean
  • error: TracioError | null

useTracioResult(opts?): Readable<{ data, isLoading, error }> & { getData }

Same store shape; data is the full TracioResult. The returned store also exposes getData(): Promise<void> to imperatively (re)fetch; pass { immediate: false } to skip the on-mount fetch.

Roadmap

v0.2.0 — Svelte 5 runes-class API (useVisitorId() returns { data, isLoading, error } accessible without $ prefix). Current store-based API will remain available for backward compatibility.

SSR (SvelteKit)

  • Server: Tracio.init returns a stub instance (SDK SSR guard). Stores stay in isLoading: true.
  • Client: Tracio.init bootstraps the script + result; stores update via writable.set.

Wrap Tracio.init in if (browser) from $app/environment to skip the server call entirely.

Example

Runnable Vite + Svelte app: ../examples/svelte.

License

MIT