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

perfect-template

v0.2.4

Published

A modern Next.js SaaS template with progressive feature activation. Start with core features and add services as needed.

Readme

Perfect Template

A modern Next.js SaaS template with progressive feature activation. Start with core features and add services as needed.

Quick Start

# Clone the template
git clone https://github.com/yourusername/perfect-template.git
cd perfect-template

# Install dependencies
npm install

# Run interactive setup
npm run setup

# Start development server
npm run dev

Interactive Setup CLI

Run npm run setup to configure your services:

🚀 Perfect Template Setup

Which services would you like to set up?

Clerk Authentication (y/N): y
Convex Database (y/N): y
Autumn Billing (y/N): n
AI Integration (optional) (y/N): y
Email (Resend) (y/N): y

The CLI will:

  • ✅ Install required packages
  • ✅ Create necessary files and folders
  • ✅ Generate .env.local with placeholders
  • ✅ Set up API routes and components

Services

Core (Always Included)

  • Next.js 15 with App Router
  • TypeScript
  • Tailwind CSS
  • shadcn/ui components

Optional Services (Add via CLI)

🔐 Clerk Authentication

  • User authentication and management
  • Social logins (Google, GitHub, etc.)
  • Multi-factor authentication
  • User profiles and metadata

🗄️ Convex Database

  • Real-time database
  • Serverless functions
  • File storage
  • Automatic TypeScript types

💳 Autumn Billing

  • Subscription management
  • Usage-based billing
  • Payment processing
  • Customer portal

🤖 AI Integration

  • OpenAI GPT models
  • Anthropic Claude
  • Streaming responses
  • Token usage tracking

📧 Email (Resend)

  • Transactional emails
  • React email templates
  • Email delivery tracking
  • Domain verification

Progressive Architecture

The template uses a hierarchical service structure:

  1. Core Mode: Just Next.js - no auth or database
  2. Database Mode: Automatically enables auth when you add Convex
  3. Full Mode: All services enabled

Services activate based on environment variables in .env.local:

# No keys = Core mode
# Add Convex keys = Auth + Database enabled
# Add other keys = Additional features enabled

Environment Variables

After running setup, add your API keys to .env.local:

# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...

# Convex Database
NEXT_PUBLIC_CONVEX_URL=https://...convex.cloud
CONVEX_DEPLOY_KEY=...

# Autumn Billing
NEXT_PUBLIC_AUTUMN_ORG_ID=org_...
AUTUMN_API_KEY=ak_...

# AI Integration
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...

# Email
RESEND_API_KEY=re_...

Quick Links to Get API Keys:

Project Structure

perfect-template/
├── src/
│   ├── app/              # Next.js app router
│   │   ├── api/          # API routes
│   │   ├── (auth)/       # Auth pages (if enabled)
│   │   └── dashboard/    # Main app
│   ├── components/       # React components
│   └── lib/             # Utilities
├── convex/              # Database (if enabled)
├── emails/              # Email templates (if enabled)
├── config.ts            # Service configuration
└── setup.js             # CLI setup script

Development

# Start dev server
npm run dev

# Build for production
npm run build

# Run production server
npm start

# Re-run setup to add more services
npm run setup

How the CLI Works

The setup.js script:

  1. Prompts for which services to enable
  2. Installs only the packages you need
  3. Creates service-specific files:
    • Auth: Sign-in/up pages
    • Database: Convex configuration
    • Billing: Webhook endpoints
    • AI: Chat API routes
    • Email: Templates and send endpoint
  4. Generates .env.local with the right variables
  5. Provides links to get your API keys

Manual Service Addition

If you prefer manual setup over the CLI:

Clerk

npm install @clerk/nextjs
# Add middleware, providers, and auth pages

Convex

npm install convex convex-react-clerk
npx convex dev

Autumn

# No SDK needed, uses REST API
# Create webhook endpoint at /api/autumn/webhook

AI

npm install ai @ai-sdk/openai @ai-sdk/anthropic
# Create chat endpoint at /api/chat

Email

npm install resend @react-email/components
# Create templates in /emails

Deployment

Deploy to Vercel with one click:

Deploy with Vercel

Remember to add your environment variables in the Vercel dashboard.

License

MIT