Explore the live demonstration of the project: nextjs14-Horizon
Horizon is a Horizon-like application built with Next.js 14, React, Convex, Tailwind, Clerk, and EdgeStore. It is a real-time database and Horizon-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-Horizon/
├── 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
Horizon 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 Horizon-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/Pglol03/Horizon.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.
Horizon 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 🔗
- Horizon-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 Horizon Clone: Next.js 13, React, Convex, Tailwind. E-Learning.
Horizon is open source software licensed as MIT and is free to use — See LICENSE for more details.