ππΏ Hi! Iβm Yeabsra, a web and mobile developer from Ethiopia. Iβve put together my preferred tech stack and starter template for a Next.js full stack project. It includes Next.js, Mongoose, Zod, Shadcn, Tailwind, and NextAuth, using pnpm. Feel free to use it if you want. Letβs connect and create something awesome together!
To get started with this template, follow these steps:
Make sure you have the following installed on your machine:
Clone the repository:
git clone https://github.com/yeabnoah/technerd_NextJs_starter_template.git
cd technerd_NextJs_starter_template
Install dependencies:
pnpm install
Set up environment variables:
change the .env.example
to .env.local
file in the root of your project and uncomment and the following environment variables:
# MongoDB connection string use the guide in the file to setup and link to your database either local or Atlas project
MONGODB_URI=your_mongodb_uri
# NextAuth configuration
NEXTAUTH_SECRET=your_nextauth_secret
NEXTAUTH_URL=http://localhost:3000
# Other environment variables
Run the development server:
pnpm dev
Open http://localhost:3000 with your browser to see the result.
Here's an overview of the project structure:
βββ app βββ api βββ auth βββ components # Reusable UI components βββ lib # Library code also Mongoose connection with NextJS βββ models # Mongoose models βββ public # Public assets βββ utils # Utility functions βββ .env.local # Environment variables / change the env.example to env.local
check yourBaseUrl/api/user with GET
and POST
request on postman to validate the DBconnection and api is working
This template uses NextAuth for authentication. You can configure different authentication providers in pages/api/auth/[...nextauth].ts
.
Mongoose is used for MongoDB interaction. Define your Mongoose models in the models
directory.
Zod is used for schema validation. You can define your schemas and use them to validate data throughout your application.
Feel free to submit issues and pull requests. Let's improve this template together!
Letβs connect and create something awesome together! You can reach me at:
Happy coding! π