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

@atiempo/tiendaenbio-kit

v0.3.0

Published

Integration kit for TiendaEnBio artisanal storefronts

Readme

@atiempo/tiendaenbio-kit

Kit de integración para tiendas artesanales de TiendaEnBio: expone RPCs de lectura, helpers de checkout por WhatsApp y utilidades de analítica.

Instalación

npm install @atiempo/tiendaenbio-kit

Configuración

Instancia el cliente pasando la URL pública y la clave anónima de tu proyecto Supabase. Estas variables se llaman habitualmente SUPABASE_URL y SUPABASE_ANON_KEY (o NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY en Next.js, PUBLIC_SUPABASE_URL / PUBLIC_SUPABASE_ANON_KEY en Astro).

import { createTiendaEnBioClient } from '@atiempo/tiendaenbio-kit';

const client = createTiendaEnBioClient(
  process.env.NEXT_PUBLIC_SUPABASE_URL!,
  process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!,
);

RPCs de lectura

Todas las funciones devuelven { data, error }. Si error es null, data contiene el resultado; si ocurre un problema, data es null y error es un Error. El campo price siempre llega como number, ya convertido internamente.

getPublicStore

import { createTiendaEnBioClient, getPublicStore } from '@atiempo/tiendaenbio-kit';

const client = createTiendaEnBioClient(supabaseUrl, supabaseAnonKey);

const { data: store, error } = await getPublicStore(client, 'mi-tienda');
if (error) {
  console.error(error.message);
} else {
  console.log(store?.store_name);
}

getPublicProducts

import { createTiendaEnBioClient, getPublicProducts } from '@atiempo/tiendaenbio-kit';

const client = createTiendaEnBioClient(supabaseUrl, supabaseAnonKey);

const { data: products, error } = await getPublicProducts(client, 'mi-tienda');
if (error) {
  console.error(error.message);
} else {
  // product.price es number
  products?.forEach((p) => console.log(p.name, p.price));
}

getPublicProductBySlug

import { createTiendaEnBioClient, getPublicProductBySlug } from '@atiempo/tiendaenbio-kit';

const client = createTiendaEnBioClient(supabaseUrl, supabaseAnonKey);

const { data: product, error } = await getPublicProductBySlug(
  client,
  'mi-tienda',
  'mi-producto',
);
if (error) {
  console.error(error.message);
} else {
  console.log(product?.name, product?.price); // price es number
}

Flujo de checkout WhatsApp

Ejemplo end-to-end: obtener el producto, registrar al comprador, crear la orden y construir el link de WhatsApp.

import {
  createTiendaEnBioClient,
  getPublicProductBySlug,
  createOrGetCustomer,
  createPendingOrder,
  buildWhatsAppUrl,
} from '@atiempo/tiendaenbio-kit';

const client = createTiendaEnBioClient(supabaseUrl, supabaseAnonKey);

// 1. Obtener producto y store_id
const { data: product, error: productError } = await getPublicProductBySlug(
  client,
  'mi-tienda',
  'mi-producto',
);
if (productError || !product) throw productError;

// 2. Registrar o recuperar el comprador
const { data: customer, error: customerError } = await createOrGetCustomer(
  client,
  {
    storeId: product.store_id,
    name: 'Ana García',
    email: '[email protected]',
    phone: '+34600000000',
  },
);
if (customerError || !customer) throw customerError;

// 3. Crear la orden en estado pendiente
const { data: order, error: orderError } = await createPendingOrder(client, {
  storeId: product.store_id,
  customerId: customer.customer_id,
  productId: product.product_id,
  quantity: 1,
});
if (orderError || !order) throw orderError;

// 4. Construir el link de WhatsApp y redirigir
const whatsappUrl = buildWhatsAppUrl({
  whatsapp: product.whatsapp!,
  productName: product.name,
  orderId: order.order_id,
});
window.open(whatsappUrl, '_blank');

Conectar una tienda nueva en menos de 30 minutos

  1. Instalar el paquete

    npm install @atiempo/tiendaenbio-kit
  2. Configurar variables de entorno

    Obtén la URL y la clave anónima desde el dashboard de Supabase → Project Settings → API.

    SUPABASE_URL=https://xxxx.supabase.co
    SUPABASE_ANON_KEY=eyJ...
  3. Instanciar el cliente

    import { createTiendaEnBioClient } from '@atiempo/tiendaenbio-kit';
    const client = createTiendaEnBioClient(
      process.env.SUPABASE_URL!,
      process.env.SUPABASE_ANON_KEY!,
    );
  4. Verificar la conexión

    const { data, error } = await getPublicStore(client, 'tu-slug');
    console.log(data); // debe devolver los datos de tu tienda
  5. Implementar el flujo de checkout usando los helpers de checkout.ts: createOrGetCustomer, createPendingOrder y buildWhatsAppUrl (ver sección anterior).

Variables de entorno por stack

| Stack | Variables | |---|---| | HTML/JS plano | Define SUPABASE_URL y SUPABASE_ANON_KEY como const directamente en el código, o cárgalas desde un .env usando un build step mínimo (esbuild, Vite). | | Next.js | Usa .env.local con el prefijo NEXT_PUBLIC_: NEXT_PUBLIC_SUPABASE_URL y NEXT_PUBLIC_SUPABASE_ANON_KEY. | | Astro | Usa .env o .env.local con el prefijo PUBLIC_: PUBLIC_SUPABASE_URL y PUBLIC_SUPABASE_ANON_KEY. |