<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: CodeForStartUp</title>
    <description>The latest articles on DEV Community by CodeForStartUp (@codeforstartup).</description>
    <link>https://dev.to/codeforstartup</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F892916%2F16e6dde7-33b5-44c0-ae60-05d3432b52dd.png</url>
      <title>DEV Community: CodeForStartUp</title>
      <link>https://dev.to/codeforstartup</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/codeforstartup"/>
    <language>en</language>
    <item>
      <title>[4][DEV NOTE] NextJS server actions and Prisma</title>
      <dc:creator>CodeForStartUp</dc:creator>
      <pubDate>Mon, 04 Sep 2023 02:36:52 +0000</pubDate>
      <link>https://dev.to/codeforstartup/4dev-note-nextjs-action-and-prisma-ee</link>
      <guid>https://dev.to/codeforstartup/4dev-note-nextjs-action-and-prisma-ee</guid>
      <description>&lt;p&gt;Server actions&lt;/p&gt;

&lt;h2&gt;
  
  
  React Hook Form
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Create
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Get
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Update
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Delete
&lt;/h2&gt;

</description>
      <category>nextjs</category>
      <category>prisma</category>
      <category>react</category>
      <category>typescript</category>
    </item>
    <item>
      <title>[3][DEV NOTE] Create a form with tiptap and react-textarea-autosize</title>
      <dc:creator>CodeForStartUp</dc:creator>
      <pubDate>Mon, 04 Sep 2023 02:04:18 +0000</pubDate>
      <link>https://dev.to/codeforstartup/3dev-note-create-a-form-with-tiptap-and-react-textarea-autosize-1cgn</link>
      <guid>https://dev.to/codeforstartup/3dev-note-create-a-form-with-tiptap-and-react-textarea-autosize-1cgn</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This is dev note for this project: &lt;a href="https://github.com/CodeForStartup/nextjs-prisma-postgres/"&gt;turbo - nextjs - prisma - postgres blog&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Target of this part: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Integrate shadcn-ui &lt;/li&gt;
&lt;li&gt;Minor update for postcss and tailwindcss&lt;/li&gt;
&lt;li&gt;Create a form with react-textarea-autosize and tiptap&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Integrate &lt;code&gt;shadcn-ui&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;shadcn-ui&lt;/code&gt; is one of the most famous UI libraries now. So that I decide to integrate with my project. &lt;br&gt;
Just a simple command we can integrate shadcn as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd app/web
npx shadcn-ui@latest init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After initial shadcn-ui, we can see a lot of changes as this commit: &lt;a href="https://github.com/CodeForStartup/nextjs-prisma-postgres/pull/7/commits/4680a69bb72ce4c227e5c4ffd76f8a47a8d8f129"&gt;Initial shadcn-ui&lt;br&gt;
&lt;/a&gt;.&lt;br&gt;
These are some important changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;tailwind.config.js&lt;/code&gt; and &lt;code&gt;globals.css&lt;/code&gt; are overrided&lt;/li&gt;
&lt;li&gt;folded &lt;code&gt;@/&lt;/code&gt; is added&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Install &lt;code&gt;react-textarea-autosize&lt;/code&gt; and &lt;code&gt;tiptap&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;In the root folder, we will install: &lt;code&gt;react-textarea-autosize&lt;/code&gt;, and &lt;code&gt;tip-tap&lt;/code&gt; as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm add react-textarea-autosize --filter web
pnpm add @tiptap/extension-character-count @tiptap/extension-highlight @tiptap/extension-placeholder @tiptap/extension-task-item @tiptap/extension-task-list @tiptap/pm @tiptap/react @tiptap/starter-kit --filter web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I aslo will use &lt;code&gt;remixicon&lt;/code&gt; for icons:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm add remixicon --filter web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Update post-css and tailwindcss
&lt;/h3&gt;

&lt;p&gt;PostCss for build-time imports and postcss-nesting for nested declarations:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm add -D postcss-nesting postcss-import
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add Input title with &lt;code&gt;react-textarea-autosize&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;apps/web/@/molecules/InputTitle.tsx&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import TextareaAutosize from "react-textarea-autosize";

type InputTitleProps = {
  title?: string;
  placeholder?: string;
};

