devstack_overflow_nextjs14 Tailwind Templates

Devstack_overflow_nextjs14

Devstack Overflow is a complex Q&A platform for developers to ask questions, share knowledge, and learn from each other. It is built with Next.js, Tailwind CSS, Clerk, MongoDB, and more.

Devstack overflow with Next.js 14

GitHub commits mastrangelis Top Language deployment

šŸ“‹ Table of Contents

Table of Contents

šŸ¤– Introduction

DevOverflow is a complex Q&A platform for developers to ask questions, share knowledge, and learn from each other. It is built with Next.js, Tailwind CSS, Clerk, MongoDB, and more.

Folder Structure
nextjs14-devoverflow/
ā”œā”€ā”€ app/
ā”œ   ā”œā”€ā”€ favicon.ico
ā”œ   ā”œā”€ā”€ globals.css
ā”œ   ā”œā”€ā”€ layout.tsx
ā”œ   ā”œā”€ā”€ (auth)/
ā”œ   ā”œ   ā”œā”€ā”€ sign-in/[[...sign-in]]/
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ sign-up/[[...sign-up]]/
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   └── layout.tsx
ā”œ   ā”œā”€ā”€ (root)/
ā”œ   ā”œ   ā”œā”€ā”€ layout.tsx
ā”œ   ā”œ   ā”œā”€ā”€ (home)/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ loading.tsx
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ ask-question/
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ collection/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ loading.tsx
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ community/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ loading.tsx
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ jobs/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ loading.tsx
ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ profile/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ [id]/
ā”œ   ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ loading.tsx
ā”œ   ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œ   └── edit/
ā”œ   ā”œ   ā”œ       └── page.tsx
ā”œ   ā”œ   ā”œā”€ā”€ question/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ [id]/
ā”œ   ā”œ   ā”œ   ā”œ   └── page.tsx
ā”œ   ā”œ   ā”œ   └── edit/
ā”œ   ā”œ   ā”œ       └── [id]/
ā”œ   ā”œ   ā”œ           └── page.tsx
ā”œ   ā”œ   └── tags/
ā”œ   ā”œ       ā”œā”€ā”€ [id]/
ā”œ   ā”œ       ā”œ   ā”œā”€ā”€ loading.tsx
ā”œ   ā”œ       ā”œ   └── page.tsx
ā”œ   ā”œ       ā”œā”€ā”€ page.tsx
ā”œ   ā”œ       └── loading.tsx
ā”œ   └── api/
ā”œ       ā”œā”€ā”€ chatgpt/
ā”œ       ā”œ   └── route.ts
ā”œ       └── webhook/
ā”œ              └── route.ts
ā”œā”€ā”€ components/
ā”œ   ā”œā”€ā”€ cards/
ā”œ   ā”œ   ā”œā”€ā”€ AnswerCard.tsx
ā”œ   ā”œ   ā”œā”€ā”€ JobCard.tsx
ā”œ   ā”œ   ā”œā”€ā”€ QuestionCard.tsx
ā”œ   ā”œ   └── UserCard.tsx
ā”œ   ā”œ   └── TagCard.tsx
ā”œ   ā”œā”€ā”€ forms/
ā”œ   ā”œ   ā”œā”€ā”€ AnswerForm.tsx
ā”œ   ā”œ   ā”œā”€ā”€ ProfileForm.tsx
ā”œ   ā”œ   └── QuestionForm.tsx
ā”œ   ā”œā”€ā”€ shared/
ā”œ   ā”œ   ā”œā”€ā”€ AllAnswers.tsx
ā”œ   ā”œ   ā”œā”€ā”€ EditDeleteAction.tsx
ā”œ   ā”œ   ā”œā”€ā”€ Filter.tsx
ā”œ   ā”œ   ā”œā”€ā”€ LeftSidebar.tsx
ā”œ   ā”œ   ā”œā”€ā”€ Metric.tsx
ā”œ   ā”œ   ā”œā”€ā”€ NoResult.tsx
ā”œ   ā”œ   ā”œā”€ā”€ Pagination.tsx
ā”œ   ā”œ   ā”œā”€ā”€ ParseHTML.tsx
ā”œ   ā”œ   ā”œā”€ā”€ ProfileLink.tsx
ā”œ   ā”œ   ā”œā”€ā”€ Tag.tsx
ā”œ   ā”œ   ā”œā”€ā”€ RightSidebar.tsx
ā”œ   ā”œ   ā”œā”€ā”€ Stats.tsx
ā”œ   ā”œ   ā”œā”€ā”€ Votes.tsx
ā”œ   ā”œ   ā”œā”€ā”€ CountrySelect.tsx
ā”œ   ā”œ   ā”œā”€ā”€ tabs/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ AnswersTab.tsx
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ QuestionsTab.tsx
ā”œ   ā”œ   ā”œā”€ā”€ navbar/
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ Navbar.tsx
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ NavContent.tsx
ā”œ   ā”œ   ā”œ   ā”œā”€ā”€ MobileNav.tsx
ā”œ   ā”œ   ā”œ   └── Theme.tsx
ā”œ   ā”œ   └── search/
ā”œ   ā”œ       ā”œā”€ā”€ GlobalFilters.tsx
ā”œ   ā”œ       ā”œā”€ā”€ GlobalResult.tsx
ā”œ   ā”œ       ā”œā”€ā”€ GlobalSearch.tsx
ā”œ   ā”œ       └── LocalSearch.tsx
ā”œ   └── ui/ (generated by shadcn-ui)
ā”œ       ā”œā”€ā”€ badge.tsx
ā”œ       ā”œā”€ā”€ button.tsx
ā”œ       ā”œā”€ā”€ form.tsx
ā”œ       ā”œā”€ā”€ input.tsx
ā”œ       ā”œā”€ā”€ label.tsx
ā”œ       ā”œā”€ā”€ menubar.tsx
ā”œ       ā”œā”€ā”€ select.tsx
ā”œ       ā”œā”€ā”€ sheet.tsx
ā”œ       ā”œā”€ā”€ skeleton.tsx
ā”œ       ā”œā”€ā”€ tabs.tsx
ā”œ       ā”œā”€ā”€ textarea.tsx
ā”œ       ā”œā”€ā”€ toast.tsx
ā”œ       ā”œā”€ā”€ toaster.tsx
ā”œ       └── use-toast.ts
ā”œā”€ā”€ constants/
ā”œ   ā”œā”€ā”€ filters.ts
ā”œ   └── index.ts
ā”œā”€ā”€ context/
ā”œ   └── ThemeProvider.ts
ā”œā”€ā”€ datbase/
ā”œ   ā”œā”€ā”€ answer.model.ts
ā”œ   ā”œā”€ā”€ interaction.model.ts
ā”œ   ā”œā”€ā”€ question.model.ts
ā”œ   ā”œā”€ā”€ tag.model.ts
ā”œ   └── user.model.ts
ā”œā”€ā”€ lib/
ā”œ   ā”œā”€ā”€ mongoose.ts
ā”œ   ā”œā”€ā”€ utils.ts
ā”œ   ā”œā”€ā”€ validations.ts
ā”œ   └── actions/
ā”œ       ā”œā”€ā”€ answer.actions.ts
ā”œ       ā”œā”€ā”€ general.actions.ts
ā”œ       ā”œā”€ā”€ interaction.actions.ts
ā”œ       ā”œā”€ā”€ job.actions.ts
ā”œ       ā”œā”€ā”€ question.actions.ts
ā”œ       ā”œā”€ā”€ tag.actions.ts
ā”œ       ā”œā”€ā”€ user.actions.ts
ā”œ       └── shared.types.d.ts
ā”œā”€ā”€ public/
ā”œ   ā”œā”€ā”€ next.svg
ā”œ   ā”œā”€ā”€ vercel.svg
ā”œ   └── assets/
ā”œ       ā”œā”€ā”€ icons/[[...]].svg
ā”œ       └── images/[[...]].{svg,png}
ā”œā”€ā”€ styles/
ā”œ   ā”œā”€ā”€ prism.css
ā”œ   └── theme.css
ā”œā”€ā”€ types/
ā”œ   └── index.d.ts
ā”œā”€ā”€ .eslintrc.json
ā”œā”€ā”€ .gitignore
ā”œā”€ā”€ .env.example
ā”œā”€ā”€ .prettierrc.json
ā”œā”€ā”€ README.md
ā”œā”€ā”€ components.json
ā”œā”€ā”€ middleware.ts
ā”œā”€ā”€ next.config.js
ā”œā”€ā”€ package.json
ā”œā”€ā”€ package-lock.json
ā”œā”€ā”€ postcss.config.js
ā”œā”€ā”€ tailwind.config.ts
└── tsconfig.json

