这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@MRdevX
Copy link

@MRdevX MRdevX commented Aug 22, 2025

Description

This PR adds a comprehensive Next.js + NestJS + ShadCN template to the Turborepo examples, showcasing a modern full-stack monorepo architecture with the latest technologies and best practices.

🎯 What's Included

Full-Stack Architecture:

  • Next.js 15 frontend with App Router and TypeScript
  • NestJS backend with decorators and dependency injection
  • ShadCN UI components with Tailwind CSS v4
  • Turborepo for high-performance monorepo management

Key Features:

  • Tailwind CSS v4 with CSS-first configuration and automatic scanning
  • Shared UI components via @repo/ui package with ShadCN
  • Shared API types via @repo/api package with DTOs and entities
  • Shared configurations for ESLint, TypeScript, and Jest
  • Production-ready build pipeline with Turborepo caching
  • Modern development experience with hot reloading and type safety

Project Structure:

├── apps/
│   ├── web/          # Next.js frontend
│   └── api/          # NestJS backend
├── packages/
│   ├── ui/           # ShadCN UI components
│   ├── api/          # Shared DTOs and entities
│   ├── eslint-config/ # Shared ESLint config
│   ├── typescript-config/ # Shared TypeScript config
│   └── jest-config/  # Shared Jest config

UI Components Included:

  • Button (multiple variants and sizes)
  • Card (with header, content, footer)
  • Input (form inputs)
  • Badge (status indicators)

Technical Highlights:

  • Tailwind CSS v4 with @theme directives and @source scanning
  • CSS-first configuration - no tailwind.config.js needed
  • Automatic dark mode support
  • Type-safe component library with proper exports
  • Optimized builds with Turborepo's incremental caching

🖼️ Screenshots

The template includes a beautiful demo page showcasing:

  • Clean, modern design with ShadCN components
  • Responsive layout with Tailwind CSS
  • Interactive component examples
  • Professional landing page layout

Screenshot_22-8-2025_155527_localhost

Testing Instructions

Prerequisites

  • Node.js 20+
  • pnpm 8+

Quick Start

# Clone and setup
git clone <repo-url>
cd examples/with-nestjs-nextjs-shadcn
pnpm install

# Start development servers
pnpm dev

What to Test

  1. Development Experience:

  2. UI Components:

    • Visit http://localhost:3000
    • Verify all ShadCN components render correctly
    • Test responsive design on different screen sizes
    • Check that Tailwind CSS v4 styles are applied
  3. Build System:

    # Test builds
    pnpm build
    pnpm lint
    pnpm typecheck
  4. Monorepo Features:

    • Verify shared packages work (@repo/ui, @repo/api)
    • Test Turborepo caching (second build should be faster)
    • Check that changes in shared packages trigger rebuilds
  5. Component Library:

    # Test adding new ShadCN components
    cd apps/web
    npx shadcn@latest add dialog

Expected Results

  • ✅ Clean, modern UI with proper styling
  • ✅ Fast development server startup
  • ✅ Shared components work across apps
  • ✅ TypeScript compilation without errors
  • ✅ ESLint passes without warnings
  • ✅ Builds complete successfully with caching

This template serves as a starting point for full-stack applications using modern web technologies and Turborepo's powerful monorepo capabilities.

@MRdevX MRdevX requested a review from a team as a code owner August 22, 2025 14:00
@turbo-orchestrator turbo-orchestrator bot added area: examples Improvements or additions to examples needs: triage labels Aug 22, 2025
@vercel
Copy link
Contributor

vercel bot commented Aug 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
examples-basic-web Ready Ready Preview Comment Aug 22, 2025 2:00pm
examples-designsystem-docs Ready Ready Preview Comment Aug 22, 2025 2:00pm
examples-tailwind-web Ready Ready Preview Comment Aug 22, 2025 2:00pm
examples-vite-web Ready Ready Preview Comment Aug 22, 2025 2:00pm

@vercel
Copy link
Contributor

