<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by ajeesh on Medium]]></title>
        <description><![CDATA[Stories by ajeesh on Medium]]></description>
        <link>https://medium.com/@ajeeshRS?source=rss-32ff8f792b35------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8hsf3HaEvcnhUgOE5fudmQ@2x.jpeg</url>
            <title>Stories by ajeesh on Medium</title>
            <link>https://medium.com/@ajeeshRS?source=rss-32ff8f792b35------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:33:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ajeeshRS/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Scaffold Vite React + TailwindCSS v4 in seconds using create-vite-twcss ⚡️]]></title>
            <link>https://medium.com/@ajeeshRS/scaffold-vite-react-tailwindcss-v4-in-seconds-using-create-vite-twcss-%EF%B8%8F-ed7b79313101?source=rss-32ff8f792b35------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed7b79313101</guid>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[tools]]></category>
            <category><![CDATA[vites]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[ajeesh]]></dc:creator>
            <pubDate>Fri, 19 Sep 2025 06:02:08 GMT</pubDate>
            <atom:updated>2025-09-19T06:02:08.971Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0DkJ9lY4gTiSNAUg40CdQ.png" /></figure><p>I recently published a new npm package, <a href="https://www.npmjs.com/package/create-vite-twcss">create-vite-twcss</a>.</p><p>Its purpose is simple: <strong>help developers spin up a modern React project with Vite, TypeScript, and TailwindCSS v4 instantly - </strong>no repetitive setup steps, no wasted time.</p><h3>Why I Built It 💡</h3><p>Every time I started a new project, I found myself doing the same routine:</p><ul><li>Install Vite + React TS</li><li>Set up TailwindCSS</li><li>Clean up boilerplate files</li></ul><p>It wasn’t complicated, just <strong>tedious</strong>. So I packaged the entire process into a CLI tool that saves you those extra minutes.</p><h3>How It Works 🛠️</h3><p>With a single command:</p><pre>npx create-vite-twcss my-app</pre><p>You’ll get:</p><ol><li>A new folder with your project name</li><li>Vite + React + TypeScript boilerplate</li><li>TailwindCSS v4 already configured</li><li>A clean, ready-to-code starter</li></ol><p>In under a minute, you’re ready to build instead of configure.</p><h3>Community Response 🚀</h3><p>What surprised me most was how quickly developers picked it up.</p><p>Within just a couple of days of publishing, the package crossed <strong>456 weekly downloads</strong>.</p><p>It shows that even small utilities that save setup time can make a real impact in the developer workflow.</p><h3>Try It Out 🎉</h3><p>If you’d like to try it:</p><p><a href="https://www.npmjs.com/package/create-vite-twcss">NPM Package: create-vite-twcss</a></p><p>Feedbacks are always welcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed7b79313101" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up a Shared PostgreSQL Database in a Turborepo for Express.js and Next.js Using Prisma]]></title>
            <link>https://medium.com/@ajeeshRS/setting-up-a-shared-postgresql-database-in-a-turborepo-for-express-js-and-next-js-using-prisma-a447d089237f?source=rss-32ff8f792b35------2</link>
            <guid isPermaLink="false">https://medium.com/p/a447d089237f</guid>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[turborepo]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[ajeesh]]></dc:creator>
            <pubDate>Wed, 09 Oct 2024 14:31:35 GMT</pubDate>
            <atom:updated>2024-10-09T14:31:35.573Z</atom:updated>
            <content:encoded><![CDATA[<p>In this guide, we’ll set up a monorepo using Turborepo to share a PostgreSQL database between an Express.js backend and a Next.js frontend. We’ll use Prisma as the ORM to manage database interactions. By the end of this tutorial, you’ll have a monorepo with a shared database setup that you can scale across multiple services.</p><p><strong>Prerequisites:</strong></p><p>• Node.js installed</p><p>• PostgreSQL installed or access to a PostgreSQL database</p><p>• Basic knowledge of TypeScript, Express.js, and Next.js</p><ol><li><strong>Initialize the Monorepo with Turborepo</strong></li></ol><p>Start by creating a new monorepo with Turborepo. Run the following command:</p><pre>npx create-turbo@latest</pre><p>This command will scaffold a Turborepo project with two default apps: a web app (Next.js frontend) and a docs app. Since we won’t need the docs app, go ahead and delete it from the apps folder.</p><p><strong>2. Set Up Express.js Backend</strong></p><p>Inside the apps folder, create a new folder for your Express.js backend. For detailed instructions on setting up an Express.js backend with TypeScript, you can follow <a href="https://medium.com/@me.ajeesh7979/setting-up-a-node-js-typescript-server-with-automatic-restart-dd9212360145">this blog post</a>.</p><p>Once the Express app is set up, move on to configuring the shared database with Prisma.</p><p><strong>3. Set Up Prisma in a Shared Database Package</strong></p><p>Now, let’s create a shared database package that will handle Prisma and PostgreSQL interactions.</p><p>1. Inside the packages folder, create a new folder called database.</p><p>2. Add a package.json file inside packages/database with the following content:</p><pre>{<br>  &quot;name&quot;: &quot;@repo/db&quot;,<br>  &quot;version&quot;: &quot;0.0.0&quot;<br>}</pre><p>3. Install Prisma and the Prisma Client:</p><pre>npm install prisma<br>npm install -D @prisma/client</pre><p>4. Initialize Prisma in the packages/database folder:</p><pre>cd packages/database<br>npx prisma init</pre><p>This will create several files, including schema.prisma and .env.</p><p>5. In the .env file generated by Prisma, add your database connection URL:</p><pre>DATABASE_URL=&quot;YOUR_DB_URL&quot;</pre><p>6. In the schema.prisma file, define a sample schema, like the User model below:</p><pre>model User {<br>  id       Int    @unique @default(autoincrement())<br>  name     String<br>  email    String<br>  password String<br>}</pre><p><strong>4. Add Prisma Scripts to package.json</strong></p><p>Let’s add some useful scripts to manage our Prisma migrations and schema generation.</p><p>In the packages/database/package.json, add the following:</p><pre>{<br>  &quot;scripts&quot;: {<br>    &quot;db:generate&quot;: &quot;prisma generate&quot;,<br>    &quot;db:push&quot;: &quot;prisma db push --skip-generate&quot;<br>  }<br>}</pre><ul><li>db:generate — Generates the Prisma client with the updated schema.</li><li>db:push — Pushes the Prisma schema to your database without generating a new client.</li></ul><p>Run the following command to generate the Prisma client:</p><pre>npm run db:generate</pre><p><strong>5. Configure Turborepo for Prisma</strong></p><p>In the root of your project, open the turbo.json file and add these configurations to manage Prisma tasks:</p><pre>{<br>  &quot;tasks&quot;: {<br>    &quot;db:generate&quot;: {<br>      &quot;cache&quot;: false<br>    },<br>    &quot;db:push&quot;: {<br>      &quot;cache&quot;: false<br>    }<br>  }<br>}</pre><p>This tells Turborepo not to cache the Prisma commands, as the database schema can change frequently.</p><p><strong>6. Set Up Database Exports</strong></p><p>To make the Prisma client available across the entire monorepo, we need to set up exports in our database package.</p><p>1. Inside packages/database, create a new folder called src.</p><p>2. Inside the src folder, create two files: index.ts and index.d.ts.</p><p>In src/index.ts, add the following:</p><pre>export * from &quot;../../../node_modules/.prisma/client&quot;;</pre><p>In src/index.d.ts, add:</p><pre>export * from &quot;../../../node_modules/.prisma/client/index.d&quot;;</pre><p>3. Update the exports field in packages/database/package.json to:</p><pre>{<br>  &quot;exports&quot;: {<br>    &quot;.&quot;: &quot;./src/index.ts&quot;<br>  }<br>}</pre><p><strong>7. Configure TypeScript Paths in the Frontend</strong></p><p>In the Next.js app (located in apps/web), open the tsconfig.json file and add the following path mappings under compilerOptions:</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;paths&quot;: {<br>      &quot;@/*&quot;: [&quot;./*&quot;],<br>      &quot;@prisma/client&quot;: [&quot;@repo/db/client/*&quot;]<br>    },<br>    &quot;baseUrl&quot;: &quot;.&quot;<br>  }<br>}</pre><p>This configuration allows the frontend to resolve and use the shared Prisma client.</p><p><strong>8. Update turbo.json with Development Scripts</strong></p><p>Finally, let’s update the turbo.json file to run the necessary Prisma scripts when starting the development environment:</p><pre>{<br>  &quot;$schema&quot;: &quot;https://turbo.build/schema.json&quot;,<br>  &quot;ui&quot;: &quot;tui&quot;,<br>  &quot;tasks&quot;: {<br>    &quot;dev&quot;: {<br>      &quot;dependsOn&quot;: [&quot;^db:generate&quot;],<br>      &quot;cache&quot;: false,<br>      &quot;persistent&quot;: true<br>    },<br>    &quot;db:generate&quot;: {<br>      &quot;cache&quot;: false<br>    },<br>    &quot;db:push&quot;: {<br>      &quot;cache&quot;: false<br>    },<br>    &quot;build&quot;: {<br>      &quot;dependsOn&quot;: [&quot;^build&quot;, &quot;^db:generate&quot;],<br>      &quot;inputs&quot;: [&quot;$TURBO_DEFAULT$&quot;, &quot;.env*&quot;],<br>      &quot;outputs&quot;: [&quot;.next/**&quot;, &quot;!.next/cache/**&quot;]<br>    },<br>    &quot;lint&quot;: {<br>      &quot;dependsOn&quot;: [&quot;^lint&quot;]<br>    }<br>  }<br>}</pre><p>This configuration ensures that the database schema is generated before the dev or build commands are run.</p><p><strong>9. Use the Shared Database in Your Apps</strong></p><p>To use the shared database in your Express.js or Next.js apps, add @repo/db as a dependency.</p><p>In the app’s package.json, add:</p><pre>{<br>  &quot;dependencies&quot;: {<br>    &quot;@repo/db&quot;: &quot;*&quot;<br>  }<br>}</pre><p>Then, you can import and use Prisma in your application like this:</p><pre>import { PrismaClient } from &quot;@prisma/client&quot;;<br><br>const prisma = new PrismaClient();</pre><p>You’re now ready to use your shared PostgreSQL database across multiple services in your monorepo.</p><p>This setup is a solid foundation for managing a scalable and maintainable codebase, with a shared database accessible to both frontend and backend applications. You can now easily add more apps and services to your monorepo while keeping the database interactions centralized and consistent.</p><p>For reference : <a href="https://github.com/ajeeshRS/monorepo-shared-db">https://github.com/ajeeshRS/monorepo-shared-db</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a447d089237f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a live Node.js Server with TypeScript]]></title>
            <link>https://medium.com/@ajeeshRS/setting-up-a-node-js-typescript-server-with-automatic-restart-dd9212360145?source=rss-32ff8f792b35------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd9212360145</guid>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[express]]></category>
            <dc:creator><![CDATA[ajeesh]]></dc:creator>
            <pubDate>Sat, 05 Oct 2024 19:06:03 GMT</pubDate>
            <atom:updated>2025-01-11T06:00:07.162Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YivGme97D88x5tievYyHsQ.jpeg" /></figure><p>In this guide, we’ll create a <strong>Node.js server</strong> using <strong>TypeScript</strong> that <strong>automatically restarts</strong> whenever changes are made during development. This ensures smooth and fast development cycles.</p><p><strong>Prerequisites</strong></p><p>• <strong>Node.js</strong> installed on your machine.</p><p>Let’s get started!</p><ol><li><strong>Initialize a New Node.js Project</strong></li></ol><p>First, navigate to an empty folder and run:</p><pre>npm init -y</pre><p>This will generate a basic package.json file for your project.</p><p>2. <strong>Set Up TypeScript</strong></p><p>Run the following command to initialize TypeScript and create a tsconfig.json file:</p><pre>npx tsc --init</pre><p>If you don’t have TypeScript installed yet, you can install it by running:</p><pre>npm install -D typescript </pre><p>Alternatively, you can install TypeScript globally with</p><pre>npm install typescript -g</pre><p><strong>3. Install Express</strong></p><p>Next, we need to install <strong>Express</strong>, a minimal and flexible Node.js web application framework:</p><pre>npm install express</pre><p><strong>4. Install Development Dependencies</strong></p><p>• <strong>@types/node</strong>: Type definitions for Node.js.</p><p>• <strong>@types/express</strong>: Type definitions for Express.</p><p>• <strong>nodemon</strong>: Automatically restarts the server when file changes are detected.</p><p>• <strong>concurrently</strong>: Runs multiple commands concurrently.</p><pre>npm install -D @types/node @types/express nodemon concurrently</pre><p><strong>5. Set Up tsconfig.json</strong></p><p>In the tsconfig.json file that was generated in Step 2, update the following two properties:</p><p><strong>rootDir</strong>: Uncomment this and set it to ./src so TypeScript will look for source files in the src folder.</p><p><strong>outDir</strong>: Uncomment this and set it to ./dist so compiled JavaScript files will be output to the dist folder.</p><pre>{<br>  &quot;compilerOptions&quot;: {<br>    &quot;rootDir&quot;: &quot;./src&quot;,  // Source directory<br>    &quot;outDir&quot;: &quot;./dist&quot;,  // Output directory<br>    ...<br>  }<br>}</pre><p><strong>6. Create a Source Folder</strong></p><p>Create a src folder in your project’s root directory:</p><pre>mkdir src</pre><p><strong>7. Write the Basic Express Server</strong></p><p>Inside the src folder, create a file named index.ts and add the following code to set up a basic Express server:</p><pre>import express from &quot;express&quot;;<br><br>const app = express();<br>const port = 3001;<br><br>app.listen(port, () =&gt; {<br>  console.log(`Server running on port ${port}`);<br>});</pre><p><strong>8. Add Development Scripts to package.json</strong></p><p>In your package.json, add the following script under “scripts”:</p><pre>&quot;scripts&quot;: {<br>  &quot;dev&quot;: &quot;concurrently \&quot;tsc --watch\&quot; \&quot;nodemon dist/index.js\&quot;&quot;<br>}</pre><p>Explanation:</p><p>• tsc — watch: Runs TypeScript in watch mode, which continuously compiles TypeScript files from src to dist whenever a change is detected.</p><p>• nodemon dist/index.js: Runs nodemon to watch the compiled JavaScript file (index.js in the dist folder) and automatically restarts the server upon changes.</p><p>The concurrently command ensures that both the TypeScript compiler and nodemon run simultaneously.</p><p><strong>9. To start the server</strong></p><pre>npm run dev</pre><p>Try to make some changes in the file and see the server restarts for every changes.</p><p><em>Hope you find this guide useful!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd9212360145" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying State Management: Setting up Redux in React with JavaScript]]></title>
            <link>https://medium.com/@ajeeshRS/simplifying-state-management-setting-up-redux-in-react-with-javascript-8c118b92c62f?source=rss-32ff8f792b35------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c118b92c62f</guid>
            <category><![CDATA[react-redux]]></category>
            <category><![CDATA[redux-toolkit]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[ajeesh]]></dc:creator>
            <pubDate>Sun, 10 Mar 2024 15:36:57 GMT</pubDate>
            <atom:updated>2024-03-10T15:36:57.868Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*LeUy_JhP_xytSN18HVUIaw.png" /></figure><p>State management is a crucial aspect of building robust and scalable React applications. As applications grow in complexity, managing state becomes increasingly challenging. This is where Redux comes into play. Redux is a predictable state container for JavaScript applications, which helps in managing application state efficiently.</p><p>In this guide, we’ll walk through the process of setting up Redux in a React application using JavaScript. By the end, you’ll have a clear understanding of how Redux works and how to integrate it seamlessly into your React projects.</p><h4>Why Redux?</h4><p>Before diving into the setup process, let’s briefly understand why Redux is a popular choice for managing state in React applications.</p><h4>Predictable State Management</h4><p>Redux follows a strict unidirectional data flow, making it easier to understand how data changes occur within the application. This predictability simplifies debugging and testing, as well as ensures consistency in state management.</p><h4>Centralized State</h4><p>Redux stores the application state in a single JavaScript object called the store. This centralized state enables components to access and update data without passing props through multiple levels of the component tree.</p><ol><li>Setup react (I am using Vite here)</li></ol><pre>npm create vite@latest -- --template react</pre><p>2. Then run</p><pre>cd your-project<br>npm install<br>npm run dev</pre><p>Now you can see your react app running.</p><p>3. Install react-redux and @reduxjs/toolkit</p><pre>npm install react-redux @reduxjs/toolkit</pre><p>These are the 2 packages all we want.</p><p>3. Create a state folder inside the src.</p><p>4. In your state folder create store.js</p><pre> └── 📁src<br>        └── App.css<br>        └── App.jsx<br>        └── 📁assets<br>            └── react.svg<br>        └── index.css<br>        └── main.jsx<br>        └── 📁state<br>            └── store.js</pre><p>5. Inside store.js, Put this code.</p><pre>import { configureStore } from &quot;@reduxjs/toolkit&quot;;<br><br>export const store = configureStore({<br>    reducer:{<br>        <br>    }<br>})</pre><p>This code sets up a Redux store using Redux Toolkit’s configureStore function with an empty reducer.</p><p>6. Then create a folder inside state called slices.And create a counterSlice.js file inside of that.</p><pre>└── 📁state<br>    └── 📁slices<br>        └── counterSlice.js<br>    └── store.js</pre><p>7.Put the below code in the counterSlice.js</p><pre>import { createSlice } from &quot;@reduxjs/toolkit&quot;;<br><br>const initialState = {<br>  value: 0,<br>};<br><br>const counterSlice = createSlice({<br>  name: &quot;counter&quot;,<br>  initialState,<br>  reducers: {<br>    increment: (state) =&gt; {<br>      state.value += 1;<br>    },<br>    decrement: (state) =&gt; {<br>      state.value -= 1;<br>    },<br>  },<br>});<br><br>export const { increment, decrement } = counterSlice.actions;<br>export default counterSlice.reducer;</pre><p>This code defines a Redux slice using Redux Toolkit’s createSlice function. It initializes a simple counter state with an initial value of 0 and defines two reducer functions: increment and decrement. These reducers modify the value field of the state accordingly. The createSlice function automatically generates <strong>action creators</strong> and <strong>reducer functions</strong> based on the specified initial state and reducers. Finally, the code exports the action creators and reducer function for use in other parts of our application.</p><p>8.Wrap App.jsx with Provider component from <em>react-redux. </em>And provide our defined store in the store prop.</p><pre>import React from &quot;react&quot;;<br>import ReactDOM from &quot;react-dom/client&quot;;<br>import App from &quot;./App.jsx&quot;;<br>import &quot;./index.css&quot;;<br>import { Provider } from &quot;react-redux&quot;;<br>import { store } from &quot;./state/store.js&quot;;<br><br>ReactDOM.createRoot(document.getElementById(&quot;root&quot;)).render(<br>  &lt;React.StrictMode&gt;<br>    &lt;Provider store={store}&gt;<br>      &lt;App /&gt;<br>    &lt;/Provider&gt;<br>  &lt;/React.StrictMode&gt;<br>);</pre><p>Now we can access the values and reducers to update it.</p><p>9.Add the below code inside store.js</p><pre>import { configureStore } from &quot;@reduxjs/toolkit&quot;;<br>import counterReducer from &quot;./slices/CounterSlice&quot;;<br><br>export const store = configureStore({<br>    reducer:{<br>        counter:counterReducer<br>    }<br>})</pre><p>In the above code we have imported our counterSlice named counterReducer(as it is a default export, we have the flexibility to name it as we desire). And use it inside the reducer like that.</p><p>We’ve completed our Redux setup, so now let’s explore how we can interact with it.</p><p>10.Put the below code into App.jsx</p><pre>import { useDispatch, useSelector } from &quot;react-redux&quot;;<br>import &quot;./App.css&quot;;<br>import { decrement, increment } from &quot;./state/slices/CounterSlice&quot;;<br><br>function App() {<br>  const count = useSelector((state) =&gt; state.counter.value);<br>  const dispatch = useDispatch();<br>  return (<br>    &lt;&gt;<br>      &lt;div&gt;<br>        &lt;h1&gt;Count:{count}&lt;/h1&gt;<br>        &lt;button onClick={() =&gt; dispatch(increment())}&gt;Increase&lt;/button&gt;<br>        &lt;button onClick={() =&gt; dispatch(decrement())}&gt;Decrease&lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/&gt;<br>  );<br>}<br><br>export default App;</pre><p>The above code utilizes hooks provided by react-redux, namely useSelector and useDispatch, to interact with the Redux store. The useSelector hook is used to select the counter state from the Redux store, and the selected count value is displayed in the UI. Two buttons are rendered to increment and decrement the count value. When clicked, these buttons dispatch corresponding actions (increment or decrement) to the Redux store using the useDispatch hook.</p><p>In conclusion, By centralizing the application’s state in a single store and utilizing reducers and actions, Redux simplifies state management and promotes predictable data flow throughout the application. The use of Redux Toolkit further streamlines the process with utilities like createSlice for defining slices of state and associated reducers, enhancing developer productivity. I believe that with this reading, all of you are now able to use Redux confidently and effectively in your React projects, making state management a breeze!</p><p>Thank you for reading :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c118b92c62f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>