npm package: @kpverse/deploy-nextjs
Description: Next JS Deployment Automation Tool from KPVERSE.
Author: Kartavya Patel
Latest version: 0.1.2

[![](https://cdn.jsdelivr.net/gh/kpverse/deploy-nextjs/kpverse-deploy-nextjs.jpg)](https://kpverse.in/deploy-nextjs/ "Next JS Deployment Automation Tool from KPVERSE")

<h1 align="center"><a href="https://kpverse.in/deploy-nextjs">@kpverse/deploy-nextjs</a><br/>An invaluable tool that simplifies the deployment process of static sites generated by Next JS</h1>

## What is this for?

[@kpverse/deploy-nextjs](https://kpverse.in/deploy-nextjs) is an npm package to simplify the process of deploying Next JS project on GitHub Pages.

## How can this benefit developers?

1.  No need to make Next JS project repository public. Only the deployment repository will b public.
1.  No need to create an account on Vercel or Netlify to host Next JS.
1.  You can use free and open-source CDNs for content delivery. (For more information read [recommended Next JS configuration](#recommended-next-js-configuration).)

## Is this suitable for beginners?

Yes, it is beginner-friendly and streamlines the deployment process for developers of all skill levels.

## Prerequisites

To use [@kpverse/deploy-nextjs](https://kpverse.in/deploy-nextjs), your deployment repository must be hosted on GitHub, and GitHub Pages must be enabled.

## Installation

You can install this package using pnpm or npm or yarn:

```sh
npm i @kpverse/deploy-nextjs -D

# or

pnpm i @kpverse/deploy-nextjs -D

# or

yarn add @kpverse/deploy-nextjs --dev
```

## Quick Start Guide

After installation, simply run the following command to get started:

```bash
npx deploy-nextjs
```

## Configuration Options for [@kpverse/deploy-nextjs](https://kpverse.in/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

```js
// 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;
```

## Support and Issue Reporting

If you need assistance or want to report any issues, please visit [issues tab](https://github.com/kpverse/deploy-nextjs/issues) of our GitHub repository.

## Contributing

This package is open-source, and we welcome contributions from the community. You can contribute to it on [GitHub](https://github.com/kpverse/deploy-nextjs).

## Commercial Use

[@kpverse/deploy-nextjs](https://kpverse.in/deploy-nextjs) is licensed under [the MIT License](./LICENSE). Refer to the [license](./LICENSE) for usage and permissions.

## Additional Resources

Read [Medium blog](https://medium.com/@kpverse/783b31924fc6) about this package.

Also check out [YouTube video](https://youtu.be/_PQtajOaq_Y) explaining this package.

[![](https://cdn.jsdelivr.net/gh/kpverse/deploy-nextjs/yt-thumbnail.png)](https://youtu.be/_PQtajOaq_Y)

<div align="center"><a href="https://kpverse.in/"><img src="https://cdn.jsdelivr.net/gh/kpverse/deploy-nextjs/copyright.svg"/></a></div>