vercel bot commented Aug 22, 2025

@MRdevX is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

@vercel vercel bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Comments:

examples/with-nestjs-nextjs-shadcn/packages/ui (lines 1-1):

The UI package contains duplicate ESLint configuration files which can cause conflicts and confusion.

View Details
📝 Patch Details
diff --git a/examples/with-nestjs-nextjs-shadcn/packages/ui/eslint.config.js b/examples/with-nestjs-nextjs-shadcn/packages/ui/eslint.config.js
deleted file mode 100644
index fe059de7f..000000000
--- a/examples/with-nestjs-nextjs-shadcn/packages/ui/eslint.config.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import { config } from '@repo/eslint-config/react-internal';
-
-/** @type {import("eslint").Linter.Config} */
-export default config;

Analysis

The packages/ui directory contains both eslint.config.js and eslint.config.mjs files with identical content. Having duplicate configuration files can lead to:

  1. Confusion about which configuration is actually being used
  2. Potential conflicts if they diverge in the future
  3. Maintenance overhead of keeping both files in sync
  4. Inconsistency with the rest of the monorepo structure

ESLint will typically use the first configuration file it finds based on its resolution order, but having both files present makes the setup unclear and potentially error-prone.


Recommendation

Remove one of the duplicate ESLint configuration files. Since the project appears to use ES modules (indicated by the .mjs extension usage elsewhere), keep eslint.config.mjs and delete eslint.config.js.

Alternatively, if CommonJS is preferred, keep eslint.config.js and delete eslint.config.mjs.

import { ThemeProvider as NextThemesProvider } from "next-themes";

interface ProvidersProps {
children: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
children: any;
children: React.ReactNode;

The children prop in ProvidersProps interface is typed as any instead of proper React types, reducing type safety.

View Details

Analysis

The ProvidersProps interface defines the children prop as any, which defeats the purpose of TypeScript's type checking. This removes type safety and can lead to runtime errors if incorrect values are passed as children.

The correct type for React children should be React.ReactNode, which properly represents any valid React child element including strings, numbers, JSX elements, arrays, fragments, and null/undefined values.

Using any also means developers won't get proper IntelliSense suggestions and type checking when using this component.


Recommendation

Update the interface to use proper React types:

interface ProvidersProps {
  children: React.ReactNode;
}

This provides proper type safety while accepting all valid React children types.

Comment on lines +1 to +4
import { Link } from 'links/entities/link.entity';

import { CreateLinkDto } from 'links/dto/create-link.dto';
import { UpdateLinkDto } from 'links/dto/update-link.dto';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import paths are missing the required ./ prefix for relative imports in the shared API package index file.

View Details

Analysis

The imports in packages/api/src/index.ts are using relative paths without the proper ./ prefix. TypeScript and Node.js require relative imports to start with ./ or ../ to distinguish them from node_modules imports. The current imports 'links/entities/link.entity' and 'links/dto/create-link.dto' should be './links/entities/link.entity' and './links/dto/create-link.dto' respectively.

This will cause TypeScript compilation errors when the package is built, as the module resolver won't be able to find these files. The error would typically be "Cannot find module 'links/entities/link.entity'" or similar.


Recommendation

Update the import statements to use proper relative paths:

import { Link } from './links/entities/link.entity';

import { CreateLinkDto } from './links/dto/create-link.dto';
import { UpdateLinkDto } from './links/dto/update-link.dto';

@anthonyshew
Copy link
Contributor

anthonyshew commented Aug 29, 2025

Hey, @MRdevX, thanks for the PR!

According to our examples guidelines, we try to keep examples scoped to one technology at a time. The combination of Nest.js and ShadCN shown here is great, but not scoped in such a way that I'll be able to take this PR.

Seeing as we already have a Nest.js example and docs for shadcn/ui that point to the official example, I'm going to close this PR. Thanks again for contributing and we welcome you back to contribute again as soon as you'd like!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: examples Improvements or additions to examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants