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

@dataql/astro

v0.1.2

Published

DataQL Astro SDK with SSR/SSG support and multi-framework compatibility

Readme

@dataql/astro

DataQL Astro SDK with SSG/SSR support and multi-framework island compatibility.

Features

  • 🌟 Astro Optimized: Built specifically for Astro's island architecture
  • 🏝️ Island Support: Works seamlessly with React, Vue, Svelte, and other framework islands
  • 📊 Static First: Optimized for static site generation with optional SSR
  • 🔄 Offline-First: Works offline with automatic sync when online
  • Performance: Minimal JavaScript footprint with island hydration
  • 🎯 TypeScript: Full TypeScript support with type inference

Installation

npm install @dataql/astro
# or
yarn add @dataql/astro

Quick Start

1. Add DataQL Integration

// astro.config.mjs
import { defineConfig } from "astro/config";
import { createAstroIntegration } from "@dataql/astro";

export default defineConfig({
  integrations: [
    createAstroIntegration({
      appToken: "your-app-token",
      databaseName: "my-astro-db",
    }),
  ],
});

2. Fetch Data in Astro Components

---
// src/pages/posts.astro
import { DataQLAstroClient } from '@dataql/astro';

const client = new DataQLAstroClient({
  appToken: 'your-app-token',
  staticGeneration: true,
});

const posts = await client.find('posts');
---

<html>
  <head>
    <title>Blog Posts</title>
  </head>
  <body>
    <h1>Latest Posts</h1>
    {posts.map(post => (
      <article>
        <h2>{post.title}</h2>
        <p>{post.excerpt}</p>
        <a href={`/posts/${post.slug}`}>Read more</a>
      </article>
    ))}
  </body>
</html>

3. Interactive Islands

---
// src/components/PostList.astro
import PostManager from './PostManager';
import { DataQLAstroClient } from '@dataql/astro';

const client = new DataQLAstroClient({
  appToken: 'your-app-token',
  islandMode: true,
});

const initialPosts = await client.find('posts');
---

<!-- Static content -->
<h1>Posts</h1>

<!-- Interactive island -->
<PostManager
  client:load
  initialPosts={initialPosts}
  dataqlConfig={{
    appToken: 'your-app-token',
    enablePersistence: true,
  }}
/>

4. React Island Example

// src/components/PostManager.jsx
import { useState, useEffect } from "react";

export default function PostManager({ initialPosts, dataqlConfig }) {
  const [posts, setPosts] = useState(initialPosts);
  const [loading, setLoading] = useState(false);

  const addPost = async (postData) => {
    setLoading(true);
    // DataQL operations would work here
    setLoading(false);
  };

  return (
    <div>
      <button onClick={() => addPost({ title: "New Post" })}>
        {loading ? "Adding..." : "Add Post"}
      </button>

      {posts.map((post) => (
        <div key={post.id}>
          <h3>{post.title}</h3>
          <p>{post.content}</p>
        </div>
      ))}
    </div>
  );
}

5. Dynamic Routes

---
// src/pages/posts/[slug].astro
import { DataQLAstroClient } from '@dataql/astro';

const { slug } = Astro.params;

const client = new DataQLAstroClient({
  appToken: 'your-app-token',
});

const post = await client.find('posts', { slug });

if (!post.length) {
  return Astro.redirect('/404');
}

const currentPost = post[0];
---

<html>
  <head>
    <title>{currentPost.title}</title>
  </head>
  <body>
    <article>
      <h1>{currentPost.title}</h1>
      <div>{currentPost.content}</div>
    </article>
  </body>
</html>

API Reference

Client

  • DataQLAstroClient - Main client for Astro applications
  • AstroDataQLComponent - Component wrapper for island hydration

Integration

  • createAstroIntegration() - Astro integration setup

Utilities

  • createAstroDataQLConfig() - Create optimized configuration
  • fetchStaticData() - Helper for static data fetching
  • prefetchData() - Preload data for performance

Configuration

const config = {
  appToken: "your-app-token",
  databaseName: "my-astro-db",
  enablePersistence: true,
  staticGeneration: true,
  islandMode: true,
  syncConfig: {
    autoSync: true,
    syncInterval: 30000,
  },
  debug: false,
};

Multi-Framework Support

DataQL Astro SDK works with all framework islands:

React

import { DataQLProvider } from "@dataql/astro/react";

Vue

<script setup>
import { useDataQL } from "@dataql/astro/vue";
</script>

Svelte

<script>
import { dataql } from '@dataql/astro/svelte';
</script>

Build-Time Optimization

DataQL automatically optimizes for Astro's build process:

  • Static Data: Fetched at build time for static pages
  • Island Hydration: Minimal JavaScript for interactive components
  • Prefetching: Intelligent data prefetching for better performance
  • Caching: Build-time and runtime caching strategies

License

MIT