Skip to content
Discussion options

You must be logged in to vote

Recommended Folder Structure & Best Practices for Next.js 🚀

Hey! 👋 Here’s a solid approach for structuring your full-stack Next.js project:

📂 Folder Structure

/app/api        # API routes (Next.js App Router)
/components     # Reusable UI components
/hooks          # Custom React hooks
/lib            # Database queries & utilities
/context        # State management (if using Context API)
/services       # External API calls
/models         # Database models (if using Prisma/Drizzle)
/config         # Env & project configs

💾 Database Handling (PostgreSQL)

  • Prisma (Recommended):
    Define models in /prisma/schema.prisma & queries in /lib/db.ts:
    import { PrismaClient } from '@prisma/client';
    c…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Dev-Emmyy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Ask and answer questions about GitHub features and usage Programming Help Discussions around programming languages, open source and software development
3 participants