Sunilmalani456 / Devflow

DevOverflow is a complex Next.js 14 app that exhibits Q&A platform for developers to ask questions, share knowledge, and learn from each other. 🧠

Home Page:https://devflow-tau-pied.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Next.js 14 DevOverflow

demo

Screenshot (871)

sunilmalani456 License

🌐 Live Demo

Explore the live demonstration of the project: nextjs14-devoverflow

πŸ“ Description

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)/
β”œ   β”œ   β”œβ”€β”€ onboarding/
β”œ   β”œ   β”œ   └── page.tsx
β”œ   β”œ   β”œβ”€β”€ 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
β”œ   β”œ   β”œβ”€β”€ edit-answer/
β”œ   β”œ   β”œ   └── [id]/
β”œ   β”œ   β”œ       └── 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/
β”œ       β”œβ”€β”€ openai/
β”œ       β”œ   └── route.ts
β”œ       β”œβ”€β”€ rapidapi/
β”œ       β”œ   └── route.ts
β”œ       └── webhook/clerk/
β”œ              └── route.ts
β”œβ”€β”€ components/
β”œ   β”œβ”€β”€ cards/
β”œ   β”œ   β”œβ”€β”€ AnswerCard.tsx
β”œ   β”œ   β”œβ”€β”€ JobCard.tsx
β”œ   β”œ   β”œβ”€β”€ QuestionCard.tsx
β”œ   β”œ   └── UserCard.tsx
β”œ   β”œβ”€β”€ forms/
β”œ   β”œ   β”œβ”€β”€ Answer.tsx
β”œ   β”œ   β”œβ”€β”€ Profile.tsx
β”œ   β”œ   └── Question.tsx
β”œ   β”œβ”€β”€ jobs/
β”œ   β”œ   └── JobBadge.tsx
β”œ   β”œβ”€β”€ shared/
β”œ   β”œ   β”œβ”€β”€ AllAnswers.tsx
β”œ   β”œ   β”œβ”€β”€ AnswersTab.tsx
β”œ   β”œ   β”œβ”€β”€ EditDeleteAction.tsx
β”œ   β”œ   β”œβ”€β”€ Filter.tsx
β”œ   β”œ   β”œβ”€β”€ Filters.tsx
β”œ   β”œ   β”œβ”€β”€ LeftSidebar.tsx
β”œ   β”œ   β”œβ”€β”€ Metric.tsx
β”œ   β”œ   β”œβ”€β”€ NoResult.tsx
β”œ   β”œ   β”œβ”€β”€ Pagination.tsx
β”œ   β”œ   β”œβ”€β”€ ParseHTML.tsx
β”œ   β”œ   β”œβ”€β”€ ProfileLink.tsx
β”œ   β”œ   β”œβ”€β”€ QuestionsTab.tsx
β”œ   β”œ   β”œβ”€β”€ RenderTag.tsx
β”œ   β”œ   β”œβ”€β”€ RightSidebar.tsx
β”œ   β”œ   β”œβ”€β”€ Stats.tsx
β”œ   β”œ   β”œβ”€β”€ Switcher.tsx
β”œ   β”œ   β”œβ”€β”€ Votes.tsx
β”œ   β”œ   β”œβ”€β”€ navbar/
β”œ   β”œ   β”œ   β”œβ”€β”€ Navbar.tsx
β”œ   β”œ   β”œ   β”œβ”€β”€ Mobile.tsx
β”œ   β”œ   β”œ   └── Theme.tsx
β”œ   β”œ   └── search/
β”œ   β”œ       β”œβ”€β”€ GlobalFilters.tsx
β”œ   β”œ       β”œβ”€β”€ GlobalResult.tsx
β”œ   β”œ       β”œβ”€β”€ GlobalSearch.tsx
β”œ   β”œ       └── LocalSearchbar.tsx
β”œ   └── ui/ (generated by shadcn-ui)
β”œ       β”œβ”€β”€ badge.tsx
β”œ       β”œβ”€β”€ button.tsx
β”œ       β”œβ”€β”€ form.tsx
β”œ       β”œβ”€β”€ input.tsx
β”œ       β”œβ”€β”€ label.tsx
β”œ       β”œβ”€β”€ menubar.tsx
β”œ       β”œβ”€β”€ select.tsx
β”œ       β”œβ”€β”€ sheet.tsx
β”œ       β”œβ”€β”€ skeleton.tsx
β”œ       β”œβ”€β”€ switch.tsx
β”œ       β”œβ”€β”€ tabs.tsx
β”œ       β”œβ”€β”€ textarea.tsx
β”œ       β”œβ”€β”€ toast.tsx
β”œ       β”œβ”€β”€ toaster.tsx
β”œ       └── use-toast.ts
β”œβ”€β”€ constants/
β”œ   β”œβ”€β”€ filters.ts
β”œ   └── index.ts
β”œβ”€β”€ content/
β”œ   β”œβ”€β”€ countries.json
β”œ   └── jsearch.json
β”œβ”€β”€ 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.action.ts
β”œ       β”œβ”€β”€ general.action.ts
β”œ       β”œβ”€β”€ interaction.action.ts
β”œ       β”œβ”€β”€ job.action.ts
β”œ       β”œβ”€β”€ question.action.ts
β”œ       β”œβ”€β”€ tag.action.ts
β”œ       β”œβ”€β”€ user.action.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
β”œβ”€β”€ README.md
β”œβ”€β”€ components.json
β”œβ”€β”€ middleware.ts
β”œβ”€β”€ next.config.js
β”œβ”€β”€ package.json
β”œβ”€β”€ postcss.config.js
β”œβ”€β”€ tailwind.config.ts
└── tsconfig.ts

