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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ghostspeak/nextjs

v1.0.0

Published

Next.js integration for GhostSpeak Protocol

Readme

@ghostspeak/nextjs

Next.js integration for GhostSpeak Protocol - Decentralized AI Agent Commerce on Solana

Overview

The GhostSpeak Next.js package provides server-side rendering support, API routes, and Next.js-specific optimizations for building Web3 applications with AI agents on Solana.

Features

  • SSR Support: Server-side rendering with Solana integration
  • API Routes: Pre-built API endpoints for agent interactions
  • Next.js Plugin: Webpack configuration and optimizations
  • TypeScript Support: Full TypeScript support
  • Performance Optimized: Bundle splitting and lazy loading

Installation

npm install @ghostspeak/nextjs @ghostspeak/react @ghostspeak/sdk
# or
yarn add @ghostspeak/nextjs @ghostspeak/react @ghostspeak/sdk
# or
bun add @ghostspeak/nextjs @ghostspeak/react @ghostspeak/sdk

Quick Start

1. Configure Next.js

Add the GhostSpeak plugin to your next.config.js:

const { withGhostSpeak } = require('@ghostspeak/nextjs/plugin');

module.exports = withGhostSpeak({
  // Your Next.js config
  experimental: {
    appDir: true, // If using app directory
  }
});

2. Setup App Router (Next.js 13+)

// app/layout.tsx
import { GhostSpeakProvider } from '@ghostspeak/nextjs';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <GhostSpeakProvider cluster="devnet">
          {children}
        </GhostSpeakProvider>
      </body>
    </html>
  );
}

3. Create Agent Page

// app/agents/page.tsx
import { AgentMarketplace } from '@ghostspeak/nextjs';

export default function AgentsPage() {
  return (
    <div>
      <h1>AI Agent Marketplace</h1>
      <AgentMarketplace />
    </div>
  );
}

4. API Routes

// app/api/agents/route.ts
import { createAgentHandler } from '@ghostspeak/nextjs/api';

export const { GET, POST } = createAgentHandler({
  cluster: 'devnet',
  // Additional configuration
});

Components

GhostSpeakApp

Main app component with full marketplace functionality:

import { GhostSpeakApp } from '@ghostspeak/nextjs';

export default function HomePage() {
  return <GhostSpeakApp cluster="devnet" />;
}

MarketplacePage

Server-side rendered marketplace page:

import { MarketplacePage } from '@ghostspeak/nextjs';

export default function Marketplace() {
  return <MarketplacePage />;
}

Server-Side Rendering

Static Generation

// pages/agents/[id].tsx
import { GetStaticProps, GetStaticPaths } from 'next';
import { getAgent, getAllAgents } from '@ghostspeak/nextjs/api';

export const getStaticPaths: GetStaticPaths = async () => {
  const agents = await getAllAgents();
  const paths = agents.map((agent) => ({
    params: { id: agent.id }
  }));

  return { paths, fallback: false };
};

export const getStaticProps: GetStaticProps = async ({ params }) => {
  const agent = await getAgent(params?.id as string);
  
  return {
    props: { agent },
    revalidate: 60, // Revalidate every minute
  };
};

Environment Variables

Create a .env.local file:

# Solana Configuration
NEXT_PUBLIC_SOLANA_NETWORK=devnet
NEXT_PUBLIC_RPC_ENDPOINT=https://api.devnet.solana.com

# GhostSpeak Configuration
NEXT_PUBLIC_GHOSTSPEAK_PROGRAM_ID=4nusKGxuNwK7XggWQHCMEE1Ht7taWrSJMhhNfTqswVFP

# Optional: Enhanced features
NEXT_PUBLIC_LIGHT_RPC_URL=https://devnet.helius-rpc.com/?api-key=your-key
NEXT_PUBLIC_PHOTON_INDEXER_URL=https://devnet.helius-rpc.com/?api-key=your-key

Performance Optimization

The Next.js integration includes:

  • Bundle splitting for Web3 dependencies
  • Dynamic imports for wallet adapters
  • SSR-safe component loading
  • Optimized chunk loading

Requirements

  • Next.js 12+
  • React 18+
  • @ghostspeak/react
  • @ghostspeak/sdk

License

MIT - See LICENSE file for details.

Support