My Next.js Development Setup: Tools, Architecture, Workflow & Engineering Philosophy
How I build modern, scalable, maintainable, and production-ready web applications.
Introduction
My approach to web development is not just about writing React components or creating visually appealing websites. I want to build complete products that are fast, scalable, maintainable, accessible, and ready for real-world users.
Whether building scalable software ventures at Utility Solutions, leading developer workshops and technical platforms as the Technical Head at Microsoft Learn Student Club (MLSC BVM), or building full-stack platforms like AssetFlow and PrepWise, I have refined a predictable, high-velocity engineering workflow around the Next.js ecosystem.
My stack bridges modern frontend technologies, structured backend architecture, database engineering, authentication, state management, animation libraries, AI integrations, and deployment tools.
I prefer understanding how every part of an application works under the hood rather than relying on unnecessary abstractions or adding third-party libraries without a deliberate reason.
This article documents my complete development environment, preferred technologies, architectural decisions, and the core engineering principles I follow when building web applications.
1. My Core Technology Stack
My primary development ecosystem revolves around Next.js, React, TypeScript, and modern full-stack JavaScript tooling.
| Category | My Preferred Technology |
|---|---|
| Framework | Next.js 16+ (App Router) |
| UI Library | React 19+ |
| Language | TypeScript (Strict Mode) |
| Styling | Tailwind CSS v4 |
| Component Library | shadcn/ui |
| UI Primitives | Radix UI |
| Advanced UI & Motion | Aceternity UI, React Bits |
| Icons | Tabler Icons (@tabler/icons-react) |
| Animation | Framer Motion (Motion for React) |
| Complex Animation | GSAP |
| Runtime & Package Manager | Bun |
| Authentication | Better Auth / Clerk |
| Relational Database | PostgreSQL (Neon serverless) |
| Document Database | MongoDB (Atlas) |
| Relational ORM | Drizzle ORM + Drizzle Kit |
| Document ODM | Mongoose |
| Validation | Zod |
| Form Handling | React Hook Form |
| Server State & Cache | TanStack Query |
| Client State | Zustand |
| Deployment & Edge | Vercel |
| Version Control | Git & GitHub |
I do not believe in throwing every tool into every project. I choose technologies purposefully according to the product's performance, data complexity, and operational requirements.
2. Development Environment
Operating System and Editor
My primary development environment runs on macOS, with Visual Studio Code customized for speed, clean feedback, and type safety:
- OS: macOS
- Code Editor: Visual Studio Code
- Terminal: Integrated zsh with developer shell utilities
- Version Control: Git & GitHub CLI
- Runtime: Bun runtime and package manager
- Browser Developer Tools: Chrome DevTools for performance, network, and memory profiling
- VS Code Extensions: TypeScript and JavaScript Language Features, Tailwind CSS IntelliSense, ESLint, Prettier, Error Lens, and GitLens
Why Bun?
I prefer Bun over npm, yarn, and pnpm for most JavaScript and TypeScript projects.
Bun delivers:
- Ultra-fast dependency installation: Sub-second installs through its global caching mechanism.
- First-class TypeScript execution: Runs
.tsscripts directly with zero configuration or transpilation overhead. - Built-in bundling and test runner: Unified developer tooling that avoids fragmented toolchains.
- Predictable script execution: Consistent execution across development, CI, and build environments.
Typical day-to-day commands:
1# Create a new Next.js project2bunx create-next-app@latest my-app --typescript --tailwind --eslint --app34# Install dependencies with lockfile speed5bun install67# Start local development server8bun run dev910# Compile and typecheck for production11bun run build1213# Start production server14bun run start1516# Add runtime packages17bun add zustand zod drizzle-orm @tabler/icons-react1819# Add dev dependencies20bun add -d drizzle-kit @types/node
Maintaining consistent commands across all projects keeps context-switching minimal.
3. Frontend Architecture
Next.js App Router
Next.js App Router is my foundational architecture for building full-stack web applications. I leverage its modern primitives to structure applications cleanly around layouts, nested routes, streaming boundaries, and server-driven logic.
Key Next.js features I rely on:
- App Router & Nested Layouts: Composable shell architecture with shared state across subtrees.
- React Server Components (RSC): Zero bundle size overhead for server-rendered UI.
- Client Components: Granular interactivity isolated to leaf nodes.
- Server Actions: Type-safe mutations directly callable from forms and UI components.
- Route Handlers: Standardized web request handlers for public or webhook APIs.
- Parallel & Intercepting Routes: Complex UI patterns like modals that keep shareable URLs.
- Middleware: Edge-level request interception, authentication checks, and header mutations.
- Metadata API: Dynamic OpenGraph tags, JSON-LD schemas, and search-engine indexation.
- Next Image & Font Optimization: Zero layout shifts with automatic modern format negotiation (WebP/AVIF).
- Streaming & Suspense: Progressive interface rendering with instant visual feedback.
- Granular Caching: Time-based and tag-based revalidation (
revalidateTag,revalidatePath).
Server Components vs. Client Components
One of my core architectural rules is: avoid shipping unnecessary client-side JavaScript.
1┌────────────────────────────────────────────────────────┐2│ Server Component (Default) │3│ - Data fetching directly from DB │4│ - Reads secrets / environment variables │5│ - Heavy parsing / Markdown compilation │6│ - Zero JavaScript sent to client │7│ │8│ ┌────────────────────────────────────────────────┐ │9│ │ Client Component ("use client" leaf node) │ │10│ │ - Local React state (useState, useReducer) │ │11│ │ - User event handlers (onClick, onChange) │ │12│ │ - Browser APIs (localStorage, window, audio) │ │13│ │ - Framer Motion & interactive animations │ │14│ └────────────────────────────────────────────────┘ │15└────────────────────────────────────────────────────────┘
I treat Server Components as the default. I introduce "use client" only when an interface strictly requires:
- Local React component state.
- Browser event handlers (
onClick,onSubmit,onKeyDown). - Browser APIs (
localStorage,IntersectionObserver,window). - Dynamic client-side animations requiring runtime tick calculation.
My guiding rule:
Server-first architecture, client-side interactivity only where necessary.
Suggested Project Structure
I maintain a predictable and scalable directory tree that prevents bloat as applications grow:
1src/2├── app/3│ ├── (auth)/4│ │ ├── login/5│ │ └── register/6│ ├── (dashboard)/7│ │ ├── dashboard/8│ │ └── settings/9│ ├── api/10│ │ ├── users/11│ │ └── webhooks/12│ ├── layout.tsx13│ ├── page.tsx14│ └── globals.css15│16├── components/17│ ├── ui/ # Primitives (buttons, inputs, dialogs)18│ ├── layout/ # Navbars, footers, sidebars19│ ├── shared/ # Cross-cutting reusable components20│ └── forms/ # Controlled form implementations21│22├── hooks/ # Reusable custom React hooks23├── lib/24│ ├── auth/ # Auth configurations & session helpers25│ ├── db/ # Drizzle schema, migrations, connection client26│ ├── validations/ # Zod schemas for forms and API contracts27│ └── utils/ # Utility helpers (cn, formatting, math)28│29├── states/ # Global client stores (Zustand)30├── types/ # Global TypeScript definitions and interfaces31└── config/ # Site config, navigation links, and constants
This layout enforces separation of concerns: UI components remain decoupled from business logic, data models stay typed in lib/db, and client stores live exclusively in states/.
4. UI Engineering and Design Philosophy
A great application is more than just working code. Its user interface must communicate craft, consistency, responsiveness, and speed.
My design aesthetic is inspired by modern developer platforms, minimal SaaS products, and tactile micro-interactions.
Styling: Tailwind CSS v4
Tailwind CSS is my primary styling engine. With Tailwind CSS v4's CSS-first configuration and lightning-fast engine, styling feels native and friction-free:
- Utility-first workflow: Fast prototyping without context-switching between stylesheets.
- Design tokens: Consistent typography scales, spacing units, and border-radii.
- Semantic CSS variables: Seamless dark and light themes with smooth transitions.
- Responsive design: Mobile-first breakpoints (
sm,md,lg,xl). - Zero dead CSS: Only the classes used in the project are compiled.
Component Systems
Rather than reinventing complex interactive primitives or locking into inflexible opinionated frameworks, I combine complementary building blocks:
- shadcn/ui: The accessible foundation. It is not an npm dependency; it is source code you own, inspect, and customize inside
components/ui/. - Radix UI Primitives: Powers keyboard navigation, focus management, and screen-reader accessibility for modals, dropdowns, popovers, and accordions.
- Aceternity UI: Elevated visual sections, glowing borders, card hover effects, and modern presentation patterns.
- React Bits: Experimental, creative micro-components and physics-based interactions.
I use these libraries as building blocks, maintaining custom design tokens so everything feels cohesive rather than generic.
Typography
Typography dictates clarity and readability:
- Strict heading hierarchy (
h1throughh4) with balanced letter-spacing (tracking-tight). - High-contrast body text with comfortable line heights (
leading-relaxed). - Proportional font scales that adjust smoothly across mobile and desktop viewports.
- Reading width constraints (
max-w-proseormax-w-3xl) to prevent visual eye fatigue.
Icons
I standardize on Tabler Icons (@tabler/icons-react):
bun add @tabler/icons-react
They offer an extensive, clean, and stroke-consistent icon family that covers navigation bars, dashboards, action triggers, and status badges.
Animation
Animation should clarify interface hierarchy, not add lag or distract users.
My animation toolkit:
- Motion (Framer Motion): Layout animations, presence transitions (
AnimatePresence), spring physics, and hover reactions. - GSAP: Multi-stage choreographies, SVG morphing, and complex scroll-timeline animations.
Practical animation use cases I implement:
- Smooth layout transitions during list filtering.
- Subtle entrance staggered reveals for dashboard cards.
- Accessible modals with background backdrop blurs.
- Tactile button press feedback using spring scales (
whileTap={{ scale: 0.98 }}).
5. Backend Development
Next.js is a capable full-stack runtime. I engineer backend architecture inside Next.js with the same rigor applied to standalone backends.
Route Handlers
Route Handlers (app/api/**/route.ts) power public endpoints, third-party integrations, and webhooks:
1// app/api/users/route.ts2import { NextRequest, NextResponse } from "next/server";3import { z } from "zod";4import { db } from "@/lib/db";5import { users } from "@/lib/db/schema";67const querySchema = z.object({8 page: z.coerce.number().min(1).default(1),9 limit: z.coerce.number().min(1).max(100).default(20),10});1112export async function GET(request: NextRequest) {13 try {14 const { searchParams } = new URL(request.url);15 const parsed = querySchema.safeParse(Object.fromEntries(searchParams));1617 if (!parsed.success) {18 return NextResponse.json(19 { success: false, errors: parsed.error.flatten().fieldErrors },20 { status: 400 }21 );22 }2324 const { page, limit } = parsed.data;25 const offset = (page - 1) * limit;2627 const data = await db.select().from(users).limit(limit).offset(offset);2829 return NextResponse.json({30 success: true,31 page,32 data,33 });34 } catch (error) {35 console.error("API Error in GET /api/users:", error);36 return NextResponse.json(37 { success: false, message: "Internal server error" },38 { status: 500 }39 );40 }41}
Core API principles:
- Explicit HTTP Methods: Strict handlers for
GET,POST,PUT,PATCH,DELETE. - Schema validation at boundaries: Every query parameter, path variable, and JSON body is validated through Zod before reaching business logic.
- Structured responses: Predictable JSON responses with standard status codes.
- Isolated business logic: Database and service logic reside in
lib/, keeping route files thin.
Server Actions
For direct form submissions, inline updates, and button actions inside the application, I use Server Actions. They eliminate the boilerplate of manual fetch wrappers, provide automatic type safety, and integrate with Next.js revalidation hooks (revalidatePath).
6. Database Engineering
Data integrity and schema design are foundational to every application I build. I work across both relational and document databases depending on the problem domain.
PostgreSQL + Drizzle ORM
When data relationships, ACID transactions, and strict schemas are paramount—such as in AssetFlow (asset ERP) and SaaS projects—PostgreSQL combined with Drizzle ORM is my preferred database stack:
- Database: PostgreSQL (hosted serverless on Neon).
- ORM: Drizzle ORM (TypeScript-native, zero-bloat SQL query builder).
- Migrations: Drizzle Kit.
Example Drizzle schema:
1// lib/db/schema.ts2import { pgTable, text, timestamp, uuid, varchar, index } from "drizzle-orm/pg-core";34export const users = pgTable("users", {5 id: uuid("id").defaultRandom().primaryKey(),6 name: varchar("name", { length: 255 }).notNull(),7 email: varchar("email", { length: 255 }).notNull().unique(),8 role: varchar("role", { length: 50 }).default("user").notNull(),9 createdAt: timestamp("created_at", { withTimezone: true }).defaultNow().notNull(),10 updatedAt: timestamp("updated_at", { withTimezone: true }).defaultNow().notNull(),11}, (table) => [12 index("email_idx").on(table.email),13]);
Why Drizzle?
- TypeScript-first: Schema definitions become TypeScript types automatically.
- SQL-like simplicity: If you know SQL, you already know Drizzle—no confusing abstraction layers.
- Zero runtime overhead: Generates optimized raw SQL without heavy internal query mapping.
MongoDB + Mongoose
For document-centric projects, rapid prototyping, or dynamic schemas:
- Structured schema validation using Mongoose models.
- Complex aggregation pipelines for data transformation.
- Compound indexes for efficient querying.
- Clean pagination patterns using cursor-based or offset queries.
7. Authentication and Authorization
Better Auth
For applications requiring complete data ownership and deep database integration, Better Auth paired with Drizzle and PostgreSQL is my preferred solution:
- Native integration with Drizzle ORM schemas.
- First-class support for email/password, magic links, Google OAuth, and GitHub OAuth.
- Robust session handling with secure HTTP-only cookies.
- Comprehensive plugins (two-factor authentication, organization multi-tenancy, passkeys).
For enterprise prototypes where fully managed auth is preferred, Clerk offers instant turn-key onboarding.
Authorization: AuthN vs AuthZ
Security requires separating identity from permissions:
1┌────────────────────────────────────────────────────────┐2│ Authentication (Who are you?) │3│ Better Auth Session / JWT Verification │4└───────────────────────────┬────────────────────────────┘5 │6 ▼7┌────────────────────────────────────────────────────────┐8│ Authorization (What are you allowed to do?) │9│ Role-Based Access Control (RBAC) & Ownership Check │10│ - Verified on the SERVER, never solely in UI │11└────────────────────────────────────────────────────────┘
I enforce:
- Role-Based Access Control (RBAC): Roles (
admin,editor,viewer) checked via server-side guards. - Resource ownership: Verifying that
resource.userId === session.user.idbefore any mutation. - Never trust client state: Hiding a UI button is an interface courtesy; enforcing authorization on Server Actions and Route Handlers is the actual security boundary.
8. State Management and Data Fetching
Different types of state require different architectural tools.
1┌──────────────────────────────────────────────────────────────────┐2│ STATE MANAGEMENT STRATEGY │3├───────────────────────┬──────────────────────────────────────────┤4│ State Type │ Preferred Tool │5├───────────────────────┼──────────────────────────────────────────┤6│ Server & Cache State │ Next.js RSC & TanStack Query │7│ Global UI State │ Zustand │8│ Form State │ React Hook Form + Zod │9│ URL / Filter State │ Next.js useSearchParams & router.push │10└───────────────────────┴──────────────────────────────────────────┘
Zustand for Client UI State
For global client-side state—such as sidebar toggles, audio playback, filter drawers, or active modals—I use Zustand:
1// states/ui-store.ts2import { create } from "zustand";34interface UIState {5 sidebarOpen: boolean;6 activeModal: string | null;7 toggleSidebar: () => void;8 openModal: (modalId: string) => void;9 closeModal: () => void;10}1112export const useUIStore = create<UIState>((set) => ({13 sidebarOpen: false,14 activeModal: null,15 toggleSidebar: () => set((state) => ({ sidebarOpen: !state.sidebarOpen })),16 openModal: (modalId) => set({ activeModal: modalId }),17 closeModal: () => set({ activeModal: null }),18}));
Zustand provides a minimal boilerplate store that avoids React Context re-render traps.
TanStack Query for Dynamic Client State
When client-side data fetching, polling, pagination, or optimistic UI mutations are required, TanStack Query handles caching, background invalidation, and request deduplication.
React Hook Form + Zod
Forms are the primary source of user input errors. Combining React Hook Form with Zod provides:
- Uncontrolled inputs for peak performance without re-rendering on every keystroke.
- Shared validation schemas between client forms and backend endpoints.
- Type-safe form error states displayed inline.
9. Working with AI in Web Applications
A central focus in my engineering work is combining full-stack web development with practical AI engineering. I build applications that integrate intelligent capabilities directly into user workflows.
Local-First & Flexible Provider Architecture
Rather than hardcoding an application to a single closed-source API provider, I design a provider-agnostic AI layer:
1src/2└── lib/3 └── ai/4 ├── providers/5 │ ├── ollama.ts # Local inference (Llama, Mistral, Qwen)6 │ ├── groq.ts # Ultra-low latency inference7 │ ├── gemini.ts # Multimodal reasoning8 │ └── huggingface.ts # Open-source model pipelines9 ├── prompts/ # Versioned prompt templates10 ├── schemas/ # Zod schemas for structured outputs11 └── ai-service.ts # Unified dispatch interface
This architecture enables:
- Local development & testing with Ollama: Zero API costs while iterating on prompts and workflows.
- Instant provider switching: Swap between Groq, Gemini, or self-hosted models by changing an environment variable.
- Structured Outputs: Guaranteeing JSON outputs that adhere strictly to Zod schemas using model tool-calling or constrained sampling.
- Streaming UI: Streaming chunk responses via the AI SDK directly to client components for real-time typewriter feedback.
Key AI capabilities I integrate into web products:
- Retrieval-Augmented Generation (RAG) over domain documentation.
- Contextual chat interfaces with conversation history persistence.
- Document and code analysis pipelines.
- Intelligent workflow automation and automated summaries.
10. Code Quality and Engineering Standards
High-quality software is defined by how easily another developer can read, test, and maintain it.
TypeScript Discipline
strict: trueenabled across alltsconfig.jsonconfigurations.- Eliminate arbitrary
anytypes; preferunknownwith type guards. - Shared domain types in
types/referenced across frontend and backend layers.
Component Design Principles
- Single Responsibility: Each component should do one thing well.
- Compound Components: Build flexible UI using parent-child composition (e.g.,
Dialog,DialogTrigger,DialogContent). - Props interface clarity: Explicit, documented component props with sensible defaults.
Resilient Error Handling
- Use
try/catchboundaries with centralized error logging. - Return meaningful HTTP status codes and readable error payloads.
- Always provide accessible UI fallback states (
error.tsx, skeleton loaders, and empty states).
Web Performance & Core Web Vitals
- Ensure Largest Contentful Paint (LCP) is fast by preloading hero assets and optimizing fonts with
next/font. - Prevent Cumulative Layout Shift (CLS) with explicit image dimension ratios.
- Keep client bundle sizes minimal by auditing dependencies with
@next/bundle-analyzer.
11. Git and Deployment Workflow
Version Control & Collaboration
My development lifecycle runs through Git and GitHub:
- Feature branches (
feat/auth-integration,fix/table-layout). - Atomic commits with semantic messages (
feat:,fix:,refactor:,docs:). - Pull request reviews with automated lint and build verification.
Vercel Deployment
For Next.js applications, Vercel provides the ideal deployment environment:
- Automatic preview deployments per pull request.
- Edge Middleware execution at geographic points of presence.
- Zero-downtime production rollouts with instant rollback capabilities.
- Edge caching and serverless execution aligned with Next.js App Router idioms.
12. How I Approach Building a New Product
Every project I build—from personal tools to production SaaS platforms—follows a structured six-phase engineering pipeline:
1Phase 1: Research & Discovery2└── Understand user problem, evaluate competitors, define minimal scope34Phase 2: Architecture & Contracts5└── Choose database, design schemas, plan auth, define API contracts67Phase 3: Design & Token Systems8└── Typography, color tokens, layout hierarchy, interactive states910Phase 4: Implementation11└── Data layer -> Backend endpoints -> UI primitives -> Feature integration1213Phase 5: Quality Assurance14└── Type checks, edge case testing, responsive audit, performance profiling1516Phase 6: Deployment & Monitoring17└── Vercel deploy, environment validation, error tracking, feedback loops
This phased approach prevents scope creep, eliminates guesswork during implementation, and ensures that projects ship on schedule with production-grade stability.
13. My Development Philosophy
These ten tenets guide how I build software and grow as an engineer:
- Understand before implementing. Understand the real problem before reaching for a framework or writing code.
- Build for maintainability. Code is read far more often than it is written. Optimize for clarity.
- Use modern technologies with purpose. A new library is not an improvement simply because it is trending.
- Server-first development. Keep heavy computation and data fetching on the server; ship minimal JavaScript to the client.
- Design is part of engineering. User experience, typography, and visual consistency matter as much as backend efficiency.
- Security is not optional. Validate all boundaries with Zod, authenticate sessions, and enforce authorization on the server.
- Performance is a feature. Fast sites create better user experiences, boost conversion, and respect user bandwidth.
- Master the fundamentals. Framework trends come and go. Deep understanding of JavaScript, HTTP, SQL, and browser internals endures.
- Automate repetitive workflows. Leverage modern build tools, linting, and AI tooling to accelerate execution without sacrificing quality.
- Keep learning and sharing. The web ecosystem moves quickly. The best engineers continuously learn, build in public, and share knowledge with the developer community.
Conclusion
My Next.js development setup represents how I approach modern full-stack development: combining frontend engineering, backend architecture, database design, authentication, AI integration, and product-oriented UI/UX.
I primarily work within the Next.js, React, and TypeScript ecosystem, but my larger goal is to continuously grow as a software engineer who understands the complete lifecycle of creating and maintaining software products.
For me, becoming a better developer is not about collecting the most libraries. It is about understanding engineering trade-offs, making better architectural decisions, writing reliable code, and delivering products that solve real problems.
Build thoughtfully. Engineer properly. Keep improving.
Written by Urvil Patel — Founder at Utility Solutions & Technical Head at MLSC BVM.
