<?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 Ali on Medium]]></title>
        <description><![CDATA[Stories by Ali on Medium]]></description>
        <link>https://medium.com/@aliairf92?source=rss-659412b6ad73------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Ali on Medium</title>
            <link>https://medium.com/@aliairf92?source=rss-659412b6ad73------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 08:46:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aliairf92/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[What happen when user type URL in browser. What happened internally.]]></title>
            <link>https://medium.com/@aliairf92/what-happen-when-user-type-url-in-browser-what-happened-internally-3f2f75e90fe7?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f2f75e90fe7</guid>
            <category><![CDATA[https]]></category>
            <category><![CDATA[dns]]></category>
            <category><![CDATA[networking]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Mon, 03 Aug 2026 16:03:55 GMT</pubDate>
            <atom:updated>2026-08-03T16:03:55.570Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*BY4iKtl-twJBbbCmhE7lVA.jpeg" /></figure><h3>The Full Journey — From URL to Website</h3><h4><strong>step 1</strong>: You Type “<a href="https://www.linkedin.com/safety/go/?url=https%3A%2F%2Fexample%2Ecom&amp;urlhash=P04_&amp;mt=CHucWRjgs_dD51hgSK1gxnuz3Rc1wjBRvuxW2SVlIy1ER8c0RpxKWDgI5sD9FFBn-NhJJgMrwMefGi01TamXcz7U2gMQGh-iZzoKna4gYXGrZmovrlMqBZ9vN2o&amp;isSdui=true">https://www.example.com</a>&quot;</h4><h4><strong>Step 2:</strong> Browser Checks Its Cache:</h4><p>Before asking anyone else, the browser checks:</p><p><strong>1. Browser cache:</strong> Did I visit this URL before?</p><p><strong>2. OS cache: </strong>Did the operating System save the IP address?</p><p><strong>3. Router cache:</strong> Did my home router remember this?</p><p>If found in cache → skip to<strong> Step 5</strong></p><h4><strong>Step 3:</strong> DNS(Domain Name System) Lookup</h4><p>The browser ask DNS server:</p><p>“Hey, what’s the <strong>IP address </strong>for <a href="https://www.linkedin.com/safety/go/?url=http%3A%2F%2Fexample%2Ecom&amp;urlhash=xpOf&amp;mt=FMIinnilQrz7HIDSvCkWgHDf-AUHGDKvnBPc7JA41w_fxxw2-lfvvUqvESOstmme31k6wXdjSKDSXDWFGqCtfBf_9dOol6ilk2c92OY7RogSKTrgcbwfhQRmTa4&amp;isSdui=true">example.com</a>”</p><p><strong>DNS Response: “</strong><a href="https://www.linkedin.com/safety/go/?url=http%3A%2F%2F92%2E183%2E217%2E32&amp;urlhash=XCOB&amp;mt=oq4s9NfZLZd4AnZeKFzcrBcEZJUvAKDJ8ERObw4fvm1bohLcpmwringvA8ST_SDbMIV6P7S_uV0UIla1EGfCygKqhWVEIrEUT3fljfr5flc4oYsTEUFn1JeeHus&amp;isSdui=true"><strong>92.183.217.32</strong></a><strong>”</strong></p><h4>But how it works internally:</h4><ul><li>Browser ask Local DNS (your ISP server).</li><li>if it doesn’t know , it ask Root DNS servers.</li><li>Root says: “Ask the .com TLD server”.</li><li>.com server says: “Ask “<a href="https://www.linkedin.com/safety/go/?url=http%3A%2F%2Fexample%2Ecom&amp;urlhash=xpOf&amp;mt=aoizDgZwKvWXf7QDcVEsyumaNu-6rcwqVK_gmIujCncoXSBlXdjN9se3aDnHMrVVmep-JLl8r6Af8008FlDMx2dfuEnn-VCLXoEcdrNsUL09vKmE-yQOQOga7t0&amp;isSdui=true">example.com</a>” authoritative server.</li><li>Authoritative server responds: “<a href="https://www.linkedin.com/safety/go/?url=http%3A%2F%2F92%2E183%2E217%2E32&amp;urlhash=XCOB&amp;mt=qaR_6Qdx9iQMlH3G4R463tu5PG5qK7TnSgUKQHCig-eS8q_ES1QBVYROamXWezzUzWXfzUMhPDbF_iEOPLJGi3Wo_lg2kApuhbMnb31Q0PM11F92g-q3N_tlS4M&amp;isSdui=true">92.183.217.32</a>”.</li></ul><h4><strong>Step 4:</strong> Browser Now Has the IP Address.</h4><h4><strong>Step 5:</strong> TCP Connection (Transmission Control Protocol) — The Handshake.</h4><p>Browser says: “I want to connect to <a href="https://www.linkedin.com/safety/go/?url=http%3A%2F%2F92%2E183%2E217%2E32&amp;urlhash=XCOB&amp;mt=t2-7bNDLN7M1XnWdWivlxKwrHQtETLaQYVwyYga3xokdXFiXLgld-5p1nhINKQV3x9eD2gpLSh18PN1W7c5ftu7qDKYlaFhgwRTQQQgrMoDX2vYjUZ-g4Vluqpc&amp;isSdui=true"><strong>92.183.217.32</strong></a><strong> </strong>on port 443 (for HTTPS)”</p><p>This is the 3-way handshake:</p><ol><li>SYN- Client asks to connect.</li><li>SYN-ACK — Server acknowledges.</li><li>ACK — Client confirms</li></ol><h4>Step 6: SSL(Secure Socket Layer) /TLS(Transport Layer Security) Handshake (For HTTPS):</h4><p><strong>Browser and server agree on encryption:</strong></p><ol><li>Client says: I support TLS 1.3.<br>2. Server sends its SSL certificate (proves identity).<br>3. Client verify certificate.<br>4. Both agree on encryption keys.</li></ol><h4>Step 7: HTTP Request:</h4><p>The client sends an HTTP request:</p><p>Request contains:<br>- Method: GET, POST, PUT, DELETE, etc.<br>- Headers: Metadata (auth tokens, content type, cookies)<br>- Body: Data (for POST/PUT requests)</p><h4>Step 8: Server Response</h4><p>server receive the request and prepare the response.</p><h4>Step 9:Browser Renders the Page</h4><p>Browser/App receives and processes:</p><p>1. Parses HTML<br>2. Requests CSS, JavaScript, images<br>3. Executes JavaScript<br>4. Renders the visual page<br>5. User sees the website</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f2f75e90fe7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Client-Server Architecture:]]></title>
            <link>https://medium.com/@aliairf92/client-server-architecture-f8759a8314fb?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8759a8314fb</guid>
            <category><![CDATA[client-server-architeture]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 06:58:38 GMT</pubDate>
            <atom:updated>2026-07-31T06:58:38.765Z</atom:updated>
            <content:encoded><![CDATA[<p>Client-server architecture is a network model in which two main entities — clients and servers — communicate with each other to complete specific tasks or share data.</p><h4><strong>Client</strong>:</h4><p>The client send requests, waits for the server response and displays it to the user. For example, a web browser acts as a client when it requests a website.</p><h4>Server:</h4><p>The server processes these requests, retrieves the relevant information, and sends it back to the client. For example, a web server responds with website data when a browser requests it.</p><h3>Types of Client-Server Architecture:</h3><h4>- Two-Tier Architecture:</h4><p>The simplest form where clients and servers communicate directly.</p><p>Illustrates direct communication between a client and server, where the client sends a request, and the server processes and responds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*rzDjuPgJeffegMg8d3O5xg.webp" /></figure><h4>Three-Tier Architecture:</h4><p>A middleware layer, often called the application layer, is added between the client and server.</p><p>Adds an intermediary middleware layer, handling business logic or complex database queries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*BzPXo4SUI32I_-q97Ywt-w.png" /></figure><h3>Drawbacks of Client-Server Architecture:</h3><ul><li>Single Point of Failure: If the server goes down, all connected clients lose access to data and services.</li><li>Network Dependency: Since the model relies on network communication, poor connectivity can lead to performance issues.</li></ul><h3>Advantages of Client-Server Architecture:</h3><ul><li>Centralized Control: Servers can handle multiple clients simultaneously, allowing for centralized management of resources and data.</li><li>Scalability: The architecture is scalable, allowing developers to add more clients or servers as needed without affecting the entire system.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8759a8314fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Redux Saga Scared Me. Then I Built User Search and Everything Clicked4]]></title>
            <link>https://medium.com/@aliairf92/redux-saga-scared-me-then-i-built-user-search-and-everything-clicked4-c446737c88f5?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/c446737c88f5</guid>
            <category><![CDATA[redux-saga]]></category>
            <category><![CDATA[what-is-redux-saga]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Fri, 29 May 2026 12:19:52 GMT</pubDate>
            <atom:updated>2026-05-29T12:19:52.232Z</atom:updated>
            <content:encoded><![CDATA[<p>How I finally understood Redux Saga by coming from Redux Toolkit — with real code, zero confusion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*OhR7S7_SFPiNOLbyGAneAw.png" /></figure><p>Let me be honest with you.</p><p>The first time I opened the Redux Saga docs, I closed the tab within five minutes. Generator functions? Effects? Watchers and workers? It felt like a completely different language compared to the clean, simple Redux Toolkit I already knew.</p><p>But then my team’s project required it. I had no choice.</p><p>So I sat down, stopped trying to read the docs top to bottom, and instead asked myself one question — <strong>what is the simplest real thing I can build that forces me to use every core saga concept?</strong></p><blockquote>I built a <strong>User Search</strong>. And everything clicked.</blockquote><p>This is the guide I wish I had on day one.</p><p><strong>The One Concept You Must Understand Before Anything Else:</strong></p><p>Redux Saga is built entirely on JavaScript <strong>generator functions</strong>. If you don’t understand generators, sagas will never make sense.</p><h4><strong>Generator Function:</strong></h4><p>A generator function in JavaScript is a function defined with `<strong>function*`</strong> that can pause its execution using <strong>yield</strong> <strong>and resume later</strong> using `<strong>next()</strong>`, allowing it to generate a sequence of values on demand.</p><pre>function* idGenerator() {<br>  let id = 1;<br>  while (true) {<br>    yield id++;<br>  }<br>}<br><br>const ids = idGenerator();<br>console.log(ids.next().value); // 1<br>console.log(ids.next().value); // 2<br>console.log(ids.next().value); // 3<br>console.log(ids.next().value); // 4</pre><h4><strong>The Project — User Search App</strong></h4><p>Here is what we are building:</p><ul><li>A search input that calls a real API as you type</li><li>A built-in debounce so the API is not called on every single keystroke</li><li>When user type show the username match with the api username</li><li>Full error handling when the API fails</li><li>TypeScript throughout</li></ul><h4><strong>Axios.ts:</strong></h4><pre>import axios from &quot;axios&quot;;<br><br>export const api = axios.create({<br>  baseURL: import.meta.env.VITE_SERVER_URI,<br>});<br><br>// VITE_SERVER_URI=https://jsonplaceholder.typicode.com</pre><h4><strong>types/index.ts:</strong></h4><pre><br><br>export interface User {<br>  id: number;<br>  name: string;<br>  username: string;<br>  email: string;<br>  phone: string;<br>  website: string;<br>  address: {<br>    street: string;<br>    suite: string;<br>    city: string;<br>    zipcode: string;<br>    geo: { lat: string; lng: string };<br>  };<br>  company: {<br>    name: string;<br>    catchPhrase: string;<br>    bs: string;<br>  };<br>}<br><br><br><br>export interface UsersState {<br>  searchQuery: string;<br>  users: User[];<br>  loading: boolean;<br>  error: string | null;<br><br>  selectedUser: User | null;<br>  userPosts: Post[];<br>  profileLoading: boolean;<br>  profileError: string | null;<br>}<br><br>export interface SetUserProfilePayload {<br>  user: User;<br>  posts: Post[];<br>}</pre><h4><strong>store.ts:</strong></h4><pre>import { configureStore } from &quot;@reduxjs/toolkit&quot;;<br>import createSagaMiddleware from &quot;redux-saga&quot;;<br>import userReducer from &quot;../features/user/user.slice&quot;;<br>import rootSaga from &quot;./rootSaga&quot;;<br><br>const sagaMiddlewares = createSagaMiddleware();<br><br>export const store = configureStore({<br>  reducer: {<br>    users: userReducer,<br>  },<br>  middleware: (getDefaultMiddleware) =&gt;<br>    getDefaultMiddleware({ thunk: false }).concat(sagaMiddlewares),<br>// Disable Redux Thunk because we are using Redux Saga for async operations instead.<br>});<br><br>// You are using this setup because Redux Saga works through middleware. <br>// Redux itself cannot run sagas automatically, so you must connect <br>// saga middleware to the Redux store.<br><br>sagaMiddlewares.run(rootSaga);<br>export type RootState = ReturnType&lt;typeof store.getState&gt;;<br>export type AppDispatch = typeof store.dispatch;</pre><h4><strong>main.tsx:</strong></h4><pre>import { StrictMode } from &quot;react&quot;;<br>import { createRoot } from &quot;react-dom/client&quot;;<br>import &quot;./index.css&quot;;<br>import App from &quot;./App.tsx&quot;;<br>import { store } from &quot;./app/store.ts&quot;;<br>import { Provider } from &quot;react-redux&quot;;<br><br>createRoot(document.getElementById(&quot;root&quot;)!).render(<br>  &lt;StrictMode&gt;<br>    &lt;Provider store={store}&gt;<br>      &lt;App /&gt;<br>    &lt;/Provider&gt;<br>  &lt;/StrictMode&gt;,<br>);</pre><h4><strong>user.slice.ts:</strong></h4><pre>import { createSlice, type PayloadAction } from &quot;@reduxjs/toolkit&quot;;<br>import type { User, UsersState } from &quot;../../types&quot;;<br><br>const initialState: UsersState = {<br>  searchQuery: &quot;&quot;,<br>  users: [],<br>  loading: false,<br>  error: null,<br><br>  selectedUser: null,<br>  userPosts: [],<br>  profileLoading: false,<br>  profileError: null,<br>};<br><br>const usersSlice = createSlice({<br>  name: &quot;users&quot;,<br>  initialState,<br>  reducers: {<br>    fetchUsersRequest: (state, action: PayloadAction&lt;string&gt;) =&gt; {<br>      state.loading = true;<br>      state.error = null;<br>    },<br><br>    fetchUsersSuccess: (state, action: PayloadAction&lt;User[]&gt;) =&gt; {<br>      state.loading = false;<br>      state.users = action.payload;<br>    },<br><br>    fetchUsersFailure: (state, action: PayloadAction&lt;string&gt;) =&gt; {<br>      state.loading = false;<br>      state.error = action.payload;<br>    },<br><br>    setSearchQuery: (state, action: PayloadAction&lt;string&gt;) =&gt; {<br>      state.searchQuery = action.payload;<br>    },<br>  },<br>});<br><br>export const {<br>  fetchUsersRequest,<br>  fetchUsersSuccess,<br>  fetchUsersFailure,<br>  setSearchQuery,<br>} = usersSlice.actions;<br><br>export default usersSlice.reducer;</pre><h4><strong>userSaga.ts:</strong></h4><pre>import { call, delay, put, takeLatest } from &quot;redux-saga/effects&quot;;<br>import {<br>  fetchUsersRequest,<br>  fetchUsersSuccess,<br>  fetchUsersFailure,<br>} from &quot;./user.slice&quot;;<br>import type { User } from &quot;../../types&quot;;<br>import { fetchUsers } from &quot;./userApi&quot;;<br>import type { PayloadAction } from &quot;@reduxjs/toolkit&quot;;<br><br>function* handleFetchUsers(action: PayloadAction&lt;string&gt;) {<br>  try {<br>    yield delay(500);<br>    const users: User[] = yield call(fetchUsers, action.payload); // action.payload is the value which user type in search field. And pass this value.<br>    yield put(fetchUsersSuccess(users));  // if success then pass the data to fetchUserSuccess <br>  } catch (error: any) {<br>    yield put(fetchUsersFailure(error.message));<br>  }<br>}<br><br>export default function* userSaga() {<br>  yield takeLatest(fetchUsersRequest.type, handleFetchUsers);<br>/*<br>// Why takeLatest?<br><br>If multiple requests happen quickly,<br>cancel old request and keep latest one.<br> */<br>}<br><br>// 3 saga effects used here:<br>// call()       → run/execute async function, pause until done<br>// put()        → dispatch action to Redux<br>// takeLatest() → listen for action, cancel previous if new one comes<br><br>/*<br> &quot;yield takeLatest(fetchUsersRequest.type, handleFetchUsers);&quot;  ===&gt;&gt; <br>&quot;Hey Saga, whenever fetchUsersRequest happens,<br>run handleFetchUsers.&quot;<br> */<br><br></pre><h4><strong>rootSage.ts:</strong></h4><pre><br>import { all } from &quot;redux-saga/effects&quot;;<br>import userSaga from &quot;../features/user/userSaga&quot;;<br><br>export default function* rootSaga() {<br>  yield all([userSaga()]);<br>}</pre><h4><strong>userApi.ts:</strong></h4><pre>import { api } from &quot;../../axios/api&quot;;<br>import type { User } from &quot;../../types&quot;;<br><br>export const fetchUsers = async (query: string): Promise&lt;User[]&gt; =&gt; {<br>  const response = await api.get&lt;User[]&gt;(&quot;/users&quot;);<br><br>  // Filter users based on query<br>  return response.data.filter((user) =&gt;<br>    user.name.toLowerCase().includes(query.toLowerCase()),<br>  );<br>};</pre><h4><strong>UserSearch.tsx:</strong></h4><pre>import { useAppDispatch, useAppSelector } from &quot;../app/hook&quot;;<br>import { fetchUsersRequest, setSearchQuery } from &quot;../features/user/user.slice&quot;;<br>import type { User } from &quot;../types&quot;;<br>import React from &quot;react&quot;;<br><br>const UserSearch = () =&gt; {<br>  const dispatch = useAppDispatch();<br>  const { users, searchQuery, loading } = useAppSelector(<br>    (state) =&gt; state.users,<br>  );<br><br>  const handleSearch = (e: React.ChangeEvent&lt;HTMLInputElement&gt;) =&gt; {<br>    const value = e.target.value;<br><br>    dispatch(setSearchQuery(value));<br><br>    if (value.trim()) {<br>      dispatch(fetchUsersRequest(value));<br>    }<br>  };<br><br>  return (<br>    &lt;div&gt;<br>      &lt;input<br>        type=&quot;text&quot;<br>        value={searchQuery}<br>        onChange={handleSearch}<br>        placeholder=&quot;Search user...&quot;<br>      /&gt;<br><br>      {loading &amp;&amp; &lt;p&gt;Loading...&lt;/p&gt;}<br>      &lt;ul&gt;<br>        {users.length &gt; 0 &amp;&amp;<br>          users.map((user: User) =&gt; &lt;li key={user.id}&gt;{user.name}&lt;/li&gt;)}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default UserSearch;</pre><p>So when user didn’t write nothing show.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*PiJD1RMN44ICltEJrcjYCQ.png" /></figure><p>when user write username first show the loading state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*TPykLfPVAB6uyl_Ck0PLpA.png" /></figure><p>And then show the name which match with the user input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*5fqAre0zgZKwSLDijXYGjg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c446737c88f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Complete Redux Toolkit Flow: Slice → Thunk → Reducer → UI]]></title>
            <link>https://medium.com/@aliairf92/the-complete-redux-toolkit-flow-slice-thunk-reducer-ui-7fce9b969138?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/7fce9b969138</guid>
            <category><![CDATA[redux-toolkit]]></category>
            <category><![CDATA[redux-toolkit-flow]]></category>
            <category><![CDATA[react-redux-toolkit]]></category>
            <category><![CDATA[understanding-redux-toolk]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Mon, 04 May 2026 09:44:59 GMT</pubDate>
            <atom:updated>2026-05-04T09:44:59.788Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6DMfZHtarN6LsCVFfTwBcg.jpeg" /></figure><h3><strong>Redux-Toolkit:</strong></h3><p>Redux tookit is a library of react to manage complex state management in react application.</p><h4><strong>slice:</strong></h4><p>A slice is a single bundle that contains:</p><p>1. State</p><p>2. Reducers</p><p>3. Actions</p><p>for one feature of your app.</p><p>Redux Toolkit uses slices to keep code clean, organized, and simple.</p><h4><strong>store:</strong></h4><p>The store is where all your app’s state lives.</p><pre>import { configureStore } from &quot;@reduxjs/toolkit&quot;;<br><br>const store = configureStore({<br>reducer: {<br>notes: notesReducer,<br>user: userReducer,<br>},<br>});<br><br><br>/*<br>It holds the entire state<br>You access it using useSelector<br>You update it using dispatch<br>*/</pre><h4><strong>Provider:</strong></h4><pre>// main.tsx:<br>import { StrictMode } from &quot;react&quot;;<br>import { createRoot } from &quot;react-dom/client&quot;;<br>import App from &quot;./App.tsx&quot;;<br>import { Provider } from &quot;react-redux&quot;;<br>import { store } from &quot;./app/store.ts&quot;;<br><br>createRoot(document.getElementById(&quot;root&quot;)!).render(<br>&lt;StrictMode&gt;<br>&lt;Provider store={store}&gt;<br>&lt;App /&gt;<br>&lt;/Provider&gt;<br>&lt;/StrictMode&gt;<br>);<br>// Provider is used to provide a store state in your entire app.</pre><h4><strong>createSlice:</strong></h4><p>createSlice in Redux Toolkit is used to make Redux code simpler and shorter.</p><p>&lt;! — OR →</p><p>createSlice helps you create Redux state, actions, and reducers all in one place.</p><pre>const userSlice = createSlice({<br>name: &quot;user&quot;,<br>initialState,<br>reducers: {<br>clearError(state) {<br>state.error = null;<br>}},<br>});<br>export const { clearError } = userSlice.actions;<br>export default userSlice.reducer;<br>// reducers only work for synchronous tasks</pre><h4><strong>Reducer:</strong></h4><p>A reducer is a function that updates the state based on an action.</p><h4><strong>extraReducer:</strong></h4><p>extraReducers lets a slice respond to actions that it did NOT create itself or made outside the slice. And it work asynchronous.</p><pre>Why do we need extraReducers?<br>Because:<br><br>1. createAsyncThunk creates actions automatically.<br>2. Those actions are not inside your slice&#39;s reducers.<br>So we use extraReducers to handle them.</pre><p><strong>How thunk works with extraReducers:</strong></p><p>When you create a thunk, Redux Toolkit automatically creates 3 actions:</p><h4>Action | Meaning</h4><p>pending | API call started</p><p>fulfilled | API call succeeded</p><p>rejected | API call failed</p><h4><strong>Thunk:</strong></h4><p>A <em>thunk</em> or createAsyncThunk is used to handle asynchronous work in Redux, like:</p><pre>1. API calls<br>2. fetching data<br>3. waiting for something before updating the state</pre><p>`Thunk` = a middleman between async work and reducers</p><pre>export const SignUpUserThunk = createAsyncThunk(<br>  &quot;auth/signup&quot;,<br>  async (<br>    { firstName, lastName, email, password }: signup,<br>    { rejectWithValue },<br>  ) =&gt; {<br>    try {<br>      const response = await api.post(&quot;/auth/signup&quot;, {<br>        firstName,<br>        lastName,<br>        email,<br>        password,<br>      });<br>      toast.success(response.data.message, {<br>        duration: 2000,<br>        position: &quot;top-center&quot;,<br>      });<br>      return response.data;<br>    } catch (error) {<br>      const err = error as AxiosError&lt;{ message: string }&gt;;<br>      const message = err.response?.data?.message || &quot;Failed to Fetch details&quot;;<br>      toast.error(message || &quot;Invalid credentials&quot;);<br>      return rejectWithValue(message);<br>    }<br>  },<br>);</pre><pre>// features/user.slice.ts<br><br>extraReducers: (builder) =&gt; {<br>builder<br>// Signup<br>.addCase(SignUpUserThunk.pending, (state) =&gt; {<br>state.loading.signupLoading = true;<br>state.error = null;<br>})<br>.addCase(SignUpUserThunk.fulfilled, (state, action) =&gt; {<br>state.loading.signupLoading = false;<br>state.user = action.payload;<br>state.isAuthenticated = true;<br>state.error = null;<br>})<br>.addCase(SignUpUserThunk.rejected, (state, action) =&gt; {<br>state.loading.signupLoading = false;<br>state.error = (action.payload as string) || &quot;Login failed. Try again.&quot;;<br>})<br>}</pre><h4><strong>useDispatch() || useAppDispatch()</strong></h4><p>useDispatch is a React hook used to send actions to Redux.</p><pre>const History = () =&gt; {<br>const dispatch = useAppDispatch();<br>useEffect(() =&gt; {<br>dispatch(getInvoiceHistoryThunk());<br>}, []);<br>};</pre><h4><strong>useSelector || useAppSelector</strong></h4><p>useSelector is a React hook that lets your component read data (state) from the Redux store.</p><pre>const { invoiceHistory, loading } = useAppSelector((state) =&gt; state.invoice);</pre><h4><strong>why we use useAppSelector and useAppDispatch instead of useSelector and useDispatch?</strong></h4><p>We use useAppSelector and useAppDispatch for TypeScript safety, better autocomplete, and fewer bugs.</p><pre>// useSelector:<br><br>// The problem with useSelector &amp; useDispatch (default ones)<br><br>useSelector((state) =&gt; state.invoice);<br><br>-<br>TypeScript does NOT know what state looks like<br>state is typed as any<br>No autocomplete<br>Easy to make mistakes<br><br><br><br>// useDispatch<br><br><br>const dispatch = useDispatch();<br>dispatch(getInvoiceHistoryThunk());<br><br>-<br>TypeScript does not know:<br>what actions exist<br>that thunks are allowed</pre><h4><strong>Solution: Typed hooks (useAppSelector, useAppDispatch)</strong></h4><p>You create typed versions of these hooks once, then reuse them everywhere.</p><pre>app/hook.ts:<br>import { useDispatch, useSelector } from &quot;react-redux&quot;;<br>import type { RootState, AppDispatch } from &quot;./store&quot;;<br><br>// Use throughout your app instead of plain `useDispatch` and `useSelector`<br>export const useAppDispatch = useDispatch.withTypes&lt;AppDispatch&gt;();<br>export const useAppSelector = useSelector.withTypes&lt;RootState&gt;();</pre><h4><strong>Flow of data in redux toolkit:</strong></h4><pre>Component mounts<br>↓<br>dispatch(getInvoiceHistoryThunk())<br>↓<br>Thunk starts → pending action -&gt; `in slice of pending state.`<br>↓<br>API call happens<br>↓<br>Thunk finishes → fulfilled OR rejected<br>↓<br>extraReducers updates Redux state<br>↓<br>Component re-renders with new data</pre><p>Upper is the flow of redux-toolkit with thunk , now I also show you the code to fully understand.</p><pre>// component mounts:<br>const dispatch = useAppDispatch();<br>const { invoiceHistory, loading } = useAppSelector((state) =&gt; state.invoice);<br>useEffect(() =&gt; {<br>dispatch(getInvoiceHistoryThunk());<br>}, []);</pre><pre>// Thunk starts<br>export const getInvoiceHistoryThunk = createAsyncThunk(<br>&quot;invoice/history&quot;,<br>async (_, { rejectWithValue }) =&gt; {}</pre><pre>// pending action<br>addCase(getInvoiceHistoryThunk.pending, (state) =&gt; {<br>state.loading.getInvoiceLoading = true;<br>state.error.getInvoiceError = null;<br>});</pre><pre>// Api call<br>const response = await api.get(&quot;invoice/my-invoice&quot;);</pre><pre>// in success case<br>return response.data;</pre><pre>// Extra Reducer update the state || fulfilled actions handled in slice.<br><br>addCase(getInvoiceHistoryThunk.fulfilled, (state, action) =&gt; {<br>state.loading.getInvoiceLoading = false;<br>state.invoiceHistory = action.payload;<br>console.log(action.payload, &quot;invoice-history-slice&quot;);<br>});</pre><pre>// component re-render || Ui Automatically updates<br>because of this line:<br>const { invoiceHistory, loading } = useAppSelector(…)</pre><p>Redux Toolkit is not about memorizing APIs — it’s about <strong>understanding the flow</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7fce9b969138" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Set Up a Production-Ready Mongoose Connection in Next.js (TypeScript)]]></title>
            <link>https://medium.com/@aliairf92/how-to-set-up-a-production-ready-mongoose-connection-in-next-js-typescript-4cfedfaeb50c?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/4cfedfaeb50c</guid>
            <category><![CDATA[mongoose]]></category>
            <category><![CDATA[connection-mongodb]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[mongodb-atlas]]></category>
            <category><![CDATA[mongodb-conn]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 10:11:22 GMT</pubDate>
            <atom:updated>2026-04-28T10:11:22.445Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IPfETpBL9XWVvVxqdyyLHw.png" /></figure><p>When building scalable applications with <strong>Next.js and MongoDB</strong>, one of the most common mistakes developers make is <strong>creating multiple database connections</strong>.</p><p>This might work in development — but in production, it can quickly crash your app due to <strong>connection overload</strong>.</p><p>In this guide, you’ll learn how to create a <strong>production-ready Mongoose connection</strong> that is:</p><ul><li>Efficient</li><li>Scalable</li><li>Safe for serverless environments (like Vercel)</li><li>Optimized for development &amp; production</li></ul><h3>The Problem</h3><p>In Next.js (especially with the App Router), your code can run multiple times due to:</p><ul><li>Hot reload in development</li><li>Serverless function executions</li><li>Multiple API calls</li></ul><p>If you do this:</p><pre>mongoose.connect(MONGODB_URI);</pre><p>A new connection is created every time<br>Result: <strong>Too many connections → app crashes</strong></p><h3>The Solution: Connection Caching</h3><p>We solve this by:</p><ul><li>Reusing an existing connection if it exists</li><li>Storing the connection globally</li><li>Preventing duplicate connections</li></ul><h3>Production-Ready Setup</h3><h4>db.ts:</h4><p>Here’s the full working implementation:</p><pre>import mongoose from &quot;mongoose&quot;;<br><br>const MONGODB_URI = process.env.MONGODB_URI;<br><br>if (!MONGODB_URI) {<br>  throw new Error(&quot;mongodb variables didnot find.&quot;);<br>}<br><br>declare global {<br>  var mongoose: {<br>    conn: mongoose.Mongoose | null;<br>    promise: Promise&lt;mongoose.Mongoose&gt; | null;<br>  };<br>}<br><br>let cached = global.mongoose;<br><br><br>if (!cached) {<br>  cached = global.mongoose = {<br>    conn: null,<br>    promise: null,<br>  };<br>}<br><br><br>export async function dbConnect() {<br>  console.log(&quot; dbConnect called&quot;);<br>  // 1. If connection already exists → reuse it<br><br>  if (cached.conn) {<br>    console.log(&quot;♻️ Using cached connection&quot;);<br>    return cached.conn;<br>  }<br><br>  // 2. If no promise exists → create one<br>  if (!cached.promise) {<br>    console.log(&quot;⏳ Connecting to MongoDB...&quot;);<br>    cached.promise = mongoose.connect(MONGODB_URI as string).then((mongoose) =&gt; {<br>      return mongoose;<br>    });<br>  }<br><br>  try {<br>    // 3. Wait for connection<br>    cached.conn = await cached.promise;<br>    console.log(&quot;MongoDB connected&quot;);<br>  } catch (error) {<br>    // 4. Reset promise if failed<br>    cached.promise = null;<br>    throw error;<br>  }<br>  return cached.conn;<br>}</pre><h4>How This Works</h4><h4>Global Cache:</h4><pre>let cached = global.mongoose;</pre><ul><li>Stores connection across hot reloads</li><li>Prevents reconnecting every time in development</li></ul><h4>Reuse Existing Connection</h4><pre>if (cached.conn) return cached.conn;</pre><ul><li>If already connected → reuse it</li><li>Saves resources and improves performance</li></ul><h4>Store Connection Promise</h4><pre>if (!cached.promise) {<br>  cached.promise = mongoose.connect(...);<br>}</pre><ul><li>Prevents multiple simultaneous connections</li><li>Ensures only one connection attempt at a time</li></ul><h4>Error Handling</h4><pre>cached.promise = null;</pre><ul><li>If connection fails → reset promise</li><li>Allows retry on next request</li></ul><h3>Why This is Production-Ready</h3><h4>Handles Serverless Environments</h4><ul><li>Works perfectly with Vercel / AWS Lambda</li></ul><h4>Prevents Connection Explosion</h4><ul><li>Only one connection is reused</li></ul><h4>Optimized for Dev + Prod</h4><ul><li>Handles hot reload without reconnecting</li></ul><h4>Safe Async Handling</h4><ul><li>Uses promise caching to avoid race conditions</li></ul><h3>How to Use It</h3><p>In your API route or server action:</p><pre>import { dbConnect } from &quot;@/lib/db&quot;;<br><br>export async function GET() {<br>  await dbConnect();<br>  // your DB logic here<br>}</pre><h4>Common Mistakes to Avoid</h4><p>1- Calling mongoose.connect() in every API route.<br>2- Not caching connection globally.<br>3- Ignoring failed connections.<br>4- Using different connections for each request.</p><h3>Pro Tips</h3><ul><li>Keep your DB logic <strong>separate from routes</strong></li><li>Use <strong>environment variables</strong> for connection strings</li><li>Add logging only in development (avoid noisy production logs)</li></ul><h4>Final Thoughts</h4><p>A proper database connection setup is <strong>critical for scalability</strong>.</p><p>With this pattern, you:</p><ul><li>Avoid performance issues.</li><li>Prevent crashes.</li><li>Build a solid backend foundation.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4cfedfaeb50c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From React Developer to Software Architect: A Roadmap to Scalability ,AI and System Design.]]></title>
            <link>https://medium.com/@aliairf92/from-react-developer-to-software-architect-a-roadmap-to-scalability-ai-and-system-design-d8518799c787?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8518799c787</guid>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 10:12:10 GMT</pubDate>
            <atom:updated>2026-04-16T10:12:10.338Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gB-5HE_9ejq0SQmEHo03Xg.png" /></figure><p>Absolutely — this is the <strong>right next move</strong> if you’ve already spent a long time in React.</p><p>What you’re feeling is basically the shift from:</p><blockquote><strong><em>“How do I build features?”</em></strong><em><br> to<br> </em><strong><em>“How do I design systems that survive growth, complexity, teams, and now AI?”</em></strong></blockquote><p>That transition is from <strong>frontend engineer</strong> → <strong>software engineer with architecture thinking</strong> → <strong>system designer / architect / staff+ engineer</strong>.</p><h3>1) What “architecture design” and “scalability” actually mean</h3><h3>Software architecture</h3><p>Software architecture is the <strong>high-level structure of a system</strong>: how components are split, how they communicate, how data flows, how teams deploy changes, and how the system meets goals like maintainability, performance, security, and reliability. System design typically includes choices around databases, caches, queues, load balancers, proxies, logging/monitoring, scaling, and security. <a href="https://roadmap.sh/system-design">[roadmap.sh]</a>, <a href="https://sre.google/sre-book/table-of-contents/">[sre.google]</a></p><p>In simpler words:</p><ul><li>React taught you <strong>component architecture</strong></li><li>Software architecture teaches you <strong>product/system architecture</strong></li></ul><p>You stop thinking only in terms of:</p><ul><li>components</li><li>hooks</li><li>state management</li><li>rendering</li></ul><p>…and start thinking in terms of:</p><ul><li>services</li><li>APIs</li><li>databases</li><li>distributed systems</li><li>observability</li><li>reliability</li><li>cloud infrastructure</li><li>AI integration</li></ul><h3>Scalability</h3><p>Scalability means <strong>how well a system handles increasing traffic, data, and complexity</strong> without falling apart in performance, cost, reliability, or team productivity. Google’s SRE guidance treats scalability and reliability as deeply tied to capacity management, monitoring, overload handling, and failure mitigation. <a href="https://static.googleusercontent.com/media/sre.google/en//static/pdf/login_winter20_10_torres.pdf">[static.goo…ontent.com]</a>, <a href="https://sre.google/sre-book/table-of-contents/">[sre.google]</a></p><p>There are two kinds you should care about:</p><h3>A. Technical scalability</h3><p>Can the app handle:</p><ul><li>more users?</li><li>more requests?</li><li>more data?</li><li>more services?</li></ul><p>This leads to concepts like:</p><ul><li>caching</li><li>load balancing</li><li>horizontal scaling</li><li>database indexing</li><li>replication / partitioning</li><li>queues and async processing</li></ul><h3>B. Organizational scalability</h3><p>Can <strong>more developers and teams</strong> work on the system without chaos?</p><p>This is where architecture matters a lot:</p><ul><li>code boundaries</li><li>ownership</li><li>modularity</li><li>deployment independence</li><li>standards</li><li>documentation</li></ul><h3>2) Monolith vs microservices — what to understand first</h3><p>A lot of React devs jump too quickly into “microservices = advanced.”<br> That’s not the right mindset.</p><p>IBM explicitly notes that <strong>monoliths and microservices each have trade-offs</strong>, and neither is universally superior. Monoliths are often simpler to build and deploy, while microservices can better support independent scaling and deployment when complexity and organizational needs justify them. <a href="https://www.ibm.com/think/topics/monolithic-vs-microservices">[ibm.com]</a>, <a href="https://www.atlassian.com/microservices/microservices-architecture">[atlassian.com]</a></p><h3>Monolith</h3><p>A monolith keeps the app in a single codebase / deployable unit. It is usually simpler for:</p><ul><li>early-stage products</li><li>smaller teams</li><li>fast delivery</li><li>easier local development and deployment <a href="https://www.ibm.com/think/topics/monolithic-vs-microservices">[ibm.com]</a></li></ul><h3>Microservices</h3><p>Microservices split the application into independently deployable services that communicate through APIs, which can improve scalability, maintainability, and team autonomy — but they also introduce more operational complexity. <a href="https://www.atlassian.com/microservices/microservices-architecture">[atlassian.com]</a>, <a href="https://www.ibm.com/think/topics/monolithic-vs-microservices">[ibm.com]</a></p><h3>Best practical advice</h3><p>For most engineers moving from React into architecture, the best path is:</p><blockquote><strong><em>Start with a modular monolith mindset first</em></strong><em> and only then learn microservices.</em></blockquote><p>That means:</p><ul><li>one application</li><li>strong domain boundaries</li><li>clean modules</li><li>API contracts</li><li>good database design</li><li>independent reasoning per business capability</li></ul><p>This gives you the architectural thinking <strong>without prematurely paying the complexity tax</strong> of distributed systems.</p><h3>3) What you should learn next after React</h3><p>If you want to move toward architecture and scalability, your learning should expand in layers.</p><h3>Layer 1 — Backend and API design</h3><p>You can’t become strong in architecture from frontend alone.</p><p>Learn:</p><ul><li>Node.js deeply (since you already know JS/TS)</li><li>NestJS / Express / Fastify</li><li>REST design</li><li>GraphQL basics</li><li>authentication / authorization</li><li>API versioning</li><li>idempotency</li><li>rate limiting</li></ul><p>Why? Because architecture begins where <strong>frontend meets backend contracts</strong>.</p><h3>Layer 2 — Data and database design</h3><p>A lot of system design is really <strong>data design</strong>.</p><p>Learn:</p><ul><li>SQL deeply</li><li>transactions</li><li>indexes</li><li>joins</li><li>normalization vs denormalization</li><li>NoSQL use cases</li><li>caching</li><li>read/write patterns</li></ul><p>If you can answer:</p><blockquote><em>“Where should this data live, how is it queried, and what breaks at 100x scale?”</em></blockquote><p>…you are already thinking like an architect.</p><h3>Layer 3 — Distributed systems basics</h3><p>Roadmap-style system design guidance consistently highlights components such as load balancers, caches, queues, CDNs, logging/monitoring systems, and database scaling as core system design topics. <a href="https://roadmap.sh/system-design">[roadmap.sh]</a></p><p>Learn:</p><ul><li>load balancers</li><li>CDN</li><li>Redis caching</li><li>message queues (Kafka / RabbitMQ / SQS)</li><li>async jobs</li><li>eventual consistency</li><li>retries and backoff</li><li>circuit breakers</li><li>sharding and replication</li><li>CAP trade-offs</li></ul><p>This is where “scalability” becomes real.</p><h3>Layer 4 — Reliability / SRE thinking</h3><p>Google’s SRE material emphasizes topics like <strong>SLOs, monitoring distributed systems, release engineering, testing for reliability, incident management, load balancing, overload handling, and cascading failure prevention</strong>. <a href="https://sre.google/sre-book/table-of-contents/">[sre.google]</a></p><p>This matters because architecture is not only:</p><ul><li>“Can I build it?”</li></ul><p>It is also:</p><ul><li>“Can I run it in production without fear?”</li></ul><p>Learn:</p><ul><li>SLI / SLO / error budgets</li><li>metrics, logs, traces</li><li>incident response</li><li>postmortems</li><li>capacity planning</li><li>graceful degradation</li><li>health checks</li><li>rollback strategy</li></ul><p>This is one of the biggest mindset upgrades from feature developer to architect.</p><h3>Layer 5 — Cloud and platform</h3><p>Modern architecture is strongly connected to cloud-native deployment. Microservices are commonly paired with containerization and automated infrastructure / CI/CD practices. <a href="https://www.atlassian.com/microservices/microservices-architecture">[atlassian.com]</a></p><p>Learn:</p><ul><li>Docker</li><li>Kubernetes basics</li><li>CI/CD</li><li>Terraform or Bicep</li><li>cloud networking basics</li><li>secrets management</li><li>service discovery</li><li>observability stack</li></ul><p>You don’t need to become a DevOps engineer first, but you should understand the <strong>deployment reality</strong> of the systems you design.</p><h3>4) How to implement this transition in practice</h3><p>Here’s the part most people miss:</p><p>You do <strong>not</strong> become an architect by reading system design blogs only.<br> You become one by <strong>redesigning real systems</strong>.</p><h3>Step-by-step implementation path</h3><h3>Step 1: Build a full-stack product</h3><p>Take one serious project and build it end to end:</p><p>Example:</p><ul><li>React frontend</li><li>Node/NestJS backend</li><li>PostgreSQL</li><li>Redis</li><li>background workers</li><li>Dockerized deployment</li><li>CI/CD</li><li>logs + metrics</li></ul><p>This forces you to think beyond UI.</p><h3>Step 2: Redesign it in stages</h3><p>Once it works, improve it like an architect:</p><h4>Version 1:</h4><p>Simple monolith</p><h4>Version 2:</h4><p>Modular monolith</p><ul><li>auth module</li><li>billing module</li><li>notification module</li><li>analytics module</li></ul><h4>Version 3:</h4><p>Add scalability patterns</p><ul><li>caching</li><li>message queue</li><li>async email/notification service</li><li>read replicas or search service</li></ul><h4>Version 4:</h4><p>Add reliability</p><ul><li>health checks</li><li>tracing</li><li>circuit breaker</li><li>retries</li><li>dashboards</li><li>SLOs</li></ul><p>That progression is how architecture skills become real.</p><h3>Step 3: Write architecture decisions</h3><p>Start using:</p><ul><li>ADRs (Architecture Decision Records)</li><li>C4 diagrams</li><li>trade-off docs</li><li>performance assumptions</li><li>risk analysis</li></ul><p>Architects are not just coders with more experience.<br> They are <strong>decision makers who can explain trade-offs clearly</strong>.</p><h3>Step 4: Study existing large systems</h3><p>Practice designing:</p><ul><li>chat app</li><li>e-commerce</li><li>video streaming</li><li>ride-hailing</li><li>analytics dashboard</li><li>collaborative editor</li><li>AI knowledge assistant</li></ul><p>Ask:</p><ul><li>where is the bottleneck?</li><li>where do I cache?</li><li>what data is consistent vs eventually consistent?</li><li>what happens when one service fails?</li><li>what is expensive to compute?</li><li>what needs async processing?</li></ul><h3>5) What is most beneficial for the future with AI</h3><p>This is the most important part of your question.</p><p>The future is <strong>not just “learn AI models”</strong>.<br> The bigger opportunity is:</p><blockquote><strong><em>Become the engineer who can design AI-enabled systems well.</em></strong></blockquote><p>That is much more valuable.</p><h3>Why architecture becomes even more important because of AI</h3><p>Microsoft’s guidance describes <strong>RAG (Retrieval-Augmented Generation)</strong> as an industry-standard pattern for building AI applications that use specific or proprietary data a model doesn’t already know. In that architecture, an orchestrator handles retrieval, passes relevant context to the language model, and returns grounded responses. The data pipeline includes chunking, enrichment, embedding, and indexing. <a href="https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-solution-design-and-evaluation-guide">[learn.microsoft.com]</a></p><p>That means modern AI apps are not just prompts. They are systems involving:</p><ul><li>orchestration</li><li>retrieval</li><li>search</li><li>vector indexes</li><li>pipelines</li><li>security</li><li>evaluation</li><li>compliance</li><li>observability</li></ul><p>In other words:</p><blockquote><em>AI is making </em><strong><em>software architecture more important</em></strong><em>, not less.</em></blockquote><h3>The AI skills that will matter most for architects</h3><h3>1) RAG architecture</h3><p>Microsoft explains that RAG combines retrieval with generation to produce more accurate, grounded responses based on enterprise content rather than only model memory. <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/guidance/retrieval-augmented-generation">[learn.microsoft.com]</a>, <a href="https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-solution-design-and-evaluation-guide">[learn.microsoft.com]</a></p><p>You should learn:</p><ul><li>chunking</li><li>embeddings</li><li>vector search</li><li>hybrid search</li><li>metadata enrichment</li><li>prompt/context assembly</li><li>evaluation metrics like groundedness and relevancy</li></ul><h3>2) Agent orchestration</h3><p>Microsoft’s RAG architecture guidance explicitly mentions an <strong>orchestrator</strong> and tools/platforms like Microsoft Agent Framework, Semantic Kernel, Azure AI Agent service, or LangChain to route retrieval and generation steps. <a href="https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-solution-design-and-evaluation-guide">[learn.microsoft.com]</a></p><p>You should learn:</p><ul><li>tool calling</li><li>workflow orchestration</li><li>memory</li><li>task routing</li><li>agent vs non-agent trade-offs</li></ul><h3>3) AI safety, governance, and enterprise boundaries</h3><p>Copilot Studio’s RAG guidance emphasizes <strong>grounded, cited responses</strong>, moderation layers, governance validation, and the fact that customer data is not used to train the model in that setup. <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/guidance/retrieval-augmented-generation">[learn.microsoft.com]</a></p><p>This means future architects who understand:</p><ul><li>access control</li><li>data privacy</li><li>security trimming</li><li>auditability</li><li>compliance</li><li>citation/traceability</li></ul><p>…will be much more valuable than people who only know prompt engineering.</p><h3>4) Evaluation</h3><p>Microsoft’s architecture guidance stresses evaluating each stage of a RAG system, including retrieval quality, embedding choice, chunking, and end-to-end metrics such as groundedness, completeness, utilization, and relevancy. <a href="https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-solution-design-and-evaluation-guide">[learn.microsoft.com]</a></p><p>So for AI, your future edge is:</p><ul><li>not just “make the demo work”</li><li>but “make the system measurable and trustworthy”</li></ul><p>That’s architect-level thinking.</p><h3>6) Best career direction for you specifically</h3><p>Since you already know React well, the smartest route is:</p><h3>Option A — Frontend Architect → Full-Stack Architect</h3><p>Best if you want to stay close to product engineering.</p><p>Learn:</p><ul><li>frontend performance at scale</li><li>design systems</li><li>BFF pattern</li><li>edge rendering</li><li>API orchestration</li><li>full-stack reliability</li></ul><h3>Option B — System Design / Backend-heavy Architect</h3><p>Best if you enjoy deeper infrastructure and performance work.</p><p>Learn:</p><ul><li>backend systems</li><li>distributed systems</li><li>cloud</li><li>observability</li><li>platform engineering</li></ul><h3>Option C — AI Application Architect</h3><p>This is likely the strongest future-facing path.</p><p>Learn:</p><ul><li>RAG</li><li>search/indexing</li><li>agent orchestration</li><li>knowledge systems</li><li>enterprise security</li><li>evaluation</li><li>AI product architecture</li></ul><p>If I were advising a strong React developer today, I’d say:</p><blockquote><strong><em>Become a full-stack/system-design engineer with AI architecture skills.</em></strong></blockquote><p>That combination is extremely powerful for the next few years.</p><h3>7) A practical 6-month roadmap for you</h3><h3>Month 1–2</h3><ul><li>Node.js / NestJS</li><li>PostgreSQL</li><li>REST + auth</li><li>Docker</li><li>build one production-style full-stack app</li></ul><h3>Month 3</h3><ul><li>Redis</li><li>queues</li><li>async jobs</li><li>API performance</li><li>logging + metrics</li></ul><h3>Month 4</h3><ul><li>system design basics</li><li>load balancers</li><li>CDN</li><li>replication</li><li>sharding</li><li>SLO / monitoring / tracing</li></ul><h3>Month 5</h3><ul><li>cloud deployment</li><li>CI/CD</li><li>Kubernetes basics</li><li>infra as code</li><li>architecture documentation (ADR + C4)</li></ul><h3>Month 6</h3><ul><li>AI layer:</li><li>embeddings</li><li>vector search</li><li>RAG</li><li>evaluation</li><li>one AI assistant project on your own data</li></ul><h3>8) Projects that will make you stand out</h3><p>Build <strong>2–3 serious architecture-focused projects</strong>, not 20 UI clones.</p><h3>Project ideas</h3><h3>1. Multi-tenant SaaS dashboard</h3><p>Learn:</p><ul><li>auth</li><li>RBAC</li><li>tenant isolation</li><li>audit logs</li><li>caching</li><li>observability</li></ul><h3>2. Event-driven e-commerce system</h3><p>Learn:</p><ul><li>inventory</li><li>orders</li><li>payment workflow</li><li>async email/notification</li><li>eventual consistency</li><li>retries</li></ul><h3>3. AI knowledge assistant</h3><p>Learn:</p><ul><li>document ingestion</li><li>chunking</li><li>embeddings</li><li>vector search</li><li>RAG</li><li>citations</li><li>evaluation dashboards</li></ul><p>This last project is especially strong for future AI roles because it maps directly to the RAG architecture and evaluation patterns Microsoft documents. <a href="https://learn.microsoft.com/en-us/azure/architecture/ai-ml/guide/rag/rag-solution-design-and-evaluation-guide">[learn.microsoft.com]</a>, <a href="https://learn.microsoft.com/en-us/microsoft-copilot-studio/guidance/retrieval-augmented-generation">[learn.microsoft.com]</a></p><h3>9) Final Conclusion:</h3><h3>What should you do next?</h3><p><strong>Move from React-only development to full-stack system design, distributed systems, reliability, cloud, and AI architecture (especially RAG/orchestration/evaluation).</strong></p><p>That path gives you:</p><ul><li>better salary growth</li><li>stronger leadership opportunities</li><li>relevance in AI-era engineering</li><li>long-term protection from being “just a UI developer”</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8518799c787" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Zustand Performance Explained: From Beginner to Advanced — Selector vs Full Store Subscription.]]></title>
            <link>https://medium.com/@aliairf92/zustand-performance-explained-from-beginner-to-advanced-selector-vs-full-store-subscription-2accffccb71a?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/2accffccb71a</guid>
            <category><![CDATA[zustand]]></category>
            <category><![CDATA[what-is-zustand]]></category>
            <category><![CDATA[zustand-state-managemen]]></category>
            <category><![CDATA[why-use-zustand]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 08:04:11 GMT</pubDate>
            <atom:updated>2026-04-14T08:04:11.881Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ej-1rHTfJ5ji7_5XscrWg.jpeg" /></figure><p>If you’ve ever worked with React long enough, you’ve felt the pain of state management.</p><p>It usually starts small.<br> A useState here.<br> A prop drilled there.<br> Then suddenly… you’re passing props through five components that don’t even care about the data.</p><p>That’s where the story of <strong>Zustand</strong> begins.</p><h3>What is Zustand?</h3><p>Zustand = a simple global state manager for React.</p><ul><li>A <strong>central storage (store)</strong> for your app’s data.</li><li>Any component can <strong>read or update</strong> it directly.</li><li>No providers, no boilerplate, no reducers (unlike Redux).</li></ul><h3>Why do we even need Zustand?</h3><p>Problem without state management.</p><ul><li>Local state (useState) is <strong>component-scoped.</strong></li><li>Passing data down = <strong>prop drilling</strong></li></ul><pre>&lt;App&gt;<br>  &lt;Parent&gt;<br>    &lt;Child&gt;<br>      &lt;DeepChild /&gt;<br>    &lt;/Child&gt;<br>  &lt;/Parent&gt;<br>&lt;/App&gt;</pre><p>If DeepChild needs data from App, you pass props through everything.</p><h4>Zustand solves this:</h4><ul><li>Store is <strong>global.</strong></li><li>Any component can access it directly.</li></ul><pre>const count = useStore((state) =&gt; state.count);</pre><p>No prop drilling. Clean.</p><h4>Installing Zustand:</h4><pre>npm install zustand</pre><h3>Your FIRST store (TypeScript):</h3><p>Let’s build from scratch.</p><h4>Step1: Define types</h4><pre>type Todo = {<br>  id: number;<br>  text: string;<br>  completed: boolean;<br>};<br><br>type TodoStore = {<br>  todos: Todo[];<br>  addTodo: (todo: Todo) =&gt; void;<br>};</pre><h4>Step 2: Create store</h4><pre>import { create } from &quot;zustand&quot;;<br><br>export const useTodoStore = create&lt;TodoStore&gt;((set, get) =&gt; ({<br>  todos: [],<br><br>  addTodo: (todo) =&gt; {<br>const exists = get().todos.some((t) =&gt; t.id === todo.id);<br><br>if (exists) {<br>  console.log(&quot;Todo already exists&quot;);<br>  return;<br>    }<br><br>set((state) =&gt; ({<br>  todos: [todo, ...state.todos],<br>  })),<br>}<br>   <br>}));</pre><ul><li>create() → makes the store</li><li>set() → updates/write state</li><li>get() → Access/Read current state anytime.</li><li>state → current store data</li></ul><h4>Using it in React:</h4><pre>const todos = useTodoStore((state) =&gt; state.todos);<br>const addTodo = useTodoStore((state) =&gt; state.addTodo);<br><br>                   // VS<br>const {todos, addTodos} = useTodoStore();<br><br>// Which one is optimized way:<br><br>                      // 1.<br>// - Selector pattern OR Selector based subscription:<br>useTodoStore((state) =&gt; state.todos);<br>// - Only subscribes to todos, not entire store.<br>// - when you pass a selector functioon -- (state) =&gt; state.todos<br>// - Your component subscribes only to todos.<br>// - The component re-render when only todos change,<br>// - Other state updates didn&#39;t cause re-render.<br><br><br>                      // 2.<br>// ~ This subscribe to entire object store.<br>// ~ Any state cause re-render.<br>// ~ Performance degrades as store grow.<br>// ~ Even unrelated updates (like filter, isLoading, etc.)<br>// ~ Re-render me whenever anything in the store changes.<br><br><br><br>So the first option is optimized one.</pre><h4>Middleware (DevTools, Persist, etc):</h4><pre>import { devtools } from &quot;zustand/middleware&quot;;<br><br>create(<br>  devtools((set) =&gt; ({<br>    count: 0,<br>    increase: () =&gt; set((s) =&gt; ({ count: s.count + 1 })),<br>  }))<br>);</pre><p>This connects your store to <strong>Redux DevTools</strong>, so you can</p><ul><li>Inspect state</li><li>Track changes</li><li>Debug easily</li></ul><h4>Async logic:</h4><pre>import { create } from &quot;zustand&quot;;<br><br>export type Post = {<br>  userId: number;<br>  id: number;<br>  title: string;<br>  body: string;<br>};<br><br>type PostsStore = {<br>  posts: Post[];<br>  laoding: boolean;<br>  error: string | null;<br>  fetchPosts: () =&gt; void;<br>};<br><br>export const usePostsStore = create&lt;PostsStore&gt;((set) =&gt; ({<br>  posts: [],<br>  laoding: false,<br>  error: null,<br><br>  fetchPosts: async () =&gt; {<br>    set({ laoding: true, error: null });<br>    try {<br>      const res = await fetch(<br>        &quot;https://jsonplaceholder.typicode.com/posts?_limit=5&quot;,<br>      );<br>      const data = await res.json();<br>      set({ posts: data, laoding: false });<br>    } catch (error) {<br>      set({ error: &quot;Failed to fetch posts&quot;, laoding: false });<br>    }<br>  },<br>}));</pre><p>Zustand does NOT care about async — just use async/await</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2accffccb71a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OOP (Object Oriented Programming)]]></title>
            <link>https://medium.com/@aliairf92/oop-object-oriented-programming-9f0272bdccfa?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f0272bdccfa</guid>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 13:27:45 GMT</pubDate>
            <atom:updated>2026-02-03T13:27:45.508Z</atom:updated>
            <content:encoded><![CDATA[<p>A style of programming where we use objects to organize code.</p><h4>OOP Paradigm:</h4><p>It is a way or style of writing code.<br>It’s the method you use to solve problems in programming.</p><p><strong>Paradigm </strong>= a programming style.<br><strong>OOP </strong>= one specific style (using object).</p><h4><strong>Way of Programming:</strong></h4><p><strong>1- Imperative programming:<br> </strong>This is by giving instruction to computer step by step “<strong>what to do</strong>”.<br> . Do this.<br> . Then do this.</p><pre>const numbers = [1, 2, 3, 4];<br>const doubled = [];<br><br>for (let i = 0; i &lt; numbers.length; i++) {<br>  doubled.push(numbers[i] * 2);<br>}<br><br>console.log(doubled); // [2, 4, 6, 8]</pre><h4><strong>2- Declarative programming:</strong></h4><p>This is when i tell the computer “<strong>what i want</strong>”, not how to do.</p><ul><li>I want a cake:<br>I don’t tell the baker how to bake.</li></ul><pre>const numbers = [1, 2, 3, 4];<br><br>const doubled = numbers.map(num =&gt; num * 2);<br><br>console.log(doubled); // [2, 4, 6, 8]</pre><h4>3- functional programming.</h4><p>In this we use functions as the main blocks</p><pre>function add(a, b) {<br>  return a + b;<br>}</pre><h4>What is Instance?</h4><p>A instance is an object created from a class (or a constructor function) — using a <strong>“new” </strong>keyword.</p><p><strong>new:<br></strong>The new keyword is used to create an instance of an object from a constructor function or class.</p><pre>class Car {<br>  constructor(color, model) {<br>    this.color = color;<br>    this.model = model;<br>  }<br>}<br><br>const myCar = new Car(&quot;red&quot;, &quot;Toyota&quot;);<br><br>// Car = class<br>// new Car(&quot;red&quot;,&quot;Toyota&quot;) =  create a object<br>// myCar = instance of Car<br><br><br>/**<br>To create an instance in JavaScript OOP:<br><br>- You use the new keyword<br>- You call the class<br>- You store it in a variable<br>**/</pre><h4><strong>this keyword:</strong></h4><p>this is a special keyword that refer to the current context object. — meaning the object that is currently using the code. And they behave differently depend where it used.</p><p>And arrow function don’t have they own “this”. They use from it surrounding scope.</p><pre>// In browser:<br>console.log(this)   // They gave us the window object.<br><br>// In code terminal<br>console.log(this)    //  {} =&gt; empty object.<br><br><br>// While using object<br>const person = {<br>  name: &quot;Ali&quot;,<br>  greet: function () {<br>    console.log(this.name);<br>  },<br>};<br><br>person.greet(); // Ali<br><br><br><br>// Inside constructor class<br>class Car {<br>  constructor(color) {<br>    this.color = color;<br>  }<br>}<br><br>const myCar = new Car(&quot;red&quot;);<br>console.log(myCar.color);  // red<br><br><br><br>// Arrow function<br>const person = {<br>  name: &quot;Ali&quot;,<br>  showName: () =&gt; {<br>    console.log(this.name);<br>  }<br>};<br><br>person.showName(); // undefined -  because this dont have they own this.They get it from the outside the object (global scope)<br><br>// this in browser is {}.<br>// this in terminal (global - node.js)   // so this.name , become window.name and it undefined.<br></pre><h4>Different way and use object:</h4><p>1- <strong>Object Literal.</strong><br>2- <strong>Factory Function.</strong><br>3- <strong>Constructor Function.</strong><br>4- <strong>Class syntax (ES6).</strong></p><h4>1- Object Literal:</h4><p>Simplest and most common way to create an object. Use when you creating a single or specific object.</p><pre>let student = {<br>  MYname: &quot;Ali&quot;,<br>  age: 23,<br>  passion: &quot;problem-solving&quot;,<br>  introduceMySelf: function () {<br>    console.log(<br>      `Salam, My name is ${this.MYname} and my age is ${this.age} and my passion is ${this.passion}`,<br>    );<br>  },<br>};<br><br>student.introduceMySelf();<br>// Salam, My name is Ali and my age is 23 and my passion is problem-solving.</pre><h4>2- Factory Function:</h4><p>A function that return a new object. Don’t involve prototypes by default (unless you manually set them).Great for creating multiple similar objects without classes.</p><pre>function Student(name, age, passion) {<br>  return {<br>    name,<br>    age,<br>    passion,<br>    introduceMySelf: function () {<br>      console.log(<br>        `Salam, My name is ${this.MyName} and my age is ${this.age} and my passion is ${this.passion} i am a SE and PS.`,<br>      );<br>    },<br>  };<br>}<br><br>let result = Student(&quot;Ali&quot;, 23, &quot;Gaming&quot;);<br>console.log(result);<br><br>// {name: &#39;Ali&#39;,age: 23,passion: &#39;Gaming&#39;,introduceMySelf: [Function: introduceMySelf]}</pre><h4>3- Constructor Function:</h4><p>A constructor is a special function that create an initialize an object. It is like a factory machine that produce new objects with specific properties.</p><p>1- They use the new keyword.<br> 2- Before class syntax this was the standard way to create “object” blue print</p><pre>class Car {<br>  constructor(color, model) {<br>    this.color = color;<br>    this.model = model;<br>  }<br>}<br><br>// Car is the blueprint<br>// constructor define what blueprint contains. color and model.</pre><pre>function Student(name, age) {<br>  this.name = name;<br>  this.age = age;<br>  this.greet = function () {<br>    conosle.log(`Hello I,m ${this.name}`);<br>  };<br>  return this;<br>}<br>// ❌ wrong <br>// const std1 = Student(&quot;Ali&quot;, 22);<br>// const std2 = Student(&quot;Ali&quot;, 23);<br>// console.log(std1);<br>// console.log(std2); // when i use this they overwrite std1 to std2 so they only show std2 properties that why use new keyword for creating new memory and object for not facing override properties.<br><br>// ✅ correct<br>const std1 = new Student(&quot;Ali&quot;, 22); // new =  new memory allocate and also create new object, . so that they didnot overwrite existing properties.And binding all argument and then return the object<br>console.log(std1);</pre><ul><li>Internally javaScript use constructor function.</li></ul><h4>4- Class Syntax (ES6):</h4><p>In JavaScript, a class is a blueprint for creating objects. It’s a more modern and cleaner way to do what constructor functions and prototypes do behind the scenes.</p><ul><li>A modern, cleaner syntax for creating constructor function.</li><li>Internally still work like a constructor function.</li><li>They automatically set method into prototype so we don’t need to set it manually through prototype.</li></ul><pre>class Student {<br>  constructor(name, age, passion) {<br>    this.name = name;<br>    this.age = age;<br>    this.passion = passion;<br>  }<br>  greet() {<br>    console.log(`Hello my name is ${this.name} and my age is ${this.age}`);<br>  }<br>}<br><br>const s1 = new Student(&quot;Ali&quot;, 22, &quot;Gaming&quot;, &quot;problem-solving&quot;);<br>const s2 = new Student(&quot;Ahmad&quot;, 22, &quot;Gaming&quot;, &quot;problem-solving&quot;);<br>console.log(s1);   // Student { name: &#39;Ali&#39;, age: 22, passion: &#39;Gaming&#39; }<br>console.log(s2);   // Student { name: &#39;Ahmad&#39;, age: 22, passion: &#39;Gaming&#39; }<br><br>s1.greet();  // Hello my name is Ali and my age is 22</pre><h4>Prototype:</h4><p>In <strong>JavaScript</strong>, a <strong>prototype</strong> is a <strong>shared object</strong> that other objects can use to access properties and methods.</p><p>When an object doesn’t have a property, JavaScript <strong>looks in its prototype</strong>.</p><pre>function Student(name, age) {<br>  this.name = name;<br>  this.age = age;<br>  this.introduceMySelf = function () {<br>    // This is the problem<br>    console.log(`My name is ${this.name} and age is ${this.age}`);<br>  };<br>}<br><br>let s1 = new Student(&quot;Ali&quot;, 22);<br>let s2 = new Student(&quot;Ahmad&quot;, 22);<br>console.log(s1);<br>console.log(s2);</pre><p>Every time you create a new student with new Student(), you are also creating a brand new, separate copy of the introduceMySelf function.</p><ul><li>s1 has its own introduceMySelf function.</li><li>s2 has its own different introduceMySelf function.</li></ul><p>You can test this:</p><pre>console.log(s1.introduceMySelf === s2.introduceMySelf); // false</pre><p>When you call a method on an instance (e.g., s1.introduceMySelf()), JavaScript first looks for the method on the object itself. If it doesn&#39;t find it, it looks in the object&#39;s prototype (the shared toolbox). This is called the prototype chain.</p><pre>function Student(name, age) {<br>  this.name = name;<br>  this.age = age;<br>  this.introduceMySelf = function () {<br>    // This is the problem<br>    // console.log(`My name is ${this.name} and age is ${this.age}`);<br>  };<br>}<br><br>Student.prototype.introduceMySelf = function () {<br>  console.log(`My name is ${this.name} and age is ${this.age}`);<br>};<br><br>let s1 = new Student(&quot;Ali&quot;, 22);<br>let s2 = new Student(&quot;Ahmad&quot;, 22);<br><br>s1.introduceMySelf();<br><br>// But now, they share the SAME function!<br>console.log(s1.introduceMySelf() === s2.introduceMySelf()); // true</pre><h4>Prototype Chaining:</h4><pre>function BankAccount(holdersName, balance) {<br>  this.holdersName = holdersName;<br>  this.balance = balance;<br>  //   this.deposit = function (balance) {<br>  // this.balance = this.balance + balance;<br>  // OR<br>  // this.balance += balance;<br>  //<br>  // console.log(`deposit ${balance}`); // if i use this they only print deposit number not actuall deposit it in prototype.because first they check method in object and if they not found then  they go to the prototype and there check and run  it. so they only find method in object so they didnot go to the prototype funtion. now if i remove this console.log(`deposit ${balance}`) then the method in prototype run. but in class constructor function they automatially set the method into prototype so we dont need to set it manually<br>  //   };<br>  //   this.withdraw = function (balance) {<br>  //     // this.balance = this.withdraw - balance;<br>  //     // OR<br>  //     this.withdraw -= balance;<br>  //   };<br>}<br><br>BankAccount.prototype.deposit = function (balance) {<br>  this.balance += balance;<br>};<br><br>BankAccount.prototype.withdraw = function (balance) {<br>  this.balance -= balance;<br>};<br><br>console.log(BankAccount.prototype);<br>let AliAccount = new BankAccount(&quot;Ali&quot;, 150);<br>console.log(AliAccount);</pre><p>So if i don’t use prototype every new user has it own deposit and withdraw and this consume memory. And the function of deposit and withdraw are same method. So I use in prototype for memory efficient.</p><p>When you call a method like AliAccount.deposit(100), JavaScript follows the prototype chain to find where the deposit function is located.</p><p>Here is the step-by-step process:</p><ul><li>Look on the Object itself: JavaScript first looks for a deposit property directly on the AliAccount object.</li><li>Found it? If it finds a property named deposit on the object itself, it uses that one immediately and stops looking. It does not go to the prototype.</li><li>Not Found? If it does not find the property on the object itself, it then goes up the chain and looks at the object&#39;s prototype (BankAccount.prototype).</li><li>Found on Prototype? If it finds it there, it uses it.</li></ul><h4>Singleton:</h4><p>A <strong>singleton</strong> is a design pattern that <strong>allows only one instance of a class to exist</strong>.</p><p>So, no matter how many times you try to create it, you always get the <strong>same single object</strong>.</p><pre>const Singleton = (function() {<br>  let instance;<br><br>  function createInstance() {<br>    return { name: &quot;OnlyOne&quot; };<br>  }<br><br>  return {<br>    getInstance: function() {<br>      if (!instance) {<br>        instance = createInstance();<br>      }<br>      return instance;<br>    }<br>  };<br>})();<br><br>const obj1 = Singleton.getInstance();<br>const obj2 = Singleton.getInstance();<br><br>console.log(obj1 === obj2); // true</pre><h4>Four Pillar of OOP:</h4><h4><strong>1- Abstraction:</strong></h4><p>Hiding complexity and show the only essential features.</p><p><strong>Example:<br></strong>Like a car, if user want to drive a car they accerate it. and see the speed of car in dashboard. How the speed work, how behind the seen work, How they work or how mathematical operation work behind the seen hide this.</p><pre>class Car {<br>  fuel = 10;<br><br>  FuelBurn() {<br>    this.fuel -= 1;<br>  }<br><br>  start() {<br>    this.FuelBurn();<br>    console.log(`Car is starting...`);<br>  }<br>}<br><br>const buggati = new Car();<br>buggati.start();<br><br>console.log(buggati);  // Car is starting...   //  Car { fuel: 9 }<br><br>// So when we start they run the method start and burn the fuel, so dont need to burn fuel seprately, so when we call buggati.start(),  so car is start and also fuel burn so we hide complexity in single start method.But there is no security user can access private field like buggati.fuelBurn() outside so this error solve by Encapsulation.</pre><h4>2- Encapsulation:</h4><p>Hiding data inside objects and provide security.</p><h3>Example:</h3><p>The data which i don’t want to show to user restrict it. Like protectedRoute.</p><pre>class Car {<br>  #fuel = 10;<br><br>  FuelBurn() {<br>    this.#fuel -= 1;<br>  }<br><br>  start() {<br>    this.FuelBurn();<br>    console.log(`Car is starting...`);<br>  }<br>}<br><br>const buggati = new Car();<br>buggati.start();<br>buggati.#FuelBurn = 10000;<br>console.log(buggati);<br><br>// `Encapsulation`: we can also access the fuel and changes into it like buggati.fuel=10000; but there is no security so we cannot access private field we dont access it. So we can private field by #.</pre><h4>3- Inheritance:</h4><p>Using properties and methods from another object/class.</p><p>In Object-Oriented Programming (OOP), Inheritance works the same way. It’s a mechanism where one class (the child) can automatically get all the properties and methods of another class (the parent). The child class can then also have its own unique properties and methods.</p><pre>// Parent Class<br>class Parent {<br>  constructor(eyeColor, height) {<br>    this.eyeColor = eyeColor;<br>    this.height = height;<br>  }<br><br>  describeTraits() {<br>    console.log(`I have ${this.eyeColor} eyes and I am ${this.height}cm tall.`);<br>  }<br>}<br><br>// Child Class - Inherits but adds NOTHING new<br>class Child extends Parent {<br>  // The constructor is optional if you&#39;re not adding new properties!<br>  // JavaScript will automatically call the parent constructor with the provided arguments.<br>  // But we write it to be explicit.<br>  constructor(eyeColor, height) {<br>    super(eyeColor, height); // This is the key line for inheritance<br>    // The super keyword is how the child class talks to and gets stuff from its parent class.<br>  }<br>  // No new methods or properties are added.<br>}<br><br>// Let&#39;s see it in action<br>const mother = new Parent(&quot;blue&quot;, 170);<br>const child = new Child(&quot;blue&quot;, 180); // Inherits traits<br><br>console.log(&quot;Mother:&quot;);<br>mother.describeTraits(); // I have blue eyes and I am 170cm tall.<br><br>console.log(&quot;\nChild (Pure Inheritance, No Unique Traits):&quot;);<br>child.describeTraits(); // I have blue eyes and I am 180cm tall.<br>// The child used the *inherited* describeTraits() method.<br><br>// The child still has full access to the inherited properties<br>console.log(`\nThe child&#39;s eyes are ${child.eyeColor}.`); // blue<br>console.log(`The child&#39;s height is ${child.height}cm.`); // 180<br><br>// The &#39;instanceof&#39; check still proves inheritance<br>console.log(`Is the child an instance of Parent? ${child instanceof Parent}`); // true</pre><p><strong>Types of Inheritance:<br>1- Single Inheritance:<br></strong>One child inherits from <strong>one parent.</strong></p><pre>Parent → Child</pre><p><strong>2- Multilevel Inheritance:<br></strong>A class inherits from a class that already inherited from another class.</p><pre>Grandparent → Parent → Child</pre><p><strong>3- Hierarchical</strong> <strong>Inheritance:<br></strong>Multiple children inherit from <strong>one parent.</strong></p><pre>        Parent<br>       /      \<br>   Child1   Child2</pre><p>4- <strong>Multiple Inheritance:<br></strong>One child inherits from <strong>multiple parents.</strong></p><pre> Parent1   Parent2<br>     \     /<br>      Child</pre><p><strong>JavaScript does NOT support this directly</strong><br> (But it can be done using mixins.)</p><p><strong>5- Hybrid Inheritance:<br></strong>Combination of two or more inheritance types</p><pre>Multilevel + Multiple</pre><h4>4- <strong>Polymorphism:</strong></h4><p>Same method behaving differently based on the object.</p><p>The word sounds complex, but the idea is simple: &quot;Poly&quot; means many, and &quot;morph&quot; means forms. So, polymorphism means &quot;many forms&quot;.</p><p>In programming, it means the same action can be performed in different ways, depending on the object that is performing it.</p><p>Think of it like this: The action &quot;move&quot;.</p><ul><li>A fish moves by swimming.</li><li>A bird moves by flying.</li><li>A dog moves by running.</li></ul><p>The action is the same (“move”), but how it’s done (the implementation) is different for each animal.</p><h3>Why is it Useful?</h3><p>1- Simplify Code: You can write code that works with the general parent class, and it will automatically work with any child class. You don&#39;t need to write separate code for every single type.</p><p>1- Flexibility: You can add new child classes without changing the existing code that uses the parent class.</p><pre>class MediaPlayer {<br>  play() {<br>    console.log(`Play media`);<br>  }<br>}<br>class Music extends MediaPlayer {<br>  play() {<br>    console.log(&quot;Play music&quot;);<br>  }<br>}<br>class Video extends MediaPlayer {<br>  play() {<br>    console.log(&quot;play video&quot;);<br>  }<br>}<br>let o1 = new Music();<br>o1.play();<br>let o2 = new Video();<br>o2.play();<br>let o3 = new MediaPlayer();<br>o3.play();<br>// They all have play() method but work differently is called polymorphism.</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f0272bdccfa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript Function Basics Functions(Must-Know)]]></title>
            <link>https://medium.com/@aliairf92/javascript-function-basics-functions-must-know-eb615cabda3c?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb615cabda3c</guid>
            <category><![CDATA[function]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 06:50:52 GMT</pubDate>
            <atom:updated>2026-02-04T06:10:28.330Z</atom:updated>
            <content:encoded><![CDATA[<h3>Types of Functions:</h3><h4><strong>1- Function Declarations:</strong></h4><p>A function defined using the function keyword.</p><pre>function greet() {<br>  console.log(&quot;Hello!&quot;);<br>}</pre><h4><strong>2- Function Expression:</strong></h4><p>A function stored in a variable</p><pre>const greet = function () {<br>  console.log(&quot;Hello!&quot;);<br>};</pre><h4>3- Arrow Function:</h4><p>A shorter syntax and does not have its own this.</p><pre>const greet = () =&gt; {<br>  console.log(&quot;Hello!&quot;);<br>};</pre><h4>4- Anonymous Function:</h4><p>A function with no name (commonly used in callbacks).</p><pre>setTimeout(function () {<br>  console.log(&quot;Hi!&quot;);<br>}, 1000);</pre><h4>5- Named Function Expression:</h4><p>A function expression with a name.</p><pre>const greet = function sayHello(){<br>    console.log(&quot;Hello!&quot;)<br>}</pre><h4>6- IIFE Function (Immediately Invoked Function Expression) :</h4><p>Executes immediately after it’s created.</p><pre>(function(){<br>     console.log(&quot;Runs instantly!&quot;);<br>})()</pre><h4>7- Callback Function :</h4><p>A function passed as an argument to another function.</p><pre>// OR<br>// A callback function is a function that you pass into another function, and it gets called (used) later inside that function.<br><br>function createQuote(quote, callback){<br>  var myQuote = &quot;Like I always say, &quot; + quote;<br>  callback(myQuote);  // calling the callback!<br>}<br>function logQuote(quote){<br>  console.log(quote);<br>   /**<br>   * &quot;logQuote&quot; is the callback function<br>→    Because it’s passed into createQuote, and then called  inside it<br>  */<br>}<br>createQuote(&quot;eat your vegetables!&quot;, logQuote); // createQuote = higher order function<br>/**<br> * &quot;createQuote&quot; is the higher-order function<br>→ Because it takes a function (callback) as an argument.<br>*/</pre><h4>8- Constructor Function:</h4><p>Used to create objects; works with new.</p><pre>function Person(name) {<br>  this.name = name;<br>}</pre><h4>9- Async Function:</h4><p>Returns a Promise and uses await.</p><pre>async function fetchData() {<br>  return await &quot;data&quot;;<br>}</pre><h4>10- Method Function:</h4><p>Functions inside objects.</p><pre>const obj = {<br>  greet() {<br>    console.log(&quot;Hello!&quot;);<br>  }<br>};</pre><h4>11- Higher Order Function:</h4><p>It takes a function (callback) as an argument, return a function as result or does both.</p><pre>function High(data, callback) =&gt;{<br>    console.log(data + callback)<br>}<br>const callbackFun = () =&gt;{<br>    console.log(&quot;callback&quot;)<br>}<br>// callbackFun is a callback function because it pass into another function and it can called later inside that function.<br>const result = High(&quot;hello&quot;, callbackFun)   // result is higher order function because it take function as an argument.</pre><h4>12- Closure:</h4><p>closure happens when an inner function remembers and can use variables from its outer (parent) function, even after the parent function has finished running.</p><pre>function outer() {<br>  let count = 0;   // variable in outer function<br><br>  function inner() {<br>    count++;<br>    console.log(count);<br>  }<br><br>  return inner;   // return inner function<br>}<br><br>const myFunc = outer();  // outer() has finished running<br><br>myFunc(); // 1<br>myFunc(); // 2<br>myFunc(); // 3<br><br><br>/** Explanation:<br><br>1- outer() runs and creates count<br><br>2- outer() returns inner<br><br>3- Even though outer() is done,<br><br>4- inner() still remembers count<br><br>5- Each call updates the same count<br><br>**/<br></pre><h4>13- Lexical Scope:</h4><p>The inner function has access to the outer function’s variables.</p><pre>let x = 10;<br><br>function outer() {<br>  let y = 20;<br><br>  function inner() {<br>    console.log(x);<br>    console.log(y);<br>  }<br><br>  inner();<br>}<br><br>outer();  // 10 , // 20</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb615cabda3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Integrate AI in NestJS, React or any project.]]></title>
            <link>https://medium.com/@aliairf92/integrate-ai-in-nestjs-react-or-any-project-fa91f5f04612?source=rss-659412b6ad73------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa91f5f04612</guid>
            <category><![CDATA[ai-nestjs]]></category>
            <category><![CDATA[ai-in-web-development]]></category>
            <category><![CDATA[ai-in-react]]></category>
            <category><![CDATA[integrate-ai]]></category>
            <category><![CDATA[ai-in-web-application]]></category>
            <dc:creator><![CDATA[Ali]]></dc:creator>
            <pubDate>Mon, 02 Feb 2026 05:27:39 GMT</pubDate>
            <atom:updated>2026-02-02T05:27:39.781Z</atom:updated>
            <content:encoded><![CDATA[<p>First you understand why and where you need to integrate AI in project.<br>By following this you easily can integrate AI.</p><p><strong>Why I am integrate AI in my project:</strong></p><p>I developing a budget Financial E-Commerence web Application. In my case only admin can upload or create Product as shown in below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8biURYSW0YBwW-_rITO0kQ.png" /></figure><p>This is the admin dashboard of create-products section here admin can upload product manually set the product name, title, description, gender, category( Fashion, Cosmetics, Electronic and Grocery) and size (xs, sm, md, lg, xl, xxl, standard), price and stock. And right side is the live preview of product which i add.</p><p>I want i only admin can write name, price, stock and gender and other data AI gave us.</p><p><strong>NestJS:</strong></p><p>First you decide which AI api you need according to your requirement. I am using Gemini Api key from <a href="https://aistudio.google.com/">https://aistudio.google.com/</a>. First create a project with any name you want and get the GEMINI_API_KEY and save in your backend .env file:</p><p>GEMINI_API_KEY= YOUR_API_KEY</p><p>This is not my api key just for reference i show it. And it not correct.</p><p><strong>Install pakage:</strong></p><blockquote><em>npm install @google/generative-ai</em></blockquote><p>First you have to create another resource of AI for clean and scalable architecture.</p><p>create.ai.ts:</p><pre>import { IsString, IsNotEmpty, IsNumber } from &#39;class-validator&#39;;<br><br>export class CreateAiDto {<br>  @IsString()<br>  name: string;<br>  @IsNumber()<br>  price: number;<br>  @IsNumber()<br>  stock: number;<br>  @IsString()<br>  gender: string;<br>}</pre><p>because i only gave us to name, price , stock and gender and on this basis they predict the data and gave us.</p><p>ai.schema.ts:</p><pre>import { Prop, Schema, SchemaFactory } from &#39;@nestjs/mongoose&#39;;<br>import { HydratedDocument } from &#39;mongoose&#39;;<br>import { categoryEnum, genderEnum, SizeEnum } from &#39;../types/ai.type&#39;;<br><br>export type AiDocument = HydratedDocument&lt;Ai&gt;;<br>@Schema({<br>  timestamps: true,<br>})<br>export class Ai {<br>  @Prop({ required: true })<br>  name: string;<br>  @Prop({ required: true })<br>  title?: string;<br>  @Prop({ required: true })<br>  description?: string;<br>  @Prop({ required: true })<br>  price: number;<br>  @Prop({ required: true })<br>  stock: number;<br>  @Prop({ required: true })<br>  gender: string;<br>  @Prop({ required: true })<br>  category?: string;<br>  @Prop({ required: true })<br>  size?: string;<br>}<br>export const AiSchema = SchemaFactory.createForClass&lt;Ai&gt;;</pre><p>ai.controller.ts:<br>import the dto</p><pre>import { Controller, Get, Post, Body } from &#39;@nestjs/common&#39;;<br>import { AiService } from &#39;./ai.service&#39;;<br>import { CreateAiDto } from &#39;./dto/create-ai.dto&#39;;<br><br>@Controller(&#39;ai&#39;)<br>export class AiController {<br>  constructor(private readonly aiService: AiService) {}<br>  @Post(&#39;generate-product&#39;)<br>  async generate(@Body() createAiDto: CreateAiDto) {<br>    return this.aiService.generateProduct(createAiDto);<br>  }<br>}</pre><p>ai.service.ts:</p><pre>import { Injectable, InternalServerErrorException } from &#39;@nestjs/common&#39;;<br>import { CreateAiDto } from &#39;./dto/create-ai.dto&#39;;<br>import { GoogleGenerativeAI } from &#39;@google/generative-ai&#39;;<br>import { InjectModel } from &#39;@nestjs/mongoose&#39;;<br>import { Ai, AiSchema } from &#39;./schema/ai.schema&#39;;<br><br>const CATEGORY_LIST = [&#39;Electronic&#39;, &#39;Grocery&#39;, &#39;Fashion&#39;, &#39;Cosmetics&#39;];<br>const SIZE_LIST = [&#39;xs&#39;, &#39;sm&#39;, &#39;md&#39;, &#39;lg&#39;, &#39;xl&#39;, &#39;xxl&#39;, &#39;standard&#39;];<br><br>@Injectable()<br>export class AiService {<br>  private genAI: GoogleGenerativeAI;<br><br>  constructor() {<br>    const apiKey = process.env.GEMINI_API_KEY;  // get the key from .env<br><br>    if (!apiKey) {<br>      throw new InternalServerErrorException(<br>        &#39;GEMINI_API_KEY is missing in environment variables&#39;,<br>      );<br>    }<br><br>    this.genAI = new GoogleGenerativeAI(apiKey);  // pass the api_key<br>  }<br><br>  async generateProduct(createAiDto: CreateAiDto) {<br>    const model = this.genAI.getGenerativeModel({<br>      model: &#39;gemini-2.5-flash-lite&#39;,  // which model you want to use.<br>    });<br><br>// if you want to check which model is best for you project.<br>// run this project in your code terminal:<br>// curl &quot;https://generativelanguage.googleapis.com/v1beta/models?key=API_KEY&quot;<br><br>    const prompt = `    // this is the prompt i gave to AI<br>You are an eCommerce product content writer.<br><br>// get data from dto:<br><br><br>Product Name: ${createAiDto.name}<br>Price: ${createAiDto.price}<br>Gender: ${createAiDto.gender}<br><br>Choose ONLY ONE category from the list below:<br>[Electronic, Grocery, Fashion, Cosmetics]<br><br>Choose ONLY ONE size from the list below:<br>[xs, sm, md, lg, xl, xxl, standard]<br><br>Generate SEO-friendly content.<br>Return ONLY valid JSON in this format:<br><br>{<br>  &quot;title&quot;: &quot;&quot;,<br>  &quot;description&quot;: &quot;&quot;,<br>  &quot;category&quot;: &quot;&quot;,<br>  &quot;size&quot;: &quot;&quot;<br>}<br>    `;<br><br>// then according to our data they gave us the data.<br><br>    const result = await model.generateContent(prompt);<br>// then pass the prompt to AI.<br>    const text = result.response.text();<br><br>// get the response in text<br><br>    // Clean markdown code blocks<br>    const cleaned = text<br>      .replace(/```json/g, &#39;&#39;)<br>      .replace(/```/g, &#39;&#39;)<br>      .trim();<br><br>    const parsed = JSON.parse(cleaned);<br><br>    // Validate category<br>    if (!CATEGORY_LIST.includes(parsed.category)) {<br>      parsed.category = &#39;Fashion&#39;; // default<br>    }<br><br>    // Validate size<br>    if (!SIZE_LIST.includes(parsed.size)) {<br>      parsed.size = &#39;standard&#39;; // default<br>    }<br><br>    return {<br>      name: createAiDto.name,<br>      price: createAiDto.price,<br>      stock: createAiDto.stock,<br>      gender: createAiDto.gender,<br>      ...parsed,<br>    };<br>  }<br>}</pre><p>category_list = because i only want category AI can choose category in this.<br>size_list = same for size</p><blockquote><em>import the GoogleGenerativeAI from @google/generative-ai</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S4R1o5lZfDSzOlB5V0zgxA.png" /></figure><p>I test in bruno the ai is properly working. Now it frontend turn.</p><p><strong>Frontend:</strong></p><p>ai.thunk.ts:</p><pre>export const AiProductThunk = createAsyncThunk(<br>  &quot;ai/product&quot;,<br>  async (data: AiProduct, { rejectWithValue }) =&gt; {<br>    try {<br>      const response = await api.post(`ai/generate-product`, data);<br>      console.log(response.data, &quot;get-product-by- id&quot;);<br>      return response.data;<br>    } catch (error) {<br>      const err = error as AxiosError&lt;{ message: string }&gt;;<br>      toast.error(<br>        err.response?.data.message || &quot;Failed To Generate Ai, Try Again&quot;,<br>      );<br>      return rejectWithValue(<br>        err.response?.data.message || &quot;Failed To Generate Ai, Try Again&quot;,<br>      );<br>    }<br>  },<br>);</pre><p>ai.slice.ts:</p><pre>const AiproductsSlice = createSlice({<br>  name: &quot;Aiproducts&quot;,<br>  initialState,<br>  reducers: {},<br>  extraReducers: (builder) =&gt; {<br>    builder<br>      .addCase(AiProductThunk.pending, (state) =&gt; {<br>        state.loading.aiProductLoading = true;<br>        state.error.aiProductError = null;<br>      })<br>      .addCase(AiProductThunk.fulfilled, (state, action) =&gt; {<br>        state.loading.aiProductLoading = false;<br>        state.items = action.payload;   // when the thunk is successfully run the data in items.<br>      })<br>      .addCase(AiProductThunk.rejected, (state, action) =&gt; {<br>        state.loading.aiProductLoading = false;<br>        state.error.aiProductError =<br>          (action.payload as string) || &quot;Failed To Generate Ai, Try Again&quot;;<br>      });<br>  },<br>});</pre><p>AiProduct.tsx:</p><pre>const handleGenerativeAi = () =&gt; {<br>  if (data.price &lt;= 0 || data.stock &lt;= 0 || !data.name) {<br>    return setLocalError(&#39;All Field are required&#39;);<br>  }<br>  dispatch(     // dispatch the data.<br>    AiProductThunk({<br>      ...data,<br>     price: Number(data.price),<br>      stock: Number(data.stock),<br>    }),<br>  );<br>  setOpen(false);<br>};</pre><p>UploadProducts.tsx:</p><pre>const { items } = useAppSelector((state) =&gt; state.aiProductGenerator);<br>// if the data get from items.<br>  useEffect(() =&gt; {<br>    if (!items) return;<br>setName(items.name ?? &quot;&quot;);<br>    setTitle(items.title ?? &quot;&quot;);<br>    setDescription(items.description ?? &quot;&quot;);<br>    setCategory((items.category as categoryLevel) ?? &quot;Fashion&quot;);<br>    setSize((items.size as sizelevel) ?? &quot;md&quot;);<br>    setPrice(items.price ?? 0);<br>    setStock(items.stock ?? 1);<br>    setGender((items.gender as genderLevel) ?? null);<br>  }, [items]);</pre><p>JSX:</p><pre>&lt;div className=&quot;space-y-2&quot;&gt;<br>  &lt;Label&gt;Name&lt;/Label&gt;<br>  &lt;Input<br>    placeholder=&quot;e.g. Jacket&quot;<br>    value={name}<br>    onChange={(e) =&gt; {<br>      setName(e.target.value);<br>      setError(&#39;&#39;);<br>    }}<br>    required<br>  /&gt;<br>&lt;/div&gt;</pre><p>In last whenever admin cannot upload image of product Generate with AI<br>disabled as shown in first image.</p><p>Now it time to show you it working in Frontend, Backend and store in Database MongoDB when admin click create Product button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l3PNExrCsnZuzAkGJKF12w.png" /></figure><p>After i upload image the generate with AI button is working. When i click it they open a dialog box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*Ikq9At1N0Tzh9Wo7QLkIFQ.png" /></figure><p>After filling the details and when i click generate button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*R0WEQl0puktCYb_jQfRjEA.png" /></figure><p>the data AI Generate and shown in Input.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q8Snp3lfGx_sV7bXEdt8UA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y-rasMbQmIdjonXnxBPFxQ.png" /></figure><p>So i successfully get the data from AI and when i click create products they save in products collection in database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/918/1*xpW0g8z6RSdzZvan6ud61w.png" /></figure><p>Thanks for reading article. I hope you get knowledge and learn something new from here bye.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa91f5f04612" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>