DEV Community

Rafał Goławski
Rafał Goławski

Posted on

Next.js starter recipe 👨‍🍳

Introduction

If you're like me, and you tend to start many new Next.js projects the same way, you might consider creating your own template. It's easier than you think, so let's keep it short and get straight to the action!

How-to

At first, let's generate a Next.js project as you usually would.

yarn create next-app
# or
npx create-next-app
Enter fullscreen mode Exit fullscreen mode

You will be asked for a name for your new project. Of course, you can choose any name you like, but in general, the naming pattern for starters looks like this - next-[name]-starter.

Once your project is generated, you can make any changes as you like. Also, it's a good practise to let your potential users know how to quickly create a project with your starter, for this you can use README.md file.

To start working with your new template, at first you have to upload it to the GitHub repository. Let's navigate to the https://github.com/new and create a new repo, then follow the steps or this tutorial on how to upload your local repo to GitHub.

At the moment your template has been uploaded to the GitHub repo you're ready to use it, simply run one of the following commands and enjoy! 🎉

yarn create next-app [project-name] -e [link-to-repo]
# or
npx create-next-app [project-name] -e [link-to-repo]
Enter fullscreen mode Exit fullscreen mode

Share the templates that you've created in the comment section below, or just let me know what you think.

Thanks for reading! 👋

Discussion (0)