āš™ļø Tech Stack

DevOverflow 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.
  • ESLint: ESLint is a static code analysis tool for identifying problematic patterns found in JavaScript code.
  • Prettier: Prettier is an opinionated code formatter.
  • Clerk: Clerk is a developer-first authentication API that handles all the logic for user sign up, sign in, and more.
  • Shadcn-UI: Shadcn UI is a React UI library that helps developers rapidly build modern web applications.
  • TinyMCE: TinyMCE is the world's most popular JavaScript library for rich text editing.
  • MongoDB: MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.
  • Mongoose: Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.
  • Prism.js: Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind.
  • Query String: Parse and stringify URL query strings.
  • Svix: Svix is a webhook proxy that allows you to receive webhooks locally.
  • 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.
  • OpenAI: OpenAI is known for the GPT family of large language models, the DALL-E series of text-to-image models, and a text-to-video model named Sora.

Technologies Used

šŸ”‹ Features

šŸ‘‰ Server actions

šŸ‘‰ Client and Server components

šŸ‘‰ Enchanced SEO

šŸ‘‰ Revalidating and caching

šŸ‘‰ Authentication methods for sign-in and sign-up using Clerk

šŸ‘‰ Advance MongoDB features like aggregation pipelines

šŸ‘‰ Integration of OpenAI for automated answers