πŸ“– Table of Contents

Table of Contents

✨ Technologies Used

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.

Technologies Used

🧰 Get Started

To get this project up and running in your development environment, follow these step-by-step instructions.

πŸ“‹ Prerequisites

In order to install and run this project locally, you would need to have the following installed on your local machine.

βš™οΈ Installation and Run Locally

Step 0:

Important

  • the application uses Clerk for Authentication and User Management, therefore, you need to create Clerk account here and sets the 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 file located in server folder.
  • 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 RAPIDAPI_API_KEY environment variable in .env file.

After following all the instructions above, we'll want to create a new webhook on Clerk. To do this, go to the Clerk Dashboard, click on the "Webhooks" tab, and then click "Add Endpoint". For the Endpoint URL, enter http://<PASTE-YOUR-LINK-HERE>/api/webhook/clerk. For the events, select the "user". Then click "Create" to create the webhook. get the signing secret and set it as CLERK_WEBHOOK_SECRET environment variable in .env file.

Step 1:

Download or clone this repo by using the link below:

git clone https://github.com/ladunjexa/nextjs14-devoverflow.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.

πŸ“œ Scripts

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

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_CLERK_WEBHOOK_SECRET=<CLERK_WEBHOOK_SECRET>

NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/onboarding

NEXT_PUBLIC_TINY_MCE_API_KEY=<YOUR_TINY_MCE_API_KEY>

MONGODB_URL=<YOUR_MONGODB_URL>

NEXT_PUBLIC_SERVER_URL=<YOUR_SERVER_URL>

OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

RAPID_API_KEY=<YOUR_RAPID_API_KEY>

πŸš€ Deployment

Deploy to production (manual)

You can create an optimized production build with the following command:

npm run build

Deploy on Vercel (recommended)

The easiest way to deploy this Next.js app is to use the Vercel Platform.

Deploy with Vercel

Deploy on Netlify

You can also deploy this Next.js app with Netlify.

Deploy with Netlify

Check out Next.js deployment documentation for more details.

πŸ”§ Contributing

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:

  1. Fork the repo
  2. Create a new branch (git checkout -b improve-feature)
  3. Make the appropriate changes in the files
  4. Commit your changes (git commit -am 'Improve feature')
  5. Push to the branch (git push origin improve-feature)
  6. Create a Pull Request πŸŽ‰

πŸ“© Bug / Feature 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.

πŸ’Ž Acknowledgements

I'd like to express my gratitude to the following people who helped me with this project and made it possible:

πŸ“š References

JSMastery. (2023). Ultimate Next.js 14 Course | Become a top 1% Next.js 14 developer. E-Learning.

πŸ“‹ License

DevOverflow is open source software licensed as MIT and is free to use β€” See LICENSE for more details.

About

DevOverflow is a complex Next.js 14 app that exhibits Q&A platform for developers to ask questions, share knowledge, and learn from each other. 🧠

https://devflow-tau-pied.vercel.app


Languages

Language:TypeScript 95.6%Language:CSS 4.1%Language:JavaScript 0.2%