How to Start a New Next.js Project (With Best Practices, Folder Structure & Alternatives) – Zaigo Infotech Software Solutions

Let’s craft brilliance together!

Request a free consultation and get a no-obligation quote for your project within one working day.

Company-Logo

Error: Contact form not found.

How to Start a New Next.js Project (With Best Practices, Folder Structure & Alternatives)

React

Starting a new Next.js project the right way is key to building a clean, maintainable, and scalable application. This blog will guide you through:

1. Recommended Folder Structure

/app β†’ App Router (Next.js 13+)
/components β†’ Reusable UI components
/lib β†’ Utilities (e.g., axios instance, helpers)
/hooks β†’ Custom hooks (e.g., useAuth, useModal)
/store β†’ Global state (e.g., Zustand, Redux)
/styles β†’ Tailwind or global styles
/services β†’ API logic and domain services
/constants β†’ Static values like routes, config
/types β†’ TypeScript interfaces and types
/assets β†’ Static assets like images, icons

Alternatives:

Approach When to use
Flat structure Small apps or MVPs
Domain-driven (e.g., features/) Large-scale apps with modules
Monorepo (apps/, packages/) For managing multiple apps/libraries using Turborepo or Nx

2. Project Initialization

Recommended options:

  • βœ… App Router (Next.js 13+)

  • βœ… Tailwind CSS

  • βœ… ESLint + Prettier

  • βœ… src/ directory

Add --example with-shadcn-ui if you want preconfigured ShadCN setup.


3. Essential Libraries + Alternatives

Category Recommended Alternatives
HTTP Client axios fetch, ky, superagent
Data Fetching @tanstack/react-query SWR, Redux Toolkit Query, Apollo Client (for GraphQL)
UI Kit shadcn/ui Chakra UI, Radix UI, Headless UI, Material UI
Global State zustand recoil, redux, jotai, valtio
Icons lucide-react heroicons, react-icons, fontawesome
Classnames clsx, tailwind-variants classnames, cva (shadcn built-in)
Date Utils date-fns, dayjs luxon, moment (legacy)
Testing Jest, Testing Library Vitest, Cypress (E2E), Playwright

4. Data Fetching: fetch vs axios vs react-query

Tool Use Case Pros Cons
fetch Simple HTTP calls Native, zero dependency No interceptors, verbose
axios Complex HTTP logic Interceptors, defaults Slightly heavier
react-query Async state/caching Auto caching, retry, pagination Requires setup & context
SWR Lightweight data fetching Simpler than React Query Less control
RTK Query If already using Redux Auto-generated hooks Requires Redux setup

Best Practice:
Use React Query + Axios for complex apps.


5. Styling Libraries

Tool Use Case Pros Alternatives
Tailwind CSS Utility-first design Fast, customizable Bootstrap, SCSS, CSS Modules
ShadCN/UI Component toolkit with Tailwind Beautiful UI, composable Chakra UI, Material UI
Radix UI Headless component primitives Accessibility Headless UI (by Tailwind)

Tip: Use clsx or cva for dynamic class management.


6. State Management

Library Use When Pros Alternatives
Zustand Simple, scalable state Minimal boilerplate Recoil, Jotai
Redux Toolkit Complex state flows Devtools, middleware Zustand for simpler apps
React Context Limited global state Native, simple Not scalable alone

Use Zustand for auth, theme, modal toggles.
Use React Query for server state (fetched data).


πŸ§ͺ 7. Git + Dev Tools Setup

Git Practices

  • Use .gitignore from create-next-app

  • Commit using feat/, fix/, refactor/ prefixes

  • Keep a README.md with setup instructions


πŸ“¦ 8. Optional Enhancements

Feature Tool
Monorepo Turborepo, Nx
Storybook For component preview
Auth next-auth, Clerk, Auth0
Forms react-hook-form, Formik
File Upload react-dropzone, uploadthing, cloudinary

βœ… Starter Checklist

  • Next.js + App Router + TypeScript

  • Tailwind CSS + ShadCN

  • React Query + Axios

  • Zustand for state (or Redux)

  • Organized folder structure

  • ESLint, Prettier, Husky

  • .env, README.md, GitHub repo


🏁 Final Thoughts

Choosing the right tools and folder structure at the beginning saves hours of refactoring later. Whether you’re building a portfolio, SaaS, or enterprise dashboard, these practices will help you and your team ship faster and scale better.

Can't find what you are looking for?

Post your query now, and we will get in touch with you soon!

    Want to start a project?

    Our team is ready to implement your ideas. Contact us now to discuss your roadmap!

    GET IN TOUCH

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    INDIA

    9thfloor, (9A & 9B) Sapna Trade Centre, 135,
    Old 109, Poonamallee High Rd, Egmore,
    Chennai, Tamil Nadu 600084

    +91 9884783216

    marketing@zaigoinfotech.com

    USA

    170 Post Rd #211, Fairfield,
    CT 06824,
    USA

    +1 904-672-8617

    sales@zaigoinfotech.com