šŸ‘‰ Recommendation system

šŸ‘‰ Badge system and reputation

šŸ‘‰ Counting page views

šŸ‘‰ Voting system:

šŸ‘‰ Advanced filters:

šŸ‘‰ Global Database search

šŸ‘‰ Switch between dark, light or system theme

šŸ‘‰ Mobile responsive design

and many more, including code architecture and reusability

šŸ› ļø Deployment

You can check the project live here devstack_overflow_nextjs14

🤸 Quick Start

Follow these steps to set up the project locally on your machine.

Prerequisites

Make sure you have the following installed on your machine:

Cloning the Repository

git clone https://github.com/Mastrangelis/devstack_overflow_nextjs14.git
cd devstack_overflow_nextjs14

Installation

Install the project dependencies using npm:

npm install

Enviromental variables

Once you're done installing the node modules, you should rename the .env.example, associated with the project, to .env.local

After that you need to set the proper values in the env variables.

[!IMPORTANT]

  • the application uses Clerk for Authentication and User Management, therefore, you need to create Clerk account here and set the NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY environment variables in .env file. Also, the different URLs for the Clerk sign-in, sign-up, after sign-in and after sign-up pages.
  • the application uses a MongoDB database, therefore, you need to create a database and connect it to the application, for this, change the MONGODB_URL environment variable in .env
  • the application uses TinyMCE, therefore, you need to create TinyMCE account here and sets the NEXT_PUBLIC_TINYMCE_API_KEY environment variable in .env file.
  • the application uses OpenAI API, therefore, you need to create OpenAI account here and sets the OPENAI_API_KEY environment variable in .env file.
  • the application uses RapidAPI, therefore, you need to create RapidAPI account here, subscribe to the JSearch API and sets the X_RAPID_API_KEY environment variable in .env file.

Running the Project

npm run dev

Open http://localhost:3000 in your browser to view the project.

šŸ”’ Environment Variables

Environment variables[^12] 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.

DevOverflow uses Clerk, TinyMCE, RapidAPI, OpenAI API and MongoDB as external services. You need to create an account on each of these services 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:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=<CLERK_PUBLISHABLE_KEY>
CLERK_SECRET_KEY=<CLERK_SECRET_KEY>

NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up

NEXT_PUBLIC_TINY_MCE_API_KEY=<YOUR_TINY_MCE_API_KEY>
NEXT_CLERK_WEBHOOK_SECRET=<CLERK_WEBHOOK_SECRET>

MONGODB_URL=<YOUR_MONGODB_URL>

NEXT_PUBLIC_SERVER_URL=<YOUR_SERVER_URL> # locally this should be http://localhost:3000

OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

X_RAPID_API_KEY=<YOUR_RAPID_API_KEY>

Top categories

Loading Svelte Themes