How to create a Next.js blog with Graphite's stacking workflow

Greg Foster
Greg Foster
Graphite software engineer

In this tutorial, you will learn how to create and deploy a personal blog using Next.js and manage your codebase effectively with Graphite's CLI and stacked changes workflow. This approach will help maintain a clean and organized code structure, making your development process more efficient.

Before you begin, make sure to have:

  • Graphite CLI installed: Use brew install withgraphite/tap/graphite on macOS/Linux or npm install -g @withgraphite/graphite-cli@stable for npm installations.

  • Your CLI authenticated with GitHub: This enables Graphite to interact with your GitHub repositories for pull request management​​.

  • An understanding of Graphite's stacks: These are sequences of dependent branches for incremental development​.

  • gt initialized in your repository where the blog will be hosted​.

Begin by setting up your Next.js project environment:

bashCopy code
npx create-next-app@latest my-blog
cd my-blog

This command creates a new directory named my-blog, which is the starting point for your blogging platform.

Install the Graphite CLI and authenticate it with your GitHub account:

brew install withgraphite/tap/graphite
gt auth

Authenticating with GitHub allows Graphite to create and update pull requests on your behalf.

Create the base branch for your blog using Graphite:

gt trunk
gt add -A
gt create -m "Initialize personal blog project"

This sets up the main branch from which all future features and posts will branch off.

Develop your blog by adding new features and content, each on a separate branch:

gt add -A
gt create -m "Add blog post feature"

Keep your branches focused on single features or posts to maintain an organized codebase.

Collaborate with others and submit your branches for review:

gt stack submit

This allows for efficient code reviews and collaboration through GitHub pull requests.

Once your branches have been reviewed and are ready to go live, merge them into the main branch:

gt stack merge

Graphite manages branch dependencies and ensures a smooth integration process.

Deploy your blog to make it accessible online. If you're using Vercel, simply link your GitHub repository and deploy:


Your personal blog is now live and can be accessed by users worldwide.

By following this guide, you've set up a Next.js personal blog with an optimized code management system using Graphite's CLI and stacked changes workflow. This method ensures a well-organized codebase, facilitating easier maintenance and scaling of your blogging platform.

Give your PR workflow
an upgrade today

Stack easier | Ship smaller | Review quicker

Or install our CLI.
Product Screenshot 1
Product Screenshot 2