const InputTitle: React.FunctionComponent&amp;lt;InputTitleProps&amp;gt; = ({
  title = "",
  placeholder = "",
}) =&amp;gt; {
  return (
    &amp;lt;div className="w-full"&amp;gt;
      &amp;lt;TextareaAutosize
        autoFocus
        value={title}
        placeholder={placeholder}
        className="w-full h-16 px-3 py-2 text-4xl font-bold text-gray-700 border-none placeholder-gray-500 border border-gray-300 rounded-md focus:outline-none"
      /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};

export default InputTitle;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Add &lt;code&gt;tiptap&lt;/code&gt; to nextjs
&lt;/h2&gt;

&lt;p&gt;To integrate tip to nextjs we need to have many step, you can  refer in &lt;code&gt;apps/web/@/molecules/Editor&lt;/code&gt; folder,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;apps/web/@/molecules/Editor/index.tsx&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import React from "react";

import CharacterCount from "@tiptap/extension-character-count";
import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Placeholder from "@tiptap/extension-placeholder";

import "./index.css";
import MenuBar from "./MenuBar";

type EditorProps = {
  content?: string;
  placeholder?: string;
};

export default ({ content = "", placeholder = "" }: EditorProps) =&amp;gt; {
  const editor = useEditor({
    extensions: [
      StarterKit,
      CharacterCount.configure({
        limit: 10000,
      }),
      Placeholder.configure({
        placeholder,
      }),
    ],
    content,
  });

  return (
    &amp;lt;div className="w-full editor p-3 h-full"&amp;gt;
      {editor &amp;amp;&amp;amp; &amp;lt;MenuBar editor={editor} /&amp;gt;}
      &amp;lt;EditorContent editor={editor} /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Create post page
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;apps/web/app/user/post/create/page.tsx&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"use client";

import React from "react";

import CharacterCount from "@tiptap/extension-character-count";
import { EditorContent, useEditor } from "@tiptap/react";
import StarterKit from "@tiptap/starter-kit";
import Placeholder from "@tiptap/extension-placeholder";

import "./index.css";
import MenuBar from "./MenuBar";

type EditorProps = {
  content?: string;
  placeholder?: string;
};

export default ({ content = "", placeholder = "" }: EditorProps) =&amp;gt; {
  const editor = useEditor({
    extensions: [
      StarterKit,
      CharacterCount.configure({
        limit: 10000,
      }),
      Placeholder.configure({
        placeholder,
      }),
    ],
    content,
  });

  return (
    &amp;lt;div className="w-full editor p-3 h-full"&amp;gt;
      {editor &amp;amp;&amp;amp; &amp;lt;MenuBar editor={editor} /&amp;gt;}
      &amp;lt;EditorContent editor={editor} /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reference:
&lt;/h2&gt;

&lt;p&gt;[1] Tiptap: I follow this example &lt;a href="https://tiptap.dev/examples/collaborative-editing"&gt;collaborative-editing&lt;/a&gt;&lt;br&gt;
[2] react-textarea-autosize: Quite simple, just follow the example &lt;a href="https://www.npmjs.com/package/react-textarea-autosize"&gt;here&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://tailwindcss.com/docs/using-with-preprocessors#nesting"&gt;Post css preprocessor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can find the result in this PR: &lt;a href="https://github.com/CodeForStartup/nextjs-prisma-postgres/pull/7/files"&gt;[feat][UI] Create post page&lt;/a&gt;&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>nextjs</category>
      <category>themes</category>
      <category>react</category>
    </item>
    <item>
      <title>[2][DEV NOTE] Integrate prisma and postgres database</title>
      <dc:creator>CodeForStartUp</dc:creator>
      <pubDate>Tue, 22 Aug 2023 14:33:04 +0000</pubDate>
      <link>https://dev.to/codeforstartup/2dev-note-add-prisma-and-postgres-database-2m84</link>
      <guid>https://dev.to/codeforstartup/2dev-note-add-prisma-and-postgres-database-2m84</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This is dev note for this project: &lt;a href="https://github.com/CodeForStartup/nextjs-prisma-postgres"&gt;turbo - nextjs - prisma - postgres blog&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://dev.to/codeforstartup/dev-note-initial-turbo-project-and-add-tailwindcss-library-4iae/edit"&gt;[1][DEV NOTE] Initial turbo project and add tailwindcss library&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add prisma by add new &lt;code&gt;database&lt;/code&gt; package&lt;/li&gt;
&lt;li&gt;Docker postgres database&lt;/li&gt;
&lt;li&gt;Import and use &lt;code&gt;database&lt;/code&gt; package inside &lt;code&gt;web&lt;/code&gt; app &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Environment
&lt;/h2&gt;

&lt;p&gt;In this project, I will use postgres database. I used docker to install postgres database on my local machine as follow:&lt;br&gt;
Create &lt;code&gt;docker-compose.yml&lt;/code&gt; in the root folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use postgres/example user/password credentials
version: "3.1"

services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_PASSWORD: example
    ports:
      - 5432:5432

  adminer:
    image: adminer
    restart: always
    ports:
      - 8080:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's including postgres database and adminer.&lt;/p&gt;

&lt;p&gt;In the next sections, I mainly follow this tutorial: &lt;a href="https://turbo.build/repo/docs/handbook/tools/prisma"&gt;Using Prisma with Turborepo&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So that you can skip this part :]]]&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Create &lt;code&gt;database&lt;/code&gt; package
&lt;/h2&gt;

&lt;p&gt;Create &lt;code&gt;packages/database/package.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "database",
  "version": "0.0.0",
  "dependencies": {
    "@prisma/client": "latest"
  },
  "devDependencies": {
    "prisma": "latest"
  },
  "scripts": {
    "db:generate": "prisma generate",
    "db:push": "prisma db push --skip-generate"
  },
  "main": "./index.ts",
  "types": "./index.ts"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;packages/database/index.ts&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export * from "@prisma/client";

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;packages/database/prisma/schema.prisma&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model Post {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String   @db.VarChar(255)
  content   String?
  published Boolean  @default(false)
  author    User     @relation(fields: [authorId], references: [id])
  authorId  Int
}

model Profile {
  id     Int     @id @default(autoincrement())
  bio    String?
  user   User    @relation(fields: [userId], references: [id])
  userId Int     @unique
}

model User {
  id      Int      @id @default(autoincrement())
  email   String   @unique
  name    String?
  posts   Post[]
  profile Profile?
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;packages/database/.gitignore&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node_modules
# Keep environment variables out of version control
.env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Important: You need to update the DATABASE_URL variable in your .env file example.&lt;/p&gt;

&lt;h2&gt;
  
  
  Run prisma init
&lt;/h2&gt;

&lt;p&gt;cd to database package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd packages/database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, it will generate these files:&lt;/p&gt;

&lt;p&gt;packages/database/.gitignore&lt;br&gt;
packages/database/prisma/schema.prisma&lt;br&gt;
packages/database/.env&lt;/p&gt;
&lt;h2&gt;
  
  
  Add database's scripts to turbo.json
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "$schema": "https://turbo.build/schema.json",
  "globalDependencies": ["**/.env.*local"],
  "pipeline": {
    "build": {
      "dependsOn": ["^db:generate", "^build"],
      "outputs": [".next/**", "!.next/cache/**"]
    },
    "lint": {},
    "dev": {
      "dependsOn": ["^db:generate"],
      "cache": false,
      "persistent": true
    },
    "db:generate": {
      "cache": false
    },
    "db:push": {
      "cache": false
    },
    "db:migrate": {
      "cache": false
    }
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then we can migrate the database as follow&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;turbo db:migrate -- --name init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After run this command line, &lt;code&gt;prisma&lt;/code&gt; will generate a &lt;code&gt;migration.sql&lt;/code&gt; file and create a database in the postgres.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install &lt;code&gt;packages/database&lt;/code&gt; into &lt;code&gt;web&lt;/code&gt; app
&lt;/h2&gt;

&lt;p&gt;Like part 1, we can install &lt;code&gt;packages/database&lt;/code&gt; into &lt;code&gt;web&lt;/code&gt; app by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pnpm add --save-dev database@workspace --fitler web
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this time, we installed &lt;code&gt;prisma&lt;/code&gt; and configured &lt;code&gt;database&lt;/code&gt; packaged successfully. &lt;br&gt;
Now we continue to next part: Read/Write data with &lt;code&gt;prisma&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Finally
&lt;/h2&gt;

&lt;p&gt;Now, you can import and use Prisma in the web app:&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { PrismaClient } from "database";

export default async function Page() {
  const prisma = new PrismaClient();

  const allPosts = await prisma.post.findMany();

  return (
    &amp;lt;div className="h-full flex justify-center items-center"&amp;gt;
      &amp;lt;h1 className="text-5xl font-extrabold text-transparent bg-clip-text bg-gradient-to-br from-pink-400 to-red-600"&amp;gt;
        CODE FOR STARTUP.
      &amp;lt;/h1&amp;gt;

      {allPosts.map((post) =&amp;gt; (
        &amp;lt;div key={post.id}&amp;gt;{post.title}&amp;lt;/div&amp;gt;
      ))}
    &amp;lt;/div&amp;gt;
  );
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next part, I will implement the creating and listing posts with Prisma.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;[1] Mainly on this tutorial: &lt;a href="https://turbo.build/repo/docs/handbook/tools/prisma"&gt;Using Prisma with Turborepo&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://www.prisma.io/docs/getting-started"&gt;Prisma getting started&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>prisma</category>
      <category>typescript</category>
      <category>postgres</category>
    </item>
    <item>
      <title>[1][DEV NOTE] Initial turbo project and add tailwindcss library</title>
      <dc:creator>CodeForStartUp</dc:creator>
      <pubDate>Tue, 22 Aug 2023 12:58:17 +0000</pubDate>
      <link>https://dev.to/codeforstartup/dev-note-initial-turbo-project-and-add-tailwindcss-library-4iae</link>
      <guid>https://dev.to/codeforstartup/dev-note-initial-turbo-project-and-add-tailwindcss-library-4iae</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;This is dev note for this project: &lt;a href="https://github.com/CodeForStartup/nextjs-prisma-postgres"&gt;turbo - nextjs - prisma - postgres blog&lt;br&gt;
&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prepare environments
&lt;/h2&gt;

&lt;p&gt;ENV: node v16.20.1&lt;br&gt;
In this project, I use pnpm. So that we need to install pnpm by:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install pnpm -g&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Init project
&lt;/h2&gt;

&lt;p&gt;Firstly, we need to create project by this command:&lt;br&gt;
&lt;code&gt;pnpm dlx create-turbo@lasted&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Enter project name: "codeforstartup" &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NzWdbY_a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/scfl44pfe0o8r62zi8ce.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NzWdbY_a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/scfl44pfe0o8r62zi8ce.png" alt="Create turbo project" width="800" height="626"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Start project
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;turbo dev&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Add &lt;code&gt;tailwindcss&lt;/code&gt;
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Add &lt;code&gt;tailwind-config&lt;/code&gt; package
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Under &lt;code&gt;packages&lt;/code&gt; folder, create &lt;code&gt;tailwind-config&lt;/code&gt; folder.
&lt;/li&gt;
&lt;li&gt;Under &lt;code&gt;tailwind-config&lt;/code&gt; folder create:
File &lt;code&gt;packages/tailwind-config/package.json&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "tailwind-config",
  "version": "0.0.0",
  "private": true,
  "main": "index.js",
  "devDependencies": {
    "tailwindcss": "^3.2.4"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;File &lt;code&gt;packages/tailwind-config/tailwind.config.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const colors = require("tailwindcss/colors");

module.exports = {
    content: [
        // app content
        "./app/**/*.{js,ts,jsx,tsx}"
        // include packages if not transpiling
        // "../../packages/**/*.{js,ts,jsx,tsx}",
    ],
    theme: {
        extend: {},
    },
    plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nice. You added &lt;code&gt;tailwind-config&lt;/code&gt; successfully. Now we need to install it by:&lt;br&gt;
&lt;code&gt;pnpm install&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Install &lt;code&gt;tailwindcss&lt;/code&gt; and &lt;code&gt;tailwind-config&lt;/code&gt; for web app
&lt;/h3&gt;

&lt;p&gt;To config tailwindcss for web app, we need to install following package:&lt;br&gt;
&lt;code&gt;pnpm add tailwindcss postcss autoprefixer --filter web&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To install tailwind-config package for web, we can use this command:&lt;br&gt;
&lt;code&gt;pnpm add --save-dev tailwind-config@workspace --filter web&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;apps/web/postcss.config.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
    plugins: {
        tailwindcss: {},
        autoprefixer: {},
    },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;apps/web/tailwind.config.js&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const sharedConfig = require("tailwind-config/tailwind.config.js");

module.exports = {
    presets: [sharedConfig],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create &lt;code&gt;apps/web/app/global.css&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@tailwind base;
@tailwind components;
@tailwind utilities;

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;apps/web/app/layout.tsx&lt;/code&gt;, import this line:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import "./global.css";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, we install tailwind css successfully for turbo project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;[1] For more detail, you can referent this Pull request: &lt;a href="https://github.com/CodeForStartup/nextjs-prisma-postgres/pull/4"&gt;[feat] Add tailwind css package&lt;/a&gt;&lt;br&gt;
[2] &lt;a href="https://github.com/vercel/turbo/tree/main/examples/with-tailwind"&gt;Turbo official example&lt;/a&gt;&lt;br&gt;
[3] &lt;a href="https://turbo.build/repo/docs/getting-started/create-new"&gt;Create new turbo project&lt;/a&gt;&lt;br&gt;
[4] &lt;a href="https://turbo.build/repo/docs/handbook/package-installation"&gt;Install package for turbo project&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>tailwindcss</category>
      <category>turbopack</category>
      <category>react</category>
    </item>
  </channel>
</rss>
