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.
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
š 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
You can check the project live here devstack_overflow_nextjs14
Follow these steps to set up the project locally on your machine.
Make sure you have the following installed on your machine:
git clone https://github.com/Mastrangelis/devstack_overflow_nextjs14.git
cd devstack_overflow_nextjs14
Install the project dependencies using npm:
npm install
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
andCLERK_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.
npm run dev
Open http://localhost:3000 in your browser to view the project.
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>