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

naystack

v1.4.14

Published

A stack built with Next + GraphQL + S3 + Auth

Readme

Naystack

A minimal, powerful stack for Next.js app development. Built with Next.js + Drizzle ORM + GraphQL + S3 Auth.

npm version License: ISC

Installation

pnpm add naystack

1. Authentication

Naystack provides a seamless email-based authentication system with optional support for Google and Instagram.

Server Setup

Define your auth routes in app/api/(auth)/email/index.ts:

import { getEmailAuthRoutes } from "naystack/auth";
import { db } from "@/app/api/lib/db";
import { UserTable } from "@/app/api/(graphql)/User/db";
import { eq } from "drizzle-orm";

export const { GET, POST, PUT, DELETE, getContext } = getEmailAuthRoutes({
  createUser: async (data) => {
    const [user] = await db.insert(UserTable).values(data).returning();
    return user;
  },
  getUser: async (email) => {
    const [user] = await db
      .select({
        id: UserTable.id,
        email: UserTable.email,
        password: UserTable.password,
      })
      .from(UserTable)
      .where(eq(UserTable.email, email));
    return user;
  },
  keys: {
    signing: process.env.SIGNING_KEY!,
    refresh: process.env.REFRESH_KEY!,
  },
});

Note: Google and Instagram auth are also available via initGoogleAuth and initInstagramAuth from naystack/auth.

Client Setup

Wrap your application with AuthWrapper in your root layout or a client component.

// gql/client.ts
"use client";
import { AuthWrapper } from "naystack/auth/email/client";

Frontend Usage

import { useLogin, useSignUp, useLogout, useToken } from "naystack/auth/email/client";


function AuthComponent() {
  const login = useLogin();
  const signup = useSignUp();
  const logout = useLogout();
  const token = useToken(); // Get current JWT token

  // ... forms and handlers
}

2. GraphQL

Naystack leverages type-graphql and apollo-server for a type-safe GraphQL experience.

Server Setup

Initialize your GraphQL server in app/api/(graphql)/route.ts:

import { initGraphQLServer } from "naystack/graphql";
import { getContext } from "@/app/api/(auth)/email";
import { UserResolvers } from "./User/graphql";

export const { GET, POST } = await initGraphQLServer({
  getContext,
  resolvers: [UserResolvers],
});

Server Component Query

Call your GraphQL API from server components or actions:

// gql/server.ts
import { query } from "naystack/graphql/server";

// Usage in Page
const data = await query(MyQueryDocument, { variables });

Client Setup (Apollo)

For client-side GraphQL with Apollo:

// gql/client.ts
import { ApolloWrapper } from "naystack/graphql/client";

Frontend Usage

import { useAuthQuery, useAuthMutation } from "naystack/graphql/client";

function Profile() {
  const [getCurrentUser, { loading }] = useAuthMutation(GetCurrentUserDocument);
  // ...
}

3. File Upload

Naystack simplifies AWS S3 file uploads with presigned URLs and client-side helpers.

Server Setup

import { setupFileUpload } from "naystack/file";

export const { PUT, uploadFile, getDownloadURL } = setupFileUpload({
  region: process.env.AWS_REGION!,
  bucket: process.env.AWS_BUCKET!,
  awsKey: process.env.AWS_ACCESS_KEY_ID!,
  awsSecret: process.env.AWS_SECRET_ACCESS_KEY!,
  keys: {
    signing: process.env.SIGNING_KEY!,
    refresh: process.env.REFRESH_KEY!,
  },
  onUpload: async ({ url, type, userId, data }) => {
    // Save info to DB or process after successful upload
    return { success: true };
  },
});

Client Setup & Usage

import { useFileUpload } from "naystack/file/client";

function UploadButton() {
  const upload = useFileUpload();

  const handleFile = async (file: File) => {
    const res = await upload(file, "profile-picture", { some: "metadata" });
    console.log("Uploaded URL:", res.url);
  };
  // ...
}

4. Other Utilities

Client Hooks

  • useVisibility(onVisible): Triggers a callback when an element enters the viewport.
  • useBreakpoint(query): Responsive media query hook.

SEO

The setupSEO utility helps generate optimized Next.js metadata.

import { setupSEO } from "naystack/client";

export const getMetadata = setupSEO({
  siteName: "Naystack",
  title: "A powerful stack",
  description: "Built with Next.js",
  themeColor: "#000000",
});

Social APIs

Simplified access to Instagram and Threads APIs.

import { getInstagramUser, createThreadsPost } from "naystack/socials";

Minimal Environment Variables

SIGNING_KEY=your-jwt-signing-key
REFRESH_KEY=your-jwt-refresh-key
NEXT_PUBLIC_BACKEND_BASE_URL=http://localhost:3000/api
AWS_REGION=us-east-1
AWS_BUCKET=your-bucket-name
AWS_ACCESS_KEY_ID=xxx
AWS_SECRET_ACCESS_KEY=xxx