<?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 Praveen Kalansooriya on Medium]]></title>
        <description><![CDATA[Stories by Praveen Kalansooriya on Medium]]></description>
        <link>https://medium.com/@kalansooriya615?source=rss-8454f1cab4bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*qeoRnFbs9wQ6_ol5</url>
            <title>Stories by Praveen Kalansooriya on Medium</title>
            <link>https://medium.com/@kalansooriya615?source=rss-8454f1cab4bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 09:38:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kalansooriya615/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[ JWT Authentication වැඩ කරන විදිහ: Login Button එක Click කළාම ඇත්තටම වෙන්නේ මොකක්ද?]]></title>
            <link>https://medium.com/@kalansooriya615/jwt-authentication-%E0%B7%80%E0%B7%90%E0%B6%A9-%E0%B6%9A%E0%B6%BB%E0%B6%B1-%E0%B7%80%E0%B7%92%E0%B6%AF%E0%B7%92%E0%B7%84-login-button-%E0%B6%91%E0%B6%9A-click-%E0%B6%9A%E0%B7%85%E0%B7%8F%E0%B6%B8-%E0%B6%87%E0%B6%AD%E0%B7%8A%E0%B6%AD%E0%B6%A7%E0%B6%B8-%E0%B7%80%E0%B7%99%E0%B6%B1%E0%B7%8A%E0%B6%B1%E0%B7%9A-%E0%B6%B8%E0%B7%9C%E0%B6%9A%E0%B6%9A%E0%B7%8A%E0%B6%AF-96d75edd03aa?source=rss-8454f1cab4bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d75edd03aa</guid>
            <dc:creator><![CDATA[Praveen Kalansooriya]]></dc:creator>
            <pubDate>Fri, 24 Jul 2026 17:58:56 GMT</pubDate>
            <atom:updated>2026-07-24T17:58:56.730Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*ee1_a_insOVljOW7" /></figure><h3>JWT Authentication වැඩ කරන විදිහ: Login Button එක Click කළාම ඇත්තටම වෙන්නේ මොකක්ද?</h3><p>ඔයා කවදාහරි හිතලා තියෙනවද?</p><p>Login button එක click කළාට පස්සේ backend එක ඇතුළේ ඇත්තටම වෙන්නේ මොකක්ද කියලා?</p><p>Email එකයි password එකයි දුන්නාම server එක කොහොමද අපිව හඳුනාගන්නේ?</p><p>අපි website එකකට හෝ application එකකට login වෙනකොට, අපිට පේන්නේ simple process එකක් වුණත්, ඒ පිටිපස්සේ security mechanisms ගොඩක් වැඩ කරනවා.</p><p>අද අපි ඒ අතරින් බහුලව භාවිතා වන concept එකක් වන:</p><p>JWT Authentication</p><p>ගැන සරලව තේරුම් ගමු.</p><h3>JWT කියන්නේ මොකක්ද?</h3><p>JWT කියන්නේ:</p><p>JSON Web Token</p><p>කියන එකේ short form එක.</p><p>සරලව කිව්වොත්:</p><p>JWT කියන්නේ user කෙනෙක් authenticate වුණා පසුව, ඔහුගේ identity information verify කිරීමට සහ exchange කිරීමට භාවිතා කරන token එකක්.</p><p>JWT භාවිතා කරන්නේ:</p><ul><li>User identity maintain කිරීමට</li><li>Protected resources access කිරීමට</li><li>Authentication process එක manage කිරීමට</li></ul><h3>Login Process එක ඇතුළේ වෙන්නේ මොකක්ද?</h3><p>සාමාන්ය JWT authentication flow එක:</p><pre>User<br> |<br> | Email + Password<br> ↓<br>Frontend<br> |<br> | Login Request<br> ↓<br>Backend Server<br> |<br> | Verify User<br> ↓<br>Database<br> |<br> | Generate JWT Token<br> ↓<br>Frontend<br> |<br> | Store Token<br> ↓<br>Dashboard</pre><p>දැන් මේ steps එකින් එක බලමු.</p><h3>1. User Login Request</h3><p>User email සහ password enter කරනවා.</p><p>Example:</p><pre>{<br>  &quot;email&quot;: &quot;user@gmail.com&quot;,<br>  &quot;password&quot;: &quot;123456&quot;<br>}</pre><p>Frontend application එක මේ data backend API එකට send කරනවා.</p><p>Example:</p><pre>POST /api/login</pre><h3>2. Backend User Verify කිරීම</h3><p>Backend එක request එක receive කළාට පස්සේ:</p><ul><li>Email එකෙන් user හොයනවා</li><li>Database එකේ password verify කරනවා</li></ul><p>Flow එක:</p><pre>User Exists?<br>      |<br>      ↓<br>Password Correct?<br>      |<br>      ↓<br>Generate Token</pre><p>Credentials වැරදි නම්:</p><pre>401 Unauthorized</pre><p>response එක return කරනවා.</p><p>Note: Real applications වල passwords direct database එකේ store කරන්නේ නැහැ. සාමාන්යයෙන් hashing techniques (example: bcrypt) භාවිතා කරනවා.</p><h3>3. JWT Token Generate කිරීම</h3><p>User details valid නම් server එක JWT token එකක් create කරනවා.</p><p>JWT token එකේ ප්රධාන කොටස් 3ක් තියෙනවා:</p><pre>Header.Payload.Signature</pre><h3>Header</h3><p>Token type එක සහ signing algorithm එක පිළිබඳ information තියෙනවා.</p><p>Example:</p><pre>{<br> &quot;alg&quot;:&quot;HS256&quot;,<br> &quot;typ&quot;:&quot;JWT&quot;<br>}</pre><h3>Payload</h3><p>User information store කරනවා.</p><p>Example:</p><pre>{<br> &quot;id&quot;:101,<br> &quot;role&quot;:&quot;student&quot;<br>}</pre><p>Important: Payload එක encrypted නොවන නිසා passwords වැනි sensitive information store කරන්න එපා.</p><h3>Signature</h3><p>Token එක modify කරලා නැහැ කියලා verify කිරීමට භාවිතා කරනවා.</p><h3>4. Token එක Frontend එකට Send කිරීම</h3><p>Backend එක token එක frontend එකට return කරනවා.</p><p>Example:</p><pre>{<br> &quot;message&quot;:&quot;Login Success&quot;,<br> &quot;token&quot;:&quot;eyJhbGciOi...&quot;<br>}</pre><p>Frontend එක මෙම token එක store කරනවා.</p><p>Common methods:</p><ul><li>Cookies</li><li>Local Storage</li></ul><h3>5. Protected API Requests</h3><p>දැන් user dashboard එකෙන් data request කරනවා.</p><p>Example:</p><pre>GET /api/profile</pre><p>Request එකත් සමඟ JWT token එක යවනවා:</p><pre>Authorization:<br>Bearer &lt;token&gt;</pre><p>එවිට backend එකට verify කරන්න පුළුවන්:</p><p>“මෙම request එක authenticate වුණු user කෙනෙක්ගෙන්ද?”</p><p>කියලා.</p><h3>Middleware එකේ Role එක</h3><p>Backend application එකක middleware එක request එක සහ controller එක අතර security layer එකක් ලෙස වැඩ කරනවා.</p><p>Flow එක:</p><pre>Request<br>   |<br>   ↓<br>JWT Middleware<br>   |<br>   ↓<br>Validate Token<br>   |<br>   ↓<br>Controller<br>   |<br>   ↓<br>Response</pre><p>Middleware එක:</p><ul><li>Token තිබෙනවාද බලනවා</li><li>Token valid ද verify කරනවා</li><li>User information extract කරනවා</li></ul><p>Token valid නම් request එක controller එක වෙත යවනවා.</p><h3>Token Invalid වුණොත්?</h3><p>Examples:</p><ul><li>Token expired</li><li>Token modified</li><li>Token missing</li></ul><p>Response:</p><pre>403 Forbidden</pre><p>ලැබෙනවා.</p><h3>JWT භාවිතා කරන්නේ ඇයි?</h3><p>Traditional session authentication වලට වඩා JWT වල advantages:</p><ul><li>Server එකේ session data store කිරීම අවශ්ය නැහැ</li><li>API-based applications සඳහා සුදුසුයි</li><li>Multiple servers සමඟ scale කිරීම පහසුයි</li><li>Frontend සහ Backend separate applications ලෙස develop කළ හැක</li></ul><h3>Real Project Example</h3><p>MERN Stack applications වල authentication implement කරන විට JWT බහුලව භාවිතා කරනවා.</p><p>Example flow:</p><pre>User Login<br>     ↓<br>JWT Token Generate<br>     ↓<br>Middleware Verification<br>     ↓<br>Access Dashboard</pre><p>Library Management System වැනි application එකක:</p><h3>Student Login</h3><pre>{<br> &quot;userId&quot;:25,<br> &quot;role&quot;:&quot;student&quot;<br>}</pre><h3>Admin Login</h3><pre>{<br> &quot;userId&quot;:1,<br> &quot;role&quot;:&quot;admin&quot;<br>}</pre><p>මෙම role information භාවිතා කරලා permissions control කරන්න පුළුවන්.</p><p>Example:</p><pre>Student → Borrow Books</pre><pre>Admin → Manage Users</pre><p>මෙය:</p><p>Role-Based Access Control (RBAC)</p><p>ලෙස හඳුන්වනවා.</p><h3>Key Takeaways</h3><p>JWT Authentication වලදී:</p><p>✓ Password නැවත නැවත send කිරීම අවශ්ය නැහැ</p><p>✓ User identity securely verify කළ හැක</p><p>✓ Stateless authentication implement කළ හැක</p><p>✓ Role-Based Access Control implement කළ හැක</p><h3>Conclusion</h3><p>Login button එක click කරන එක simple action එකක් වුණත්, ඒ පිටිපස්සේ:</p><ul><li>Request Handling</li><li>Database Verification</li><li>Token Generation</li><li>Middleware Validation</li></ul><p>වැනි වැදගත් processes ගොඩක් සිද්ධ වෙනවා.</p><p>Software Engineering ඉගෙනගන්න කෙනෙක් විදිහට code එක ලියන එක විතරක් නොවෙයි, ඒ code එක ඇතුළෙන් වැඩ කරන ආකාරය තේරුම් ගැනීමත් ඉතා වැදගත්.</p><p>Keep learning. Keep building.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d75edd03aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Week 01 — Backend Development]]></title>
            <link>https://medium.com/@kalansooriya615/week-01-backend-development-a9a8499e206b?source=rss-8454f1cab4bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9a8499e206b</guid>
            <dc:creator><![CDATA[Praveen Kalansooriya]]></dc:creator>
            <pubDate>Sun, 08 Mar 2026 04:47:29 GMT</pubDate>
            <atom:updated>2026-03-08T04:47:29.270Z</atom:updated>
            <content:encoded><![CDATA[<p>Week 01 — Backend Development</p><p>I learnt about below topics,</p><ul><li>How to Express App setup</li><li>Routing</li><li>Middleware</li><li>req.params</li><li>req.query</li><li>req.body</li><li>MVC structure</li><li>Error handaling</li></ul><p><strong>What is Node.js</strong> ?</p><p>Node.js is runtime environment that allows you to run JS on the server(backend) instead of only web browser,</p><p><strong>example</strong></p><p>without Node.js:</p><ul><li>JS runs only in the browser for UI</li></ul><p>with Node.js:</p><ul><li>JS can create web servers, APIs, Databases connections, Real-time apps</li></ul><p><strong>What is npm?</strong></p><p>npm is a tool used with Node.js to install and manage JS packages.</p><p>(package manager for JS)</p><p>it helps developers:</p><ul><li>install libraries</li><li>Manage project dependencies</li><li>run scripts</li></ul><p><strong>example</strong></p><p>If you want to build a server using <strong>Express.js</strong>, you install it using npm.</p><p>command : npm install express</p><p>npm will:</p><p>01. Download express</p><p>02. Add it to your project</p><p>03. Save it inside a node_modules folder</p><p><strong>What is Nodemon ?</strong></p><p>Nodemon is a development tool that automatically restarts your node.js server when you save changes in your code</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*LY3znez6j74MCx1I7oex6g.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9a8499e206b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CORS middleware]]></title>
            <link>https://medium.com/@kalansooriya615/what-is-cors-middleware-3b3a711073af?source=rss-8454f1cab4bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b3a711073af</guid>
            <dc:creator><![CDATA[Praveen Kalansooriya]]></dc:creator>
            <pubDate>Sun, 01 Mar 2026 14:40:39 GMT</pubDate>
            <atom:updated>2026-03-01T14:40:39.502Z</atom:updated>
            <content:encoded><![CDATA[<p>CORS stands for <strong>Cross-Origin Resource Sharing</strong>.</p><p>It is a browser security feature that controls <strong>which frontend domains are allowed to access your backend API</strong>.</p><p><a href="http://localhost:5000/">http://localhost:5000</a></p><p><a href="http://localhost:5000/">http://localhost:3000</a></p><p>These are considered different origins.So browser block the request unless CORS is enabled.</p><ul><li>Protocol → http / https</li><li>Domain → localhost / example.com</li><li>Port → 3000 / 5000</li></ul><p>Also these are know as different origins.</p><p><strong>What is Duty of CORS middleware?</strong></p><p>CORS allows frontend applications from different from different origins access to backend.</p><p>Now i show you basic usage of CORS package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*u6ukA-OAInuvz35oPhfpvg.jpeg" /></figure><p>Now i show you how to make CORS for specific origins only.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*RtWiFg_YMBoRKiUmVnF-yg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b3a711073af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I finally Understood useState in React]]></title>
            <link>https://medium.com/@kalansooriya615/how-i-finally-understood-usestate-in-react-c1a850b40287?source=rss-8454f1cab4bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1a850b40287</guid>
            <category><![CDATA[usestate]]></category>
            <category><![CDATA[react-usestate]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[usestate-hook]]></category>
            <dc:creator><![CDATA[Praveen Kalansooriya]]></dc:creator>
            <pubDate>Tue, 24 Feb 2026 15:06:44 GMT</pubDate>
            <atom:updated>2026-02-24T15:06:44.805Z</atom:updated>
            <content:encoded><![CDATA[<p>When I first started learning React, everything looked magical.when considering useState hook,</p><p>const [count,setCount] = useState(0);<br>I thought,</p><ul><li>Why is this an array ?</li><li>What is setCount ?</li><li>Why cant we just use a normal varible ?</li></ul><p>That is when my conclution about useState started.</p><p><strong>Why Normal Variable Don’t Work</strong></p><p>At first i tried this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*dwJA3yKuUOIq1T4GTYQ9tw.jpeg" /></figure><p>The value increased in the console. But the UI didnt change.That’s when i learned something important:</p><p><strong>React does not re-render when normal variables change.React only re-renders when state changes.</strong></p><p><strong>What is useState?</strong></p><p>So it is a react hook,that lets you add state to a functional component.</p><p>const [count,setCount] = useState(0)</p><p>count- stores the initial value 0</p><p>setCount - updates the value and re-render the component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*bzj3yneQZZ0kUdHjw_wicg.jpeg" /></figure><p>now when the button is clicked,</p><ul><li>setCount() updates the value</li><li>React re-render the component</li><li>UI updates automatically</li></ul><p>That is the power of state.</p><p><strong>My Final Thoughts</strong></p><p>If you are learning react and feel confused about useState,that’s normal thing.</p><p>just remember:</p><ul><li>Normal variables don’t trigger UI changes</li><li>States does</li><li>Always use the setter function</li></ul><p>reference -<a href="https://react.dev/reference/react/useState">useState — React</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1a850b40287" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Compelete UI/UX Design Process]]></title>
            <link>https://medium.com/@kalansooriya615/the-compelete-ui-ux-design-process-7f2263766279?source=rss-8454f1cab4bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f2263766279</guid>
            <dc:creator><![CDATA[Praveen Kalansooriya]]></dc:creator>
            <pubDate>Wed, 10 Sep 2025 08:26:43 GMT</pubDate>
            <atom:updated>2026-02-24T13:27:33.179Z</atom:updated>
            <content:encoded><![CDATA[<p>Disigning a digital product isn’t just about making it look pretty.its about solving problems for real people.A solid UI/UX process helps you create products that are <strong>usable, enjoyable, and impactful.</strong> Here’s step by step breakdown of the Key stages of the every designer should know.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W0Egl0nElxFipKry00Y6Qg.jpeg" /></figure><p><strong>01. Research and Define</strong></p><p>Goal: Understand who you’re designing for and what problem you’re solving.<br>Do: Interview users, analyze reviews and analytics, and study competitors.<br>Output: User personas, a clear problem statement, and a prioritized feature list.</p><p><strong>02. Information Architecture</strong></p><p>Goal: Organize content and flows so users can achieve their goals easily.<br>Do: Create a sitemap and draw user flows for key tasks (e.g., order → checkout → track).<br>Output: Sitemap and 2–3 annotated user flows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-4d3KiB8m6kIYu7HLdIWBQ.png" /></figure><p><strong>03.Wireframing</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*94AsKVrEowcol8g2fgapeA.png" /></figure><p>Goal: Solve layout and structure before adding visual details.<br>Do: Sketch screens (paper → digital), define content hierarchy, and consider different states (empty, error).<br>Output: Low-fidelity clickable prototype of core flows.</p><p><strong>04. Visual Design</strong></p><p>Goal: Define the look, feel, and consistency of the app.<br>Do: Create design tokens (colors, typography), build reusable components, and design polished screens.<br>Output: UI kit/component library and high-fidelity mockups.</p><p><strong>05.Prototyping</strong></p><p>Goal: Bring designs to life with interactions and motion.<br>Do: Link screens into a clickable prototype and add key transitions/micro-interactions.<br>Output: Interactive prototype you can test on real devices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sRjOUYpmv87xzB9rr3HxEQ.png" /></figure><p><strong>06.Usability Testing</strong></p><p>Goal: Identify and fix usability issues before launch.<br>Do: Test with 5–8 users, track success rate/time, and collect qualitative feedback.<br>Output: Usability test report with prioritized fixes.</p><p><strong>7. Developer Handoff</strong></p><p>Goal: Ensure accurate and efficient implementation.<br>Do: Export assets, share design tokens/CSS variables, and provide specs via Figma Inspect or Storybook.<br>Output: Handoff package (assets, specs, and documentation).</p><p><strong>8. Implementation &amp; QA</strong></p><p>Goal: Validate that the final build matches the design and works as expected.<br>Do: Review builds, check accessibility and responsiveness, file and verify bugs.<br>Output: QA checklist, bug reports, and sign-off.</p><p><strong>9. Launch &amp; Iterate</strong></p><p>Goal: Improve continuously using real-world data.<br>Do: Monitor analytics, collect user feedback, run A/B tests, and evolve your design system.<br>Output: Performance metrics and a roadmap for improvements.</p><p><strong>Final Thoughts</strong></p><p>UI/UX design is an iterative journey — not a one-time task. Each stage builds on the last, helping you craft experiences that truly work for users. Whether you’re building your first app or improving an existing product, following this process ensures you move from guesswork to clarity, and from chaos to impact.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f2263766279" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey into UI/UX]]></title>
            <link>https://medium.com/@kalansooriya615/my-journey-into-ui-ux-86de4dccdad6?source=rss-8454f1cab4bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/86de4dccdad6</guid>
            <dc:creator><![CDATA[Praveen Kalansooriya]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 09:00:44 GMT</pubDate>
            <atom:updated>2025-08-26T09:00:44.163Z</atom:updated>
            <content:encoded><![CDATA[<p>I began as a graphic designer, creating posters and social media designs. Over time, I realized design isn’t just about visuals.it’s about <strong>experiences</strong>. That curiosity led me into <strong>UI/UX design and web development</strong>.</p><p>My first big step was designing a <strong>tourism blog</strong> and later working on <strong>GreenLearn</strong>, an educational website for kids. These projects taught me how to balance creativity with usability.</p><p>Now, I’m learning <strong>Next.js, Tailwind CSS, and Figma</strong>, aiming to become a <strong>UI/UX Engineer</strong> .someone who can turn ideas into beautiful, functional products.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86de4dccdad6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>