Next.js Notion Starter Kit으로 Vercel 배포까지
Next.js Notion Starter Kit으로 Vercel 배포까지

Next.js Notion Starter Kit으로 Vercel 배포까지

Tags
Web Dev
OSS
Node.js
React.js
Projects
Published
March 15, 2025
Author
신동호

왜 Vercel, Notion?

1. 편리한 배포 Vercel

무료 plan이 있고 Github에서 쉽게 선택하여 바로 배포할 수 있기 때문이였다.

2. Notion은 왜?

회사에서 노션을 계속 쓰다보니 많이 익숙해져서 다른 플랫폼에서의 글 쓰기 자체가 장벽 및 귀찮음으로 다가왔다. ⇒ 그럼 그냥 노션을 블로그로 삼으면 좀 더 낫지 않을까? 라는 생각에서 출발했다.
 

(중요) 뉴비용 스타터 Kit이 있다.


 

필요한 것들

내 기준으로 정리해보겠다. 최대한 덜 귀찮은 방법으로…
  • Git
 

1. Vercel 배포를 위한 Starter kit clone하기

Vercel 배포는 Github 프로젝트에서 쉽게 고를 수 있기 때문에 fork를 떠도 되지만
내 경우에는 Git command로 local에 Clone해뒀다.
원하는 폴더에서 아래 명령어를 입력한다.
git clone https://github.com/transitive-bullshit/nextjs-notion-starter-kit.git .
notion image
그럼 일단 clone은 완료되었다.
pnpm이 정상적으로 설치되었다면 그대로 pnpm i 해준다
package.json에 scripts로 vercel deploy 명령어가 있는데 기본으로 vercel을 설치해주진 않기 때문에
이도 설치해줘야한다. pnpm i -D vercel
 
일단 이쯤 되면 한번 pnpm dev 를 입력해서 잘 동작하는지 한번 보자
notion image
기본 샘플로 실행된다. 이 부분을 본인의 Notion 페이지로 바꿔보자
필자의 경우 Github과 링크드인이면 충분하고 우측 상단의 Github 표시도 없애보자
 
