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

nextjs-cms-kit

v0.5.33

Published

A CLI toolkit for managing and maintaining your NextJS CMS application. Provides commands for database setup, schema generation, admin management, and section updates.

Readme

nextjs-cms-kit

A CLI toolkit for managing and maintaining your NextJS CMS application. Provides commands for database setup, schema generation, admin management, and section updates.

Installation

Install globally or use via npx:

# Global installation
npm install -g nextjs-cms-kit
# or
pnpm add -g nextjs-cms-kit
# or
yarn global add nextjs-cms-kit
# or
bun add -g nextjs-cms-kit

# Or use via npx (no installation needed)
npx nextjs-cms-kit <command>

Usage

nextjs-cms-kit [command] [options]

Global Options

  • -d, --dev - Use development environment file (.env.development instead of .env)

Commands

setup

Complete nextjs-cms setup wizard. This is the recommended way to set up a new CMS project.

nextjs-cms-kit setup
nextjs-cms-kit setup --dev  # Use development environment

What it does:

  1. Configures database connection
  2. Generates database schema using Drizzle Kit
  3. Sets up master admin account
  4. Updates database tables based on sections

Use this when:

  • Setting up a new CMS project
  • First-time installation
  • After cloning a project

db-config

Initialize or update nextjs-cms database configuration.

nextjs-cms-kit db-config
nextjs-cms-kit db-config --dev

What it does:

  • Prompts for database connection details
  • Creates or updates .env file with database configuration
  • Validates database connection

Use this when:

  • Setting up database connection for the first time
  • Changing database credentials
  • Moving to a different database server

set-master-admin

Set or update the master admin password.

nextjs-cms-kit set-master-admin
nextjs-cms-kit set-master-admin --dev

What it does:

  • Prompts for new master admin password
  • Updates the master admin user in the database
  • Ensures master admin has proper privileges

Use this when:

  • First-time admin setup
  • Resetting forgotten admin password
  • Changing admin password

fix-master-admin

Fix master admin privileges for all sections.

nextjs-cms-kit fix-master-admin
nextjs-cms-kit fix-master-admin --dev

What it does:

  • Ensures master admin has full access to all sections
  • Updates section permissions in the database
  • Fixes any permission inconsistencies

Use this when:

  • Master admin lost access to sections
  • After restoring from backup
  • After section structure changes

update-sections

Update database tables based on current section definitions and fix master admin privileges.

nextjs-cms-kit update-sections
nextjs-cms-kit update-sections --dev

What it does:

  1. Scans your sections folder
  2. Generates/updates database schema to match section definitions
  3. Adds new fields and tables as needed
  4. Updates master admin privileges

Use this when:

  • After adding new sections
  • After modifying section fields
  • After pulling changes that include section updates
  • When database schema is out of sync with sections

Environment Files

The toolkit supports different environment files:

  • Production (default): Uses .env file
  • Development: Use --dev flag to use .env.development file

Example:

# Uses .env
nextjs-cms-kit setup

# Uses .env.development
nextjs-cms-kit setup --dev

Prerequisites

Before using the toolkit, ensure you have:

  1. Database configured - MySQL/MariaDB database server running
  2. Environment file - .env or .env.development with database connection details
  3. Sections folder - Your CMS sections defined in the configured sections folder
  4. Drizzle config - drizzle.config.ts file in your project root

Common Workflows

Initial Setup

# 1. Configure database
nextjs-cms-kit db-config

# 2. Complete setup
nextjs-cms-kit setup

# 3. Set master admin password
nextjs-cms-kit set-master-admin

After Adding New Sections

# Update database to match new sections
nextjs-cms-kit update-sections

After Pulling Changes

# Update database schema and permissions
nextjs-cms-kit update-sections

Resetting Admin Access

# Fix admin privileges
nextjs-cms-kit fix-master-admin

# Or reset password
nextjs-cms-kit set-master-admin

Configuration

The toolkit reads configuration from:

  • CMS Config: cms.config.ts in your project root
  • Environment: .env or .env.development files
  • Drizzle Config: drizzle.config.ts for database migrations

Make sure these files are properly configured before running commands.

Troubleshooting

Database Connection Errors

If you see database connection errors:

  1. Verify database server is running
  2. Check .env file has correct credentials
  3. Run nextjs-cms-kit db-config to reconfigure

Schema Generation Fails

If schema generation fails:

  1. Check drizzle.config.ts is properly configured
  2. Ensure database connection is working
  3. Verify sections are valid (no syntax errors)

Permission Errors

If you encounter permission errors:

  1. Run nextjs-cms-kit fix-master-admin to restore permissions
  2. Verify master admin user exists in database
  3. Check section definitions are valid

License

MIT License - see LICENSE file for details.