@kpverse/deploy-nextjs
An invaluable tool that simplifies the deployment process of static sites generated by Next JS
@kpverse/deploy-nextjs is an npm package to simplify the process of deploying Next JS project on GitHub Pages.
- No need to make Next JS project repository public. Only the deployment repository will b public.
- No need to create an account on Vercel or Netlify to host Next JS.
- You can use free and open-source CDNs for content delivery. (For more information read recommended Next JS configuration.)
Yes, it is beginner-friendly and streamlines the deployment process for developers of all skill levels.
To use @kpverse/deploy-nextjs, your deployment repository must be hosted on GitHub, and GitHub Pages must be enabled.
You can install this package using pnpm or npm or yarn:
npm i @kpverse/deploy-nextjs -D
# or
pnpm i @kpverse/deploy-nextjs -D
# or
yarn add @kpverse/deploy-nextjs --dev
After installation, simply run the following command to get started:
npx deploy-nextjs
Configuration Options for @kpverse/deploy-nextjs
The package generates a deploy-nextjs.config.js
file upon first use, allowing you to customize your deployment configurations.
// Recommended Next JS Configuration (next.config.js)
let GITHUB_USERNAME = "<YOUR_GITHUB_USERNAME>",
DEPLOYMENT_REPOSITORY_NAME = "<DEPLOYMENT_REPOSITORY_NAME>",
BASE_PATH = "<BASE_PATH>";
/** @type {import('next').NextConfig} */
const nextConfig = {
// Read official docs from Next JS: https://nextjs.org/docs/app/api-reference/next-config-js/basePath
// NOTE: It is optional.
basePath: `/${BASE_PATH}`,
// Read official docs from Next JS: https://nextjs.org/docs/app/api-reference/next-config-js/assetPrefix
// NOTE: It is optional.
assetPrefix: `https://cdn.jsdelivr.net/gh/${GITHUB_USERNAME}/${DEPLOYMENT_REPOSITORY_NAME}@latest/${BASE_PATH}`,
// Read official docs from Next JS: https://nextjs.org/docs/app/api-reference/next-config-js/output
output: "export",
// Read official docs from Next JS: https://nextjs.org/docs/app/api-reference/next-config-js/trailingSlash
trailingSlash: true,
};
module.exports = nextConfig;
If you need assistance or want to report any issues, please visit issues tab of our GitHub repository.
This package is open-source, and we welcome contributions from the community. You can contribute to it on GitHub.
@kpverse/deploy-nextjs is licensed under the MIT License. Refer to the license for usage and permissions.
Read Medium blog about this package.
Also check out YouTube video explaining this package.