Explore the live demonstration of the project: nextjs14-notion
Notion is a Notion-like application built with Next.js 14, React, Convex, Tailwind, Clerk, and EdgeStore. It is a real-time database and Notion-style editor that allows you to create, edit, and delete documents. It also allows you to publish your note to the web.
Folder Structure
nextjs14-notion/
βββ app/
β βββ (main)/
β β βββ (routes)/
β β β βββ documents/
β β β βββ page.tsx
β β β βββ [documentId]/
β β β βββ page.tsx
β β βββ _components/
β β β βββ banner.tsx
β β β βββ document-list.tsx
β β β βββ item.tsx
β β β βββ menu.tsx
β β β βββ navbar.tsx
β β β βββ navigation.tsx
β β β βββ publish.tsx
β β β βββ title.tsx
β β β βββ trash-box.tsx
β β β βββ user-item.tsx
β β βββ layout.tsx
β βββ (marketing)/
β β βββ _components/
β β β βββ footer.tsx
β β β βββ heading.tsx
β β β βββ heroes.tsx
β β β βββ logo.tsx
β β β βββ navbar.tsx
β β βββ layout.tsx
β β βββ page.tsx
β βββ (public)/
β β βββ (routes)/
β β β βββ preview/
β β β βββ [documentId]/
β β β βββ page.tsx
β β βββ layout.tsx
β βββ api/
β β βββ edgestore/
β β βββ [...edgestore]/
β β βββ route.ts
β βββ favicon.ico
β βββ globals.css
β βββ error.tsx
β βββ not-found.tsx
β βββ layout.tsx
βββ components/
β βββ modals/
β β βββ confirm-modal.tsx
β β βββ cover-image-modal.tsx
β β βββ settings-modal.tsx
β βββ providers/
β β βββ convex-provider.tsx
β β βββ modal-provider.tsx
β β βββ theme-provider.tsx
β βββ shared/
β β βββ cover.tsx
β β βββ editor.tsx
β β βββ icon-picker.tsx
β β βββ mode-toggle.tsx
β β βββ search-command.tsx
β β βββ single-image-dropzone.tsx
β β βββ spinner.tsx
β β βββ toolbox.tsx
β βββ ui/ (generated by shadcn-ui)
β βββ alert-dialog.tsx
β βββ avatar.tsx
β βββ button.tsx
β βββ command.tsx
β βββ dialog.tsx
β βββ dropdown-menu.tsx
β βββ input.tsx
β βββ label.tsx
β βββ popover.tsx
β βββ skeleton.tsx
βββ convex/
β βββ generated/ (generated by convex)
β βββ auth.config.js
β βββ documents.ts
β βββ schema.ts
β βββ tsconfig.json
βββ hooks/
β βββ use-cover-image.ts
β βββ use-origin.ts
β βββ use-scroll-top.ts
β βββ use-search.ts
β βββ use-settings.ts
βββ lib/
β βββ edgestore.ts
β βββ utils.ts
βββ public/
β βββ next.svg
β βββ vercel.svg
β βββ assets/
β βββ icons/[[...]].png
β βββ images/[[...]].{svg,png}
βββ .eslintrc.json
βββ .gitignore
βββ README.md
βββ components.json
βββ next.config.js
βββ package.json
βββ postcss.config.js
βββ tailwind.config.ts
βββ tsconfig.ts
Table of Contents
Notion is built using the following technologies:
- TypeScript: TypeScript is a typed superset of JavaScript that compiles to plain JavaScript.
- Next.js: Next.js is a React framework for building server-side rendered and statically generated web applications.
- Tailwind CSS: Tailwind CSS is a utility-first CSS framework for rapidly building custom user interfaces.
- Convex: Convex is a TypeScript-first ORM for Node.js and the browser.
- Clerk: Clerk is a developer-first identity and user management service.
- ESLint: ESLint is a static code analysis tool for identifying problematic patterns found in JavaScript code.
- Prettier: Prettier is an opinionated code formatter.
- Shadcn-UI: Shadcn UI is a React UI library that helps developers rapidly build modern web applications.
- Zustand: Zustand is a small, fast and scalable bearbones state-management solution.
- BlockNote: BlockNote is a Notion-like editor for React.
- Zod: Zod is a TypeScript-first schema declaration and validation library.
- Vercel: Vercel is a cloud platform for frontend developers, providing the frameworks, workflows, and infrastructure to build a faster, more personalized Web.
To get this project up and running in your development environment, follow these step-by-step instructions.
In order to install and run this project locally, you would need to have the following installed on your local machine.
Step 0:
Note CONVEX_DEPLOY_KEY
and NEXT_PUBLIC_CONVEX_URL
environment variables in .env
file.
Note CLERK_PUBLISHABLE_KEY
and CLERK_SECRET_KEY
environment variables in .env
file.
Note EDGE_STORE_ACCESS_KEY
and EDGE_STORE_SECRET_KEY
environment variables in .env
file.
Also, you need to create a JWT template in Clerk and define the JWKS Endpoint as a provider inside convex/auth.config.js
file.
Step 1:
Download or clone this repo by using the link below:
git clone https://github.com/ladunjexa/nextjs14-notion.git
Step 2:
Execute the following command in the root directory of the downloaded repo in order to install dependencies:
npm install
Step 3:
Execute the following command in order to run the development server locally:
npm run dev
Step 4:
Open http://localhost:3000 with your browser to see the result.
All scripts are defined in the package.json
file. Here is a list of all scripts:
Script | Action |
---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:3000 |
npm run build |
Build your production site to ./dist/ |
npm run start |
Start your production site locally |
npm run lint |
Run ESLint |
Environment variables[^6] can be used for configuration. They must be set before running the app.
Environment variables are variables that are set in the operating system or shell, typically used to configure programs.
Notion uses Convex, and Clerk as external services. You need to create an accounts on Convex and Clerk and get the required credentials to run the app.
Create a .env
file in the root directory of the project and add the following environment variables:
CONVEX_DEPLOY_KEY=<CONVEX_DEPLOY_URL>
NEXT_PUBLIC_CONVEX_URL=<NEXT_PUBLIC_CONVEX_URL>
CLERK_PUBLISHABLE_KEY=<CLERK_PUBLISHABLE_KEY>
CLERK_SECRET_KEY=<CLERK_SECRET_KEY>
EDGE_STORE_ACCESS_KEY=<EDGE_STORE_ACCESS_KEY>
EDGE_STORE_SECRET_KEY=<EDGE_STORE_SECRET_KEY>
You can create an optimized production build with the following command:
npm run build
The easiest way to deploy this Next.js app is to use the Vercel Platform.
You can also deploy this Next.js app with Netlify.
Check out Next.js deployment documentation for more details.
- Real-time database π
- Notion-style editor π
- Light and Dark mode π
- Infinite children documents π²
- Trash can & soft delete ποΈ
- Authentication π
- File upload
- File deletion
- File replacement
- Icons for each document (changes in real-time) π
- Expandable sidebar β‘οΈπβ¬ οΈ
- Full mobile responsiveness π±
- Publish your note to the web π
- Fully collapsable sidebar
βοΈ - Landing page π¬
- Cover image of each document πΌοΈ
- Recover deleted files ππ
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
To fix a bug or enhance an existing module, follow these steps:
- Fork the repo
- Create a new branch (
git checkout -b improve-feature
) - Make the appropriate changes in the files
- Commit your changes (
git commit -am 'Improve feature'
) - Push to the branch (
git push origin improve-feature
) - Create a Pull Request π
If you find a bug (failure of a module to execute its intended function), kindly open an issue here by including the issue with a title and clear description.
If you'd like to request a new function, feel free to do so by opening an issue here. Please include sample queries and their corresponding results.
I'd like to express my gratitude to the following people who helped me with this project and made it possible:
- Clerk
- Convex
- EdgeStore
- BlockNote
- Shadcn UI
- Zustand
- useHooks TS
- Sonner
- Next Themes
- Emoji Picker React
- React Dropzone
- React Textarea Autosize
- Vercel
- CodeWithAntonio
CodeWithAntonio. (2023). Fullstack Notion Clone: Next.js 13, React, Convex, Tailwind. E-Learning.
Notion is open source software licensed as MIT and is free to use β See LICENSE for more details.