@hacktoolkit/nextjs-htk
v0.3.0
Published
Core components and utilities for nextjs-htk framework
Maintainers
Readme
@hacktoolkit/nextjs-htk
Core components, hooks, and utilities for the nextjs-htk framework.
Installation
npm install @hacktoolkit/nextjs-htk
# or
pnpm add @hacktoolkit/nextjs-htkPeer Dependencies
This package requires:
- next >= 15.0.0
- react >= 19.0.0
- react-dom >= 19.0.0
CLI Tool
The package includes a CLI tool for project standardization and template management.
Quick Start
# Initialize a new project with standard files
npx @hacktoolkit/nextjs-htk init
# Sync templates from latest version
npx @hacktoolkit/nextjs-htk sync
# Show all available commands
npx @hacktoolkit/nextjs-htk helpAvailable Commands
htk init- Initialize new project with Makefile, scripts, and configshtk sync- Update all templates to latest versionhtk sync:makefile- Sync only the Makefilehtk sync:scripts- Sync only the scripts directory
Force Overwrite
By default, existing files won't be overwritten. Use --force or -f:
npx @hacktoolkit/nextjs-htk sync --force
npx @hacktoolkit/nextjs-htk init -fWhat Gets Installed
Makefile - Standard targets for development and deployment:
make dev- Start development servermake build- Build for productionmake deploy- Deploy to GitHub Pagesmake help- Show all available targets
Scripts - Utility scripts for your project:
src/scripts/generate_sitemap.ts- Auto-generate sitemap.xml
Next.js Config Template - React 19 compatible configuration with:
- Webpack alias configuration for single React instance
- Static export settings for GitHub Pages
- Source maps enabled for debugging
Usage
Configuration
Create a htk.config.ts file:
import { defineConfig } from '@hacktoolkit/nextjs-htk'
export default defineConfig({
site: {
name: 'My Site',
title: 'Welcome to My Site',
description: 'A great website',
url: 'https://mysite.com',
author: 'Author Name',
},
navigation: [
{ label: 'Home', href: '/' },
{ label: 'About', href: '/about' },
],
footer: {
copyright: '© 2025 My Site',
},
})Utilities
Sitemap Generator
Generate SEO-friendly sitemaps from your site configuration:
import { generateSitemap } from '@hacktoolkit/nextjs-htk/utils'
import type { SitemapConfig } from '@hacktoolkit/nextjs-htk/utils'
const config: SitemapConfig = {
siteUrl: 'https://example.com',
pages: [
{ name: 'Home', path: '/', showInNav: true },
{ name: 'About', path: '/about/', showInNav: true }
],
additionalPages: [
{
path: '/blog/post-1/',
priority: 0.7,
changefreq: 'weekly'
}
]
}
const sitemap = generateSitemap(config)The generated script (src/scripts/generate_sitemap.ts) automatically uses your htk.config.ts to generate the sitemap during build.
Components
Components will be added in upcoming releases:
- BaseLayout
- Header
- Footer
- SEO
- ContactForm
Hooks
Hooks will be added in upcoming releases:
- useTheme
- useSiteConfig
Development
# Install dependencies
pnpm install
# Build
pnpm build
# Watch mode
pnpm devLicense
MIT
