Build a personal website from 0
How to Build a Personal Website with Next.js and Vercel in 2026: Setup, Cost, and Astro + Cloudflare Compared
Build a personal site with create-next-app, an MDX blog and Vercel, connect a domain and sitemap, then compare cost and fit against Astro + Cloudflare.
Kelvin Wang · · 18 min read
Key points
- Vercel Hobby is free but for personal, non-commercial use only; ads, taking payments or building sites for clients need Pro (US$20 a month).
- If Cloudflare runs your DNS, set the records that point at Vercel to DNS only (grey cloud); proxying them with SSL set to Flexible gives you a redirect loop.
- The App Router has no built-in i18n routing, and a static export can't use redirects or Proxy, so decide early where language redirects live on a bilingual static site.
- For a content site that should cost nothing and run in two languages, Astro + Cloudflare is the smoother fit; for a React app with sign-in and a dashboard, Next.js + Vercel is.
My previous site ran on Next.js, upgraded from 13 to 14 in 2023 and deployed on Cloudflare Pages (the upgrade story is in Next.js on Cloudflare in 2026); my current site is Astro on Cloudflare Workers, and I have never used Vercel in production.
This guide comes from the Next.js and Vercel documentation, with every number and setting rechecked on 16 November 2026; the create-next-app defaults were confirmed the same day by running it in an empty folder. At the time of writing, the latest stable Next.js is 16.4.6, released on 9 November 202622.
- Vercel Hobby per month, personal and non-commercial use only
- US$0
- Vercel Hobby Plan
- Vercel Pro per month, including US$20 of usage credit
- US$20
- Vercel Pro Plan
- Minimum Node.js version for Next.js
- 20.9
- Next.js Installation
What do you need before you start?
- Node.js 20.9 or later. That is Next.js 16’s minimum1. Check with
node -vin a terminal and install the current LTS from nodejs.org if yours is older. - Git and a GitHub account. Vercel builds from your GitHub repository.
- A Vercel account. Signing up with GitHub saves a second authorization step when you import the repository.
- A domain (optional). You can go live on the
vercel.appaddress Vercel gives you and add a domain later.
Step 1: create the project with create-next-app
npx create-next-app@latest my-site
cd my-site
npm run dev
It first asks whether to use the recommended defaults; answer Yes. The defaults are TypeScript, ESLint, Tailwind CSS, the App Router and Cache Components, plus an AGENTS.md file1. Add --yes to skip every question. Open http://localhost:3000; if you see the starter page, it worked.
A project created with 16.4.6 on the defaults on 16 November 2026 had Next.js 16.4.6 and React 19.3.0 in package.json, and next.config.ts already set cacheComponents: true and partialPrefetching: true. Plenty of tutorials from 2024 and earlier still teach the Pages Router, getStaticProps, or middleware.ts (renamed proxy.ts in 16), and their code won’t match what you have.
App Router or Pages Router?
Use the App Router for a new project. It is what create-next-app sets up, and the official docs and newer features (metadata, sitemaps, the i18n example) are written for it. You only need the Pages Router to keep an older project going.
Step 2: add an MDX blog
The official approach is @next/mdx, with each post as an .mdx file in the repository3:
npm install @next/mdx @mdx-js/loader @mdx-js/react @types/mdx
Wrap the next.config.ts that create-next-app generated in withMDX, keeping its existing settings:
import type { NextConfig } from 'next'
import createMDX from '@next/mdx'
const nextConfig: NextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
// keep the settings create-next-app generated here
}
const withMDX = createMDX({})
export default withMDX(nextConfig)
The project root (next to app) must have an mdx-components.tsx; without it, MDX does not work with the App Router3:
import type { MDXComponents } from 'mdx/types'
const components: MDXComponents = {}
export function useMDXComponents(): MDXComponents {
return components
}
A dynamic route loads the matching .mdx file, and generateStaticParams lists every post so the pages are built as static files:
// app/blog/[slug]/page.tsx
import { notFound } from 'next/navigation'
export const ensureStatic = 'navigation'
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
try {
const { default: Post } = await import(`@/content/${slug}.mdx`)
return <Post />
} catch {
notFound()
}
}
export function generateStaticParams() {
return [{ slug: 'hello-world' }]
}
With Cache Components on by default, dynamicParams = false from older tutorials fails the build; use notFound() for unknown slugs23. The example on Next.js’s own MDX page still has that line and fails the same way.
Keep the ensureStatic = 'navigation' line too (available from 16.4). Without it, the first request for a URL not listed in generateStaticParams gets the page shell first, which fixes the status at 200, and notFound() can only add a noindex tag31. The noindex keeps the page out of search results, but some crawlers label a 200 that shows a missing page as a soft 404, and analytics or monitoring tools reading the status code see a working page31. With ensureStatic, Next.js waits until the whole page is generated before responding30, so an unknown slug gets a 404 on the first request. The trade-off is that the page can’t read cookies, headers or uncached data, or the build fails30; a plain post page doesn’t need them. The code above was built with 16.4.6 on 16 November 2026, and the status codes with and without that line were checked with next start.
Then create content/hello-world.mdx in the project root, write a few lines of Markdown, run npm run dev and open localhost:3000/blog/hello-world. The @/ prefix is the path alias create-next-app sets up by default, pointing at the project root. Each time you add a post, add its slug to the generateStaticParams list so it is built ahead of time.
With this code, npm run dev prints a notice in the terminal about params being read outside <Suspense>. It is a development-only performance hint and doesn’t fail the build32, so you can leave it for now. Also, post headings looking the same size as body text is expected: Tailwind strips the default styles from h1, h2 and the rest, and the docs suggest installing @tailwindcss/typography and adding the prose class around the post3.
The two things that trip people up most when building the blog:
@next/mdxignores frontmatter by default. The title and date between---lines at the top of a post do not become data. The docs suggestexport const metadata = …inside the MDX file, or a package such as remark-frontmatter or gray-matter3.- Under Turbopack, remark and rehype plugins are named as strings, such as
'remark-gfm', and their options must be serializable3. Turbopack is the default bundler from Next.js 16, and the older pattern of importingremarkGfmand passing it in an array hands it a JavaScript function; the docs say functions can’t be passed to Turbopack, which is written in Rust, so that pattern can’t be used yet3.
Step 3: push to GitHub and import into Vercel
Create an empty repository on GitHub and push the project:
git add -A
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/<your-account>/my-site.git
git push -u origin main
In Vercel, choose Add New → Project, pick the repository and import it. Vercel detects Next.js, so the build command and output folder need no changes; press Deploy and you get a project-name.vercel.app address. From then on, every push builds and deploys on its own4.
If the repository is missing from the import screen, Vercel’s docs list the causes in this order4:
- The wrong account is selected at the top left. The list shows one GitHub account or organization at a time.
- Vercel’s GitHub App can’t see the repository. If you chose Only select repositories when installing it, new repositories stay hidden; add it through Adjust GitHub App Permissions.
- An organization owns the repository and hasn’t installed the app. If you aren’t an Owner, GitHub sends your install request to the Owners for approval.
- Your role on the repository isn’t enough. On a personal account’s repository only the Owner can import it, not a collaborator; on an organization’s repository you need to be an organization Owner or a Member with write access or higher, and Outside Collaborators can’t.
How do environment variables and preview deployments work?
Environment variables
Project → Settings → Environment Variables. Each variable can apply to three environments5:
- Production: used when you push to the production branch, usually
main. - Preview: used for pushes to other branches and pull requests.
- Development: for local work;
vercel env pulldownloads them into.env.local.
Anything prefixed NEXT_PUBLIC_ ends up in the browser where anyone can read it, so never give an API key that prefix. For a change that has no effect, a preview reading the wrong values, or a NEXT_PUBLIC_ variable that is undefined in the browser, the deploy-failure post lists what to check, in order.
Preview deployments
Every push to a branch other than main, or to a pull request, gets its own preview URL, and Vercel comments the link on the pull request4. You see the change on a real address before merging, and a broken preview never touches production. Hobby includes Vercel Authentication, which can lock previews to signed-in users13.
Step 4: connect your own domain
Project → Settings → Domains → Add Existing, then type the domain. Next, add records wherever your DNS lives6:
- The apex domain (
example.com) uses an A record. - Subdomains (
www.example.com,blog.example.com) use a CNAME. Every project has its own CNAME value, such asd1d4fc829fe7bc7c.vercel-dns-017.com.
Always copy the values Vercel shows you. Vercel’s troubleshooting table says to “use the values shown for your project rather than copying another project’s records”6. The fixed IP and CNAME in older tutorials may not be what your project needs today. When you add an apex domain, Vercel suggests adding www too and redirecting one to the other.
Domain bought elsewhere, or DNS on Cloudflare
It doesn’t matter where you bought the domain; add the records wherever its DNS is managed. Two ways to do it:
- Keep DNS where it is and add only the A or CNAME record. Everything else, such as the MX records for email, stays untouched6.
- Switch the nameservers to Vercel. Copy every existing record across first, including MX and verification TXT records, or your email stops arriving6.
If Cloudflare runs your DNS, one more thing:
Once the records resolve and Vercel verifies the domain, it handles the HTTPS certificate for you; the configuration and certificate status both show on the project’s Domains page6. DNS changes take a while to propagate, so an “invalid” status right after adding a record doesn’t necessarily mean it’s wrong.
Go deeper Buy a Domain and Set Up DNS with Cloudflare, Plus Free Email Forwarding (2026) Choosing a registrar, switching nameservers and email on your own domain.Step 5: sitemap, metadata and Search Console
Next.js doesn’t generate a sitemap on its own; add a sitemap.ts in app/8:
// app/sitemap.ts
import type { MetadataRoute } from 'next'
export default function sitemap(): MetadataRoute.Sitemap {
return [
{ url: 'https://example.com', lastModified: '2026-11-16' },
{ url: 'https://example.com/blog/hello-world', lastModified: '2026-11-16' },
]
}
After deploying, open /sitemap.xml to check it. Set lastModified to the date the post last changed; with new Date(), every build marks every URL as just updated. Once you have more posts, build the list from your content/ folder. On a bilingual site, add alternates.languages to each entry and the sitemap carries hreflang links8. The same file conventions include robots.ts and opengraph-image.tsx, and each page’s title and description come from metadata or generateMetadata.
Search Console has nothing to do with the framework: add a domain property, verify it with a DNS TXT record, and submit https://your-domain/sitemap.xml.
Where do beginners get stuck?
| Where it breaks | Why | Fix |
|---|---|---|
create-next-app or npm run dev errors straight away | Node.js is too old; Next.js 16 needs 20.9 or later [1] | Check node -v and install the current LTS |
| Code from a tutorial doesn't run | It was written for the Pages Router or an older version; since 15 params is a Promise, and 16 removed synchronous access [27]; middleware.ts is also renamed to proxy.ts | Check which version the tutorial targets; follow the App Router docs |
| The repository isn't on Vercel's import screen | Wrong account selected, the GitHub App can't see it, or your role on the repository isn't enough [4] | Switch accounts; Adjust GitHub App Permissions; or ask an Owner to change your access |
| Works locally, preview is broken | Often environment variables set for Production only [5] | Tick Preview as well and redeploy; for other causes, follow the order in the deploy-failure post |
| The domain redirects forever | Cloudflare proxy on with SSL set to Flexible [7] | Switch to DNS only, or set SSL to Full (strict) |
| The domain shows an invalid configuration | Records copied from elsewhere, or conflicting records on the same name [6] | Use the values on the project's Domains page |
| Email stops after a nameserver change | MX records weren't moved [6] | Restore your email provider's records |
| No obvious way to route languages | The App Router has no built-in i18n routing [9] | An app/[lang]/ folder plus proxy.ts, or a package such as next-intl |
After output: 'export', redirects, Proxy and image optimization stop working | A static export doesn't support them [10] | Move redirects to the host's settings; use a custom image loader |
| Signed-in pages are slow from Taiwan | Vercel Functions run in iad1 (Washington, D.C.) by default [11] | Move the function region to Hong Kong (hkg1) or Tokyo (hnd1), next to your database |
On a bilingual static site, the obvious move is a proxy.ts that sends / to /zh-hant/ based on the browser’s language, but Proxy needs a server, so it’s off the table with a static export, and so are redirects in next.config10. On Vercel without a static export, Proxy works as usual; if you export statically to another host, the language redirect has to live in that host’s redirect settings. Astro generates a route per language once you list the locales under i18n in astro.config, but redirecting by browser language still needs a server: Astro.preferredLocale, which reads the visitor’s preferred language, only works on pages rendered on demand21. My site is bilingual, and that redirect runs in the Worker entry point, so every page request goes through the Worker.
What should you watch for when an AI tool writes your Next.js code?
Tools that edit your repository locally, such as Claude Code, Cursor and Codex, and tools that generate a site from a chat in the browser, such as v0, can all build a Next.js site and deploy it to Vercel. These points apply whichever one you use:
- The AI may have learned an older Next.js. Every major version has breaking changes. Since 16.2,
create-next-appadds anAGENTS.mdthat tells the agent to read the docs bundled innode_modules/next/dist/docs/, which match your installed version; the Next.js blog says it plainly: “Your training data is outdated — the docs are the source of truth”2. Keep that file. - Each tool reads a different instructions file. Cursor and Codex read
AGENTS.mddirectly28; Claude Code readsCLAUDE.md, and the Next.js blog suggests aCLAUDE.mdcontaining the line@AGENTS.mdto pull it in2.create-next-appcreates onlyAGENTS.md. - Agents often start a second dev server. Since 16.2, a second
next devfails with the PID and URL of the one already running2, which gives the agent what it needs to sort it out. - Let the AI read the deployment logs. Vercel’s official MCP server at
https://mcp.vercel.comworks on every plan and can search the docs, manage projects and deployments, and read deployment logs12. When a deploy fails, the agent reads the error itself instead of you pasting it in. - v0 is Vercel’s own chat-to-app tool, with direct deploys to Vercel and GitHub sync. Its pricing next to Lovable and Bolt is in the website-builder comparison.
Whichever you use, read the diff and open the preview URL yourself before merging into main.
How much does Next.js on Vercel cost?
For a personal site, the plans that matter are Hobby and Pro:
- Hobby, US$0. Each month includes 100 GB of data transfer, 1,000,000 CDN requests, 1,000,000 function invocations and 5,000 image transformations13. Going over doesn’t cost money, but in most cases you wait 30 days before you can use the feature again13; a paused deployment shows visitors
503 DEPLOYMENT_PAUSEDand does not resume on its own17. - Pro, US$20 a month. It includes US$20 of usage credit (unused credit expires at month end) and the lowest Flat Rate CDN tier (on by default for new Pro teams29): 1,000,000 CDN requests and 1 TB of data transfer a month14. Vercel says occasional one-day spikes don’t change the bill; only if total usage for a billing cycle exceeds the tier’s capacity does the next cycle move up a tier15.
Hobby is for personal or non-commercial use only; that’s in the terms of service16. Running ads, taking payment from visitors, or being paid to build or host the site all count as commercial, and where the line is unclear Vercel advises asking support before you deploy17.
Go deeper Can You Use Vercel's Free Hobby Plan Commercially? 2026 Limits and What Happens When You Hit Them What counts as commercial, the monthly allowances, and how to recover after a pause.Over a year: Hobby is US$0 and Pro is US$240. Domains and databases are extra, and how each host bills a traffic spike is worked through in the cost post.
Go deeper How Much Does a Personal Website Cost in 2026? A US$250 Example Budget, Line by Line Vercel Hobby and Pro, Flat Rate CDN, and the bill when 500,000 people show up in one day.How do Next.js + Vercel and Astro + Cloudflare differ?
Both can run a personal site. They differ in the shape of the bill, how close they sit to Taiwan, and how smoothly multilingual and fully static sites work.
Vercel Pro is US$20 a month and Workers Paid a US$5 monthly minimum; a typical personal site stays within what each includes.
Source: vercel.com, cloudflare.com
| Aspect | Next.js + Vercel | Astro + Cloudflare Workers |
|---|---|---|
| Commercial use on the free plan | Hobby is personal and non-commercial only [16] | Not limited to non-commercial use in writing the way Hobby is; this post didn't check the terms clause by clause, so read them yourself |
| Cost at normal traffic | Hobby US$0; Pro US$20 a month [14] | Static asset requests free and unlimited; Free plan 100,000 Worker requests a day; Paid from US$5 a month [18] |
| A day of viral traffic | Hobby may be paused entirely past its limits; Pro with Flat Rate CDN doesn't bill a one-day spike [13][15] | Static pages skip the Worker; no data transfer charges [18]; pages that go through a Worker (say, one doing language redirects) get 100,000 requests a day on Free, failing beyond that, and are billed by usage on Paid [24][18] |
| Distance to Taiwan | Compute regions near Taiwan include Hong Kong (hkg1), Osaka (kix1) and Tokyo (hnd1); Functions default to iad1 in the US [11] | Data centers in Taipei and Kaohsiung [19]; Workers run in the nearest one |
| Lock-in | The framework travels: 16.2 added a public Adapter API [20]; the ties are platform services such as Blob and Analytics | Astro can output plain static files; KV and D1 tie you in |
| Next.js support | Native; new features work on day one | Next.js said in March 2026 that Cloudflare's and Netlify's adapters were in development [20]; on Cloudflare today it's vinext (beta) or OpenNext [25] (see Next.js on Cloudflare) |
| Multilingual | No built-in i18n routing in the App Router; use app/[lang]/ plus proxy.ts, or a package [9] | Built-in i18n routing in astro.config; redirecting by browser language still needs a server, such as a Worker [21] |
| Fully static output | output: 'export' works, but without redirects, Proxy, ISR, default image optimization or Server Actions [10] | Pages are generated as static files at build time by default |
| Developer experience | A preview URL on every push and a PR comment; React component libraries drop straight in [4] | Workers Builds comments the build status on the PR, with a preview URL when the Worker has Previews enabled [26]; interactive parts are marked as islands |
All Vercel and Cloudflare figures from official docs checked on 2026-11-16. Cloudflare's "no data transfer charges" covers Workers itself, not Containers.
This post didn’t measure real latency from Taiwan. My guess is the gap is small for static pages: both serve them from a CDN, and Vercel’s PoPs pass requests to the nearest Vercel region, which handles TLS11. For signed-in or dashboard pages on Vercel, remember to move the function region to Asia, or every request makes a round trip to the US.
Go deeper Next.js on Cloudflare in 2026: What to Do Now That next-on-pages Is Deprecated Next.js on Cloudflare after next-on-pages: vinext or OpenNext.When does Next.js + Vercel fit, and when does Astro + Cloudflare?
Neither is an upgrade of the other; it depends on what the site is.
Next.js + Vercel tends to fit when:
- The site is really an app. Sign-in, member pages, a dashboard, lots of interactive components, and you want React’s component libraries.
- You or your team already know React, or you prototyped in v0 and want to keep going.
- You want zero-config preview URLs and PR comments, and the site has a commercial side that needs Pro anyway.
Astro + Cloudflare tends to fit when:
- The site is mostly content. Posts, a portfolio, a personal brand page, with no sign-in or only a small part that needs a server.
- You want hosting to stay at US$0 while running ads or referral links. Cloudflare’s free plan isn’t limited to non-commercial use in writing the way Hobby is (check the terms yourself).
- The site is bilingual and mostly static, and you want the framework’s built-in i18n to generate the language routes, with a Worker handling the small browser-language redirect.
FAQ
Does Next.js have to run on Vercel?
No. The Next.js blog notes that many Next.js apps run as a single Node.js server with next start20; with output: 'export', the static files go on any static host10. Running every feature on Cloudflare or Netlify depends on their adapters20.
I already have an Astro site. Should I switch to Next.js?
If the site is still mostly content, switching frameworks costs more than it gains. If what you want to add is app-like, such as sign-in or a dashboard, you can use server-side features for just that part rather than rebuilding the whole site.
Sources
- 1. Installation
- 2. Next.js 16.2: AI Improvements
- 3. How to use markdown and MDX in Next.js
- 4. Deploying GitHub Projects with Vercel
- 5. Environment variables
- 6. Adding & Configuring a Custom Domain
- 7. Using Cloudflare and other reverse proxies with Vercel
- 8. sitemap.xml
- 9. Internationalization
- 10. How to create a static export of your Next.js application
- 11. Global network and regions
- 12. Vercel MCP
- 13. Vercel Hobby Plan
- 14. Vercel Pro Plan
- 15. Flat Rate CDN
- 16. Terms of Service (section 4, Hobby Plan)
- 17. Why has my account or deployment been paused?
- 18. Workers pricing
- 19. Cloudflare global network
- 20. Next.js Across Platforms: Adapters, OpenNext, and Our Commitments
- 21. Internationalization (i18n) Routing
- 22. next
- 23. Migrating to Cache Components
- 24. Workers limits
- 25. Next.js on Cloudflare Workers
- 26. Workers Builds GitHub integration
- 27. How to upgrade to version 16
- 28. AGENTS.md
- 29. Flat Rate CDN is now GA for Pro teams
- 30. ensureStatic
- 31. loading.js (Status codes)
- 32. Adopting Partial Prefetching
Kelvin Wang
Electrical engineer building tools with AI agents, sharing hands-on notes on engineering and investing.
More about me