우선은 제일 쉬운 우측 상단 Github 표시부터 없애보자
Chrome에서 F12를 눌러 개발자 툴을 열어준다.
notion image
잘 보면 지금 하이라이트 들어온 부분을 누르고 파란 깃헙 부분을 클릭한다.
notion image
잘 보면 notion-app과 같은 계층에 해당 a href가 있음을 알 수 있다.
next.js 앱 하위니까 notion-app 컴포넌트만 찾으면 비슷한 depth에 이 녀석이 있을 것이다.
next.js는 pages 폴더 기준으로 라우팅해주는 기능이 있기 때문에 가장 기본이 되는 pages/index.tsx로 가보자
notion image
NotionPage가 Notion-app일거 같은데 이대로 참조를 찾아보자
notion image
NotionRenderer가 보이고 밑에 GitHubShareButton 컴포넌트가 보인다.
notion image
우리가 찾던 컴포넌트인 것 같다. 아까 위의 초기 스크린샷의 컴포넌트처럼 보인다. 이제 이 컴포넌트를 아까 NotionPage에서 지워보자
notion image
깔끔하게 지워졌다.
이제 기본 사이트가 아닌 본인의 노션으로 연결하려면 site.config.ts 를 수정해야한다. 한번 수정해보자 기본세팅을 보면 저렇게 되어있는데 주석을 보면서 돌아갈 수 있게끔 최소한으로 다듬어보자
import { siteConfig } from './lib/site-config' export default siteConfig({ // the site's root Notion page (required) rootNotionPageId: '7875426197cf461698809def95960ebf', // if you want to restrict pages to a single notion workspace (optional) // (this should be a Notion ID; see the docs for how to extract this) rootNotionSpaceId: null, // basic site info (required) name: 'Next.js Notion Starter Kit', domain: 'nextjs-notion-starter-kit.transitivebullsh.it', author: 'Travis Fischer', // open graph metadata (optional) description: 'Example Next.js Notion Starter Kit Site', // social usernames (optional) twitter: 'transitive_bs', github: 'transitive-bullshit', linkedin: 'fisch2', // mastodon: '#', // optional mastodon profile URL, provides link verification // newsletter: '#', // optional newsletter URL // youtube: '#', // optional youtube channel name or `channel/UCGbXXXXXXXXXXXXXXXXXXXXXX` // default notion icon and cover images for site-wide consistency (optional) // page-specific values will override these site-wide defaults defaultPageIcon: null, defaultPageCover: null, defaultPageCoverPosition: 0.5, // whether or not to enable support for LQIP preview images (optional) isPreviewImageSupportEnabled: true, // whether or not redis is enabled for caching generated preview images (optional) // NOTE: if you enable redis, you need to set the `REDIS_HOST` and `REDIS_PASSWORD` // environment variables. see the readme for more info isRedisEnabled: false, // map of notion page IDs to URL paths (optional) // any pages defined here will override their default URL paths // example: // // pageUrlOverrides: { // '/foo': '067dd719a912471ea9a3ac10710e7fdf', // '/bar': '0be6efce9daf42688f65c76b89f8eb27' // } pageUrlOverrides: null, // whether to use the default notion navigation style or a custom one with links to // important pages. To use `navigationLinks`, set `navigationStyle` to `custom`. navigationStyle: 'default' // navigationStyle: 'custom', // navigationLinks: [ // { // title: 'About', // pageId: 'f1199d37579b41cbabfc0b5174f4256a' // }, // { // title: 'Contact', // pageId: '6a29ebcb935a4f0689fe661ab5f3b8d1' // } // ] })
한번 고쳐보자
// the site's root Notion page (required) rootNotionPageId: '본인의 노션 페이지 Id', // basic site info (required) name: 'Dongho Log', domain: '본인의 vercel.app 도메인', author: 'Dongho', // open graph metadata (optional) description: 'Dongho의 개인 블로그입니다', // social usernames (optional) <-- 필자 기준 github과 linkedIn을 연결할거니까 필수 github: 'dongho-shin', linkedin: '동호-신-81ab65227',

Social usernames

github은 user name,
linkedIn은 본인 프로필페이지에서 뒷부분이다.
notion image

노션 페이지 Id 갖고오기

본인이 보여주고 싶은 최상단 레벨의 page Id가 필요하다.
해당 페이지로 가서 Publish 해주자
notion image
notion image
마지막 하이픈 부분 지나서 뒤에 id 값이 보인다면 해당 부분을 카피해서 넣어주면 된다.
일단은 노션 페이지Id 만 넣고 다시 확인해보자
notion image
원하던 페이지가 출력된다.
이러면 거의 다 왔다 Vercel 배포만 해주면 된다.
 

Vercel 배포

일단은 Vercel로 가보자 VercelVercelVercel: Build and deploy the best web experiences with the Frontend Cloud
로그인하고 가입한 뒤에
notion image
Add New를 누르고 Project를 추가해보자
notion image
Import Git Repository 부분에서 Add Github Account를 하고 Github에 연결된 repository를
notion image
Import를 클릭해준다. 내 경우에는 처음에 로컬 clone 했던 git(starter kit)의 remote를 내 Private Repository로 변경해주었다.
notion image
별도의 세팅 따로 안하고 바로 Deploy만 심플하게 눌러주면 된다.
notion image
저 도메인 값을 복사해서 아까 site.config.ts 에 있던 domain에 넣어주자
변경사항을 push하면 .github 폴더 밑에 있는 build.yml에 적힌 명령어에 따라 github Action CI가 수행될텐데 이 때 build.yml에 node version test가 18버전과 22버전이 있는데 우린 Node.js 20버전만 깔아뒀다
jobs: test: name: Test Node.js ${{ matrix.node-version }} runs-on: ubuntu-latest strategy: fail-fast: true matrix: node-version: - 20
20버전만 테스트 해보면 충분하다. 수정해준 뒤에 remote 에 푸시를 완료해주자
그 뒤에 이제 콘솔창으로 가서 pnpm run deploy 를 입력해주자
초기에 실행하면 이것저것 물어볼텐데 큰 문제가 없다면 Y를 입력해주면서 죽죽 넘어가주면 된다.
notion image
그럼 Building 하면서 좀 걸리는데 완료되면
notion image
해당 메세지가 보인다. 실제 배포 해야되니 pnpm vercel --prod 를 입력해주자
그러면 이제 원하는 대로 배포를 완료했다.