<?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 Dinuja Ranaweera on Medium]]></title>
        <description><![CDATA[Stories by Dinuja Ranaweera on Medium]]></description>
        <link>https://medium.com/@dinujachamodi?source=rss-44259562a94e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_x1ertefZUJqKFEn0EbWCQ.jpeg</url>
            <title>Stories by Dinuja Ranaweera on Medium</title>
            <link>https://medium.com/@dinujachamodi?source=rss-44259562a94e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:42:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dinujachamodi/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[Securing DevCanvas: My Experience with OIDC, Asgardeo, RBAC and OWASP]]></title>
            <link>https://medium.com/@dinujachamodi/securing-devcanvas-my-experience-with-oidc-asgardeo-rbac-and-owasp-8d7b86f47fa3?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d7b86f47fa3</guid>
            <category><![CDATA[oidc]]></category>
            <category><![CDATA[asgardeo]]></category>
            <category><![CDATA[rbac-and-owasp]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 08:00:40 GMT</pubDate>
            <atom:updated>2026-08-31T11:37:54.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IWlHng_czJUShySseXq84w.png" /></figure><p>Security is one of the most important parts of a web application.</p><p>When developing a project, it is easy to focus mainly on whether the features are working correctly. Users should be able to log in, create projects, upload images, and use the application without errors.</p><p>But a working application is not necessarily a secure application.</p><p>For my <strong>Secure Web Application Development assessment</strong>, I worked on improving the security of our existing <strong>DevCanvas — Student Project Showcase Portal</strong>. I focused on authentication, authorization, access-token validation, OWASP Top 10 vulnerabilities, and secure application configuration.</p><p>This was a good opportunity for me to look at a project that I already knew from a completely different perspective.</p><p>Instead of asking only:</p><blockquote><em>“Does this feature work?”</em></blockquote><p>I started asking:</p><blockquote><em>“What happens if someone tries to misuse this feature?”</em></blockquote><p>For example, what happens if someone tries to access an API without logging in? What if an authenticated user tries to access another user’s project? What if someone sends malicious input to the backend? What if someone tries to upload an unsafe file?</p><p>These questions helped me understand that security is not a single feature that can simply be added at the end of development. It needs to be considered throughout the application.</p><p>For this assessment, I enhanced DevCanvas with <strong>Asgardeo and OpenID Connect (OIDC) authentication, access-token validation, role-based access control, resource ownership checks, OWASP-related security controls, input validation, secure file uploads, HTTPS, CORS, security headers, environment-based configuration and security logging</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qkJya-1d8Khdi1cPO-0Qwg.png" /><figcaption>Home page</figcaption></figure><h3>1. Starting with the Existing Application</h3><p>Since DevCanvas was already developed, I first reviewed the existing application before introducing the security changes.</p><p>I looked at the frontend API requests, backend routes, controllers, database models and existing authentication-related functionality.</p><p>I then identified the areas where security controls were required:</p><ul><li>Authentication</li><li>Authorization</li><li>Access-token validation</li><li>User information</li><li>Role-based access control</li><li>Resource ownership</li><li>Input validation</li><li>Database security</li><li>File upload security</li><li>HTTPS</li><li>CORS</li><li>Security headers</li><li>Secrets and configuration</li><li>Logging and error handling</li></ul><p>One of the main challenges was implementing these security improvements while keeping the existing functionality of DevCanvas working correctly.</p><h3>2. User Roles and Access Control</h3><p>DevCanvas supports three main user roles:</p><pre>STUDENT<br>RECRUITER<br>ADMIN</pre><p>Each role has different permissions within the application.</p><p><strong>Students</strong> can manage their own projects and profile-related information.</p><p><strong>Recruiters</strong> can access the relevant project showcase functionality.</p><p><strong>Admins</strong> have higher-level administrative privileges.</p><p>To enforce these permissions, I implemented <strong>Role-Based Access Control (RBAC)</strong> on the backend.</p><p>The basic idea is:</p><pre>Authenticated User<br>        ↓<br>Identify User Role<br>        ↓<br>Check Required Permission<br>        ↓<br>Allow / Reject Request</pre><p>For example:</p><pre>Student → Student functionality → Allowed<br>Student → Admin functionality   → Forbidden<br>Recruiter → Admin functionality → Forbidden<br>Admin → Admin functionality     → Allowed</pre><p>This is important because frontend restrictions alone are not sufficient. Even if a button is hidden, a user could still attempt to call the API directly.</p><p>Therefore, authorization decisions are enforced by the backend.</p><blockquote>Student view</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rJc5dgzyy0Ec8SV4HnhZQg.png" /></figure><blockquote>Recruiter view</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QGEksC9FP3g6fa93BJQA9w.png" /><figcaption>Recruiter view</figcaption></figure><blockquote>Admin view</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FvBAVG4FjIeatXLiCM8h4Q.png" /></figure><h3>3. Authentication with Asgardeo and OIDC</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UkE3xY8dDgIPCl2lfcbpJw.png" /></figure><p>The assessment required authentication and logout using either <strong>OIDC or SAML</strong> with a cloud-based Identity Provider.</p><p>For my implementation, I selected <strong>Asgardeo</strong> and used <strong>OpenID Connect (OIDC)</strong>.</p><p>I implemented the <strong>Authorization Code Flow with PKCE</strong>.</p><p>The authentication flow can be summarized as:</p><pre>User<br> ↓<br>DevCanvas Login<br> ↓<br>Asgardeo<br> ↓<br>User Authentication<br> ↓<br>Authorization Code<br> ↓<br>Backend Token Exchange<br> ↓<br>Access Token<br> ↓<br>Backend Validation<br> ↓<br>Authenticated User</pre><p>The application requests OIDC scopes such as:</p><pre>openid profile email phone</pre><p>I also implemented <strong>PKCE (Proof Key for Code Exchange)</strong>. A secure code verifier is generated and a SHA-256-based challenge is created from it.</p><p>The challenge is sent during the authorization request, while the verifier is used during the token exchange.</p><p>This provides additional protection for the authorization code flow.</p><h3>4. Login, Logout and Authentication Testing</h3><p>After implementing OIDC authentication, I tested the complete authentication flow rather than only checking whether the login page worked.</p><p>I tested:</p><ul><li>Student login</li><li>Recruiter login</li><li>Logout</li><li>Login again after logout</li><li>Switching between accounts</li><li>Invalid authentication</li><li>Requests without authentication</li></ul><p>For protected API requests without valid authentication, the backend returns:</p><pre>401 Unauthorized</pre><p>This confirmed that protected functionality was not relying only on frontend login state.</p><p>Logout was also tested to ensure that a user could end their authenticated session and subsequently authenticate again when required.</p><h3>5. Displaying Authenticated User Information</h3><p>The assessment also requires the application to display information about the authenticated user.</p><p>After authentication, DevCanvas obtains information associated with the authenticated identity, including information such as:</p><ul><li>Username</li><li>Email</li><li>First name</li><li>Last name</li><li>Phone number</li><li>User ID</li></ul><p>The application provides a protected endpoint:</p><pre>GET /api/auth/me</pre><p>The backend uses the authenticated request to retrieve the user’s information.</p><p>This is important because the application should not simply trust a username or user ID submitted by the frontend.</p><p>Instead, the user’s identity comes from the authenticated request.</p><p>This same authenticated identity can then be used by other protected APIs when determining what the user is allowed to access.</p><h3>6. Validating and Using Access Tokens</h3><p>One of the most important requirements of the assessment was <strong>validating and using access tokens to perform application functionality</strong>.</p><p>When a protected API request is made, the access token is provided using:</p><pre>Authorization: Bearer &lt;access-token&gt;</pre><p>The backend validates the token before processing the request.</p><p>The validation includes:</p><ul><li>Signature verification</li><li>Issuer (iss) validation</li><li>Audience (aud) validation</li><li>Expiration (exp) validation</li></ul><p>Asgardeo tokens are validated using <strong>RS256 and JWKS public keys</strong>.</p><p>The process is:</p><pre>Access Token<br>     ↓<br>Signature Verification<br>     ↓<br>Issuer Check<br>     ↓<br>Audience Check<br>     ↓<br>Expiration Check<br>     ↓<br>Authenticated Identity</pre><p>This is different from simply decoding a JWT.</p><p>Decoding allows the application to read the token contents, but it does not prove that the token is genuine.</p><p>The backend therefore performs actual verification before trusting the identity information.</p><p>The validated identity is then used for <strong>authorization and resource ownership checks</strong>.</p><p>For example, when a Student requests their project information, the backend can use the authenticated identity rather than simply trusting a user ID supplied by the client.</p><p>This was one of the most important security improvements because the access token is being used as part of the actual application authorization process.</p><h3>7. Resource Ownership and IDOR Protection</h3><p>Authentication and RBAC alone are not enough.</p><p>A user may have permission to manage projects, but they should only be able to manage <strong>their own</strong> projects.</p><p>For example:</p><pre>Project ID: 101<br>Owner: Student A</pre><p>If Student B changes the project ID in a request and tries to modify Project 101, the backend should reject the request.</p><p>The application therefore performs resource ownership checks using the authenticated user’s identity.</p><p>A simplified example is:</p><pre>if (project.studentId.toString() !== userId) {<br>    throw new Error(&quot;Forbidden&quot;);<br>}</pre><p>This helps protect against <strong>Insecure Direct Object Reference (IDOR)</strong> and <strong>Broken Object Level Authorization (BOLA)</strong> style attacks.</p><p>The expected behaviour is:</p><pre>Student A → Own Project → Allowed</pre><pre>Student B → Student A&#39;s Project → 403 Forbidden</pre><p>This ensures that simply knowing another resource’s ID is not enough to gain access to it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*weMoMR0_i_m6wcStjGt72w.png" /></figure><h3>8. OWASP Top 10 Security Hardening</h3><p>The OWASP Top 10 was a major part of this assessment.</p><p>I reviewed the application against relevant OWASP risks and implemented security controls based on the technologies and functionality used by DevCanvas.</p><h4>A01 — Broken Access Control</h4><p>I implemented:</p><ul><li>Backend role checks</li><li>RBAC</li><li>Resource ownership validation</li><li>Protected API endpoints</li></ul><p>This prevents authenticated users from automatically gaining access to functionality or resources that they are not authorized to use.</p><h4>A02 — Cryptographic Failures</h4><p>Security measures include:</p><ul><li>HTTPS/TLS</li><li>PKCE using SHA-256</li><li>RS256 token verification</li></ul><p>These controls help protect authentication information and sensitive communication.</p><h4>A03 — Injection</h4><p>Because DevCanvas uses <strong>MongoDB</strong>, I considered <strong>NoSQL injection</strong>.</p><p>User input should not be blindly trusted when constructing database queries.</p><p>To reduce this risk, input values are validated before being used in database operations.</p><p>MongoDB ObjectIds are also validated before being used in relevant queries.</p><p>This helps ensure that unexpected input is not interpreted as part of a database query.</p><h4>A04 — Insecure Design</h4><p>Security was also considered at the application-design level.</p><p>The role-selection process restricts new users to the expected roles:</p><pre>STUDENT<br>RECRUITER</pre><p>A new user cannot select:</p><pre>ADMIN</pre><p>The role-selection operation also uses an atomic isNewUser: true check. This helps prevent repeated role selection and self-escalation after the initial onboarding process.</p><h4>A05 — Security Misconfiguration</h4><p>I used <strong>Helmet</strong> to add security-related HTTP headers.</p><p>CORS was also configured to restrict requests to the expected frontend origin rather than allowing unrestricted cross-origin access.</p><p>Error handling was improved so that internal implementation details and stack traces are not unnecessarily exposed to users.</p><h4>A06 — Vulnerable and Outdated Components</h4><p>I reviewed the project’s npm dependencies using:</p><pre>npm audit</pre><p>This was used to identify known vulnerabilities in direct and transitive dependencies.</p><p>Dependency vulnerabilities identified during development were addressed using the available npm security fixes.</p><p>This showed me that application security also depends on the security of third-party packages used by the project.</p><h4>A07 — Identification and Authentication Failures</h4><p>Authentication-related security was addressed through:</p><ul><li>Asgardeo</li><li>OIDC</li><li>Authorization Code Flow</li><li>PKCE</li><li>Access-token validation</li><li>Issuer validation</li><li>Audience validation</li><li>Expiration validation</li><li>Authentication state protection</li><li>Logout handling</li></ul><h4>A08 — Data Integrity Failures</h4><p>Since DevCanvas supports project image uploads, file-upload security was also considered as part of data integrity protection.</p><p>The application restricts uploaded files to supported image types such as:</p><pre>image/jpeg<br>image/png<br>image/webp</pre><p>The maximum upload size is restricted to:</p><pre>5 MB</pre><p>This reduces the risk of arbitrary file uploads and excessively large uploads.</p><h4>A09 — Security Logging and Monitoring Failures</h4><p>Security-related logging was considered as part of backend monitoring.</p><p>HTTP access logging uses a safe URL format that prevents OAuth authorization-code query parameters from being unnecessarily exposed in logs.</p><p>Security-related events are also logged without unnecessarily exposing sensitive authentication information.</p><h4>A10 — Server-Side Request Forgery (SSRF)</h4><p>The backend communicates with configured Asgardeo endpoints for operations such as JWKS public-key retrieval, token exchange and UserInfo requests.</p><p>These requests are directed to configured Asgardeo endpoints rather than accepting arbitrary URLs from users.</p><p>The application does not provide a general-purpose server-side URL-fetching feature controlled by user input. This reduces the risk of attackers using the server to access unintended resources.</p><h4>XSS and CSRF Considerations</h4><p>I also reviewed the application for <strong>Cross-Site Scripting (XSS)</strong> and <strong>Cross-Site Request Forgery (CSRF)</strong> risks.</p><p>React’s normal JSX rendering escapes user-provided values, reducing the risk of directly executing injected HTML or scripts.</p><p>For CSRF, protected API requests use bearer access tokens in the Authorization header. The OIDC authentication flow also uses the state parameter to help protect the authentication request.</p><p>These controls were considered based on the authentication architecture used by the application.</p><h3>9. Additional Security Controls</h3><p>In addition to authentication, authorization and OWASP-related protections, I implemented several supporting security controls.</p><h4>HTTPS</h4><p>HTTPS was configured to protect communication between the frontend and backend.</p><pre>Browser<br>   ↓<br>Encrypted HTTPS Connection<br>   ↓<br>Backend</pre><p>This is especially important when authentication information and protected API requests are being transmitted.</p><h4>CORS</h4><p>CORS was restricted to the expected frontend origin instead of allowing unrestricted cross-origin requests.</p><h4>Security Headers</h4><p>Helmet was used to provide security-related HTTP headers such as:</p><pre>X-Frame-Options<br>X-Content-Type-Options<br>Content-Security-Policy</pre><h4>Environment Variables</h4><p>Sensitive configuration such as database credentials and Asgardeo configuration is stored using environment variables rather than directly in the source code.</p><p>The actual .env file is excluded from Git, while an .env.example file can be used to show the required configuration.</p><h4>Security Logging</h4><p>HTTP requests and security-related events are logged for monitoring and troubleshooting.</p><p>Care was also taken to avoid unnecessarily exposing sensitive authentication information in logs.</p><h3>10. Security Testing with Postman</h3><p>After implementing the security controls, I used <strong>Postman</strong> to test the protected APIs under different conditions.</p><p>The tests included:</p><ul><li>Requests without an access token</li><li>Invalid authentication</li><li>Valid Student authentication</li><li>Valid Recruiter authentication</li><li>Access to Admin functionality with an unauthorized role</li><li>Resource ownership checks</li><li>Invalid input</li><li>Invalid ObjectIds</li><li>File-upload restrictions</li></ul><p>For example:</p><pre>No Token<br>   ↓<br>Protected API<br>   ↓<br>401 Unauthorized</pre><p>Another test was:</p><pre>Student Token<br>   ↓<br>Admin API<br>   ↓<br>Role Check<br>   ↓<br>403 Forbidden</pre><p>I also tested whether a user could access or modify another user’s resources.</p><p>These tests helped verify that the security controls were actually being enforced by the backend rather than simply existing in the code.</p><h3>11. Challenges I Faced</h3><p>One of the biggest challenges was integrating Asgardeo with the existing DevCanvas application.</p><p>The authentication process involves the frontend, backend, Identity Provider, callback URL, authorization code and access tokens.</p><p>Understanding how these components communicate took some time.</p><p>I also encountered API issues during development. For example, at one stage:</p><pre>GET /api/auth/me</pre><p>returned:</p><pre>404 Not Found</pre><p>I had to trace the request through the frontend and backend and check the authentication route and controller implementation.</p><p>Testing different user roles was another challenge.</p><p>A successful login only proves that authentication works. I also needed to test what happens when an authenticated user tries to access functionality outside their permissions.</p><p>Resource ownership testing was also important because a valid authenticated user should not automatically have access to another user’s resources.</p><p>Configuring HTTPS while keeping the existing DevCanvas functionality working required changes to both the frontend Vite configuration and backend server configuration.</p><p>Finally, adding security controls while keeping the existing DevCanvas functionality working was itself a challenge.</p><h3>12. What I Learned</h3><p>This assessment gave me practical experience with several security concepts that I had previously understood mainly from theory.</p><p>I gained hands-on experience with:</p><ul><li>OpenID Connect</li><li>Asgardeo</li><li>Authorization Code Flow</li><li>PKCE</li><li>Access tokens</li><li>JWT claims</li><li>JWKS</li><li>RS256</li><li>RBAC</li><li>Resource ownership</li><li>NoSQL injection</li><li>XSS</li><li>CSRF considerations</li><li>HTTPS</li><li>CORS</li><li>Security headers</li><li>Secure configuration</li><li>Security logging</li></ul><p>One of my biggest takeaways was understanding the difference between <strong>authentication and authorization</strong>.</p><p>Authentication answers:</p><blockquote><em>“Who is this user?”</em></blockquote><p>Authorization answers:</p><blockquote><em>“What is this user allowed to do?”</em></blockquote><p>A user can have a valid Asgardeo access token and still receive:</p><pre>403 Forbidden</pre><p>when trying to access functionality they are not authorized to use.</p><p>I also learned that frontend restrictions are not security controls by themselves. Even if a button is hidden, the backend must still verify the user’s permissions.</p><p>Most importantly, I started thinking about applications from an attacker’s perspective.</p><p>Instead of only asking:</p><blockquote><em>“Does this feature work?”</em></blockquote><p>I now also ask:</p><blockquote><em>“What happens if someone tries to misuse it?”</em></blockquote><h3>13. Final Thoughts</h3><p>Securing DevCanvas was a different experience from normal application development because I had to consider not only how the system should work, but also how it could be misused.</p><p>The overall security flow can be summarized as:</p><pre>Asgardeo<br>   ↓<br>OIDC Authentication<br>   ↓<br>Authorization Code + PKCE<br>   ↓<br>Access Token<br>   ↓<br>Token Validation<br>   ↓<br>Authenticated User<br>   ↓<br>RBAC<br>   ↓<br>Resource Ownership<br>   ↓<br>Input Validation<br>   ↓<br>Protected API</pre><p>Additional controls such as <strong>HTTPS, CORS, Helmet, secure configuration, file-upload restrictions, security logging and dependency auditing</strong> provide further layers of protection.</p><p>The main lesson I gained from this assessment is that security should not be treated as something added at the end of development. It needs to be considered throughout the application, from authentication and API design to database queries, file uploads, configuration and error handling.</p><p>Overall, this assessment helped me move from simply building an application that works to thinking about how an application can be built and used <strong>securely</strong>.</p><h3>Project Reference</h3><p><strong>DevCanvas — Student Project Showcase Portal</strong></p><p><strong>GitHub Repository:</strong> <a href="https://github.com/Dinuja937/dev-canvas">https://github.com/Dinuja937/dev-canvas</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d7b86f47fa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Avoiding the OWASP Top 10 in Modern Web Applications]]></title>
            <link>https://medium.com/@dinujachamodi/avoiding-the-owasp-top-10-in-modern-web-applications-bc154d8c25e2?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc154d8c25e2</guid>
            <category><![CDATA[owasp]]></category>
            <category><![CDATA[owasp-top-10]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Tue, 23 Jun 2026 18:42:14 GMT</pubDate>
            <atom:updated>2026-06-23T18:43:18.209Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWwWwcYcGlGkKTEp4MdFJQ.png" /></figure><p>As developers, we spend a lot of time focusing on features, performance, and user experience. However, one area that is often overlooked is security. A web application may work perfectly, but if it contains security vulnerabilities, attackers can exploit it and cause serious damage.</p><p>While learning about web application security, I came across the OWASP Top 10 2025. It is a list published by <strong>OWASP (Open Worldwide Application Security Project) </strong>that highlights the most critical security risks found in modern web applications.</p><p>Understanding these risks can help developers create more secure systems and avoid common mistakes during development.</p><h3>Why Should Developers Care About Security?</h3><p>A security issue can lead to:</p><ul><li>Data leaks</li><li>Unauthorized access to systems</li><li>Financial losses</li><li>Service interruptions</li><li>Loss of user trust</li><li>Damage to a company’s reputation</li></ul><p>Security should not be treated as an afterthought. It should be considered throughout the entire development process.</p><h3>What is the OWASP Top 10?</h3><p>The OWASP Top 10 is a regularly updated awareness document that identifies the most important security risks affecting web applications.</p><p>Instead of focusing only on technical vulnerabilities, the latest version also emphasizes secure design practices, proper authentication, software integrity, and overall security management.</p><p>Below are some of the major risk categories developers should pay attention to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*AyVLVg88QNivNGdJz36i4w.jpeg" /></figure><h3>A01:2025 — Broken Access Control</h3><p>Access control determines what users are allowed to do within a system.</p><p>When access control is implemented incorrectly, users may gain access to resources they should not be able to view or modify.</p><h4>Example</h4><ul><li>A normal user accessing admin functions by changing a URL.</li><li>Viewing another user’s data without permission.</li></ul><h4>How to Prevent It</h4><ul><li>Implement role-based access control.</li><li>Verify permissions on the server side.</li><li>Apply the principle of least privilege.</li><li>Test authorization rules regularly.</li></ul><h3>A02:2025 — Security Misconfiguration</h3><p>Many security incidents occur because systems are configured incorrectly.</p><p>A secure application can become vulnerable simply because of poor configuration settings.</p><h4>Example</h4><ul><li>Default passwords.</li><li>Exposed admin panels.</li><li>Detailed error messages visible to users.</li></ul><h4>How to Prevent It</h4><ul><li>Remove default credentials.</li><li>Disable unnecessary services.</li><li>Configure production environments properly.</li><li>Review security settings regularly.</li></ul><h3>A03:2025 — Software Supply Chain Failures</h3><p>Modern applications rely heavily on third-party libraries, frameworks, packages, and external services.</p><p>If these components are compromised or not properly managed, they can introduce serious security risks into an application.</p><h4>Example</h4><ul><li>Using packages from untrusted sources.</li><li>Installing dependencies with known vulnerabilities.</li><li>Compromised third-party libraries.</li></ul><h4>How to Prevent It</h4><ul><li>Use trusted package repositories.</li><li>Keep dependencies updated.</li><li>Regularly scan for vulnerabilities.</li><li>Review third-party components before using them.</li><li>Monitor software supply chain risks.</li></ul><h3>A04:2025 — Cryptographic Failures</h3><p>Sensitive information such as passwords, personal details, and payment information must be protected properly.</p><p>Weak encryption or improper handling of data can expose users to significant risks.</p><h4>Example</h4><ul><li>Storing passwords in plain text.</li><li>Sending sensitive information without encryption.</li></ul><h4>How to Prevent It</h4><ul><li>Use HTTPS for all communications.</li><li>Hash passwords using bcrypt or Argon2.</li><li>Encrypt sensitive data when necessary.</li><li>Avoid outdated cryptographic algorithms.</li></ul><h3>A05:2025 — Injection</h3><p>Injection vulnerabilities occur when untrusted data is interpreted as commands or queries.</p><p>This remains one of the most dangerous attack types because it can directly affect databases and servers.</p><h4>Example</h4><ul><li>SQL Injection</li><li>NoSQL Injection</li><li>Command Injection</li></ul><h4>How to Prevent It</h4><ul><li>Use parameterized queries.</li><li>Validate user inputs.</li><li>Sanitize data before processing.</li><li>Avoid building queries using string concatenation.</li></ul><h3>A06:2025 — Insecure Design</h3><p>Security should begin during the planning and design stages of a project.</p><p>Even perfectly written code can become vulnerable if the system itself is designed insecurely.</p><h4>Example</h4><ul><li>Missing security requirements.</li><li>Poor business logic validation.</li><li>Lack of threat analysis.</li></ul><h4>How to Prevent It</h4><ul><li>Include security requirements from the start.</li><li>Perform threat modeling.</li><li>Follow secure design principles.</li><li>Review system architecture before development.</li></ul><h3>A07:2025 — Authentication Failures</h3><p>Authentication is responsible for verifying user identities.</p><p>Weak authentication mechanisms make it easier for attackers to gain unauthorized access.</p><h4>Example</h4><ul><li>Weak passwords.</li><li>Poor session management.</li><li>Missing multi-factor authentication.</li></ul><h4>How to Prevent It</h4><ul><li>Enforce strong password policies.</li><li>Enable Multi-Factor Authentication (MFA).</li><li>Secure session handling.</li><li>Monitor suspicious login attempts.</li></ul><h3>A08:2025 — Software or Data Integrity Failures</h3><p>Applications should ensure that software, updates, and data have not been modified by unauthorized parties.</p><p>This risk has become more important due to the increasing use of third-party packages and automated deployment pipelines.</p><h4>Example</h4><ul><li>Downloading unverified software packages.</li><li>Compromised CI/CD pipelines.</li></ul><h4>How to Prevent It</h4><ul><li>Verify software integrity.</li><li>Use trusted package sources.</li><li>Secure CI/CD workflows.</li><li>Review third-party integrations carefully.</li></ul><h3>A09:2025 — Security Logging and Alerting Failures</h3><p>Without proper monitoring and alerting mechanisms, organizations may not detect attacks until significant damage has already occurred.</p><p>Logging plays a critical role in identifying suspicious activities and responding quickly to incidents.</p><h4>Example</h4><ul><li>Missing audit logs.</li><li>Lack of security alerts.</li><li>Failure to monitor suspicious activities.</li></ul><h4>How to Prevent It</h4><ul><li>Log important security events.</li><li>Configure alerting systems.</li><li>Monitor system activities continuously.</li><li>Review logs regularly.</li></ul><h3>A10:2025 — Mishandling of Exceptional Conditions</h3><p>Applications should be prepared to handle unexpected situations safely and securely.</p><p>Improper handling of errors, failures, or exceptional conditions can expose sensitive information or cause system instability.</p><h4>Example</h4><ul><li>Displaying detailed error messages to users.</li><li>Application crashes during unexpected inputs.</li><li>Failure to handle resource exhaustion properly.</li></ul><h4>How to Prevent It</h4><ul><li>Implement proper error handling.</li><li>Use generic error messages for users.</li><li>Log technical details securely.</li><li>Test applications under unusual conditions.</li><li>Design systems to fail safely.</li></ul><h3>Security Best Practices Every Developer Should Follow</h3><p>Regardless of the technology stack, developers should always:</p><ul><li>Validate all user inputs.</li><li>Keep software and dependencies updated.</li><li>Use secure authentication mechanisms.</li><li>Apply proper authorization controls.</li><li>Use HTTPS.</li><li>Conduct regular security testing.</li><li>Review code frequently.</li><li>Monitor applications continuously.</li><li>Learn about new security threats.</li></ul><h3>Final Thoughts</h3><p>One thing I learned while studying the OWASP Top 10 is that security is not just the responsibility of security engineers. Every developer plays a role in building secure applications.</p><p>Most vulnerabilities occur because of small mistakes that could have been avoided with proper planning and awareness. By understanding the OWASP Top 10 and applying secure development practices, developers can significantly reduce the risk of attacks and create applications that users can trust.</p><p>As web technologies continue to evolve, security knowledge is becoming just as important as programming skills. Learning secure coding practices today can help us build safer and more reliable applications in the future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc154d8c25e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Structure a Scalable React Project (2026 Guide)]]></title>
            <link>https://medium.com/@dinujachamodi/how-to-structure-a-scalable-react-project-2026-guide-3ca0e85fae6f?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ca0e85fae6f</guid>
            <category><![CDATA[react-project-structure]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 11:27:01 GMT</pubDate>
            <atom:updated>2026-06-08T11:32:17.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jr0dsVOhwWJQHmXnbsYd9A.png" /></figure><p>When I first started building React applications, my project structure was very simple. Everything went into a few folders, and it worked fine for small projects.</p><p>However, as the application grew, things became difficult to manage. Components were scattered everywhere, finding files took more time, and adding new features became frustrating.</p><p>A good project structure is not just about keeping files organized. It helps developers work faster, maintain code easily, and scale applications without creating unnecessary complexity.</p><p>In this article, I’ll share a practical React project structure that works well for modern applications in 2026.</p><h3>Why Project Structure Matters</h3><p>Many beginners focus only on writing code.</p><p>But in real-world projects, organization is equally important.</p><p>A good structure helps you:</p><ul><li>Find files quickly</li><li>Reduce code duplication</li><li>Improve team collaboration</li><li>Make features easier to maintain</li><li>Scale applications without creating confusion</li><li>Improve development speed</li></ul><p>As projects grow, a poor folder structure can become a major problem.</p><h3>A Common Mistake</h3><p>Many developers organize React projects like this:</p><pre>src/<br> ├── Components/<br> ├── Pages/<br> ├── Hooks/<br> ├── Utils/<br> ├── Services/</pre><p>This approach works initially.</p><p>But after adding dozens of pages and hundreds of components, folders become overcrowded.</p><p>For example:</p><pre>Components/<br> ├── UserCard.jsx<br> ├── ProductCard.jsx<br> ├── LoginForm.jsx<br> ├── PaymentForm.jsx<br> ├── DashboardChart.jsx<br> ├── ...</pre><p>Finding related files becomes difficult.</p><h3>A Better Approach: Feature-Based Structure</h3><p>Instead of organizing files by type, organize them by feature.</p><p>Example:</p><pre>src/<br> ├── features/<br> │   ├── auth/<br> │   ├── products/<br> │   ├── orders/<br> │   └── users/</pre><p>Each feature contains everything related to that feature.</p><p>For example:</p><pre>features/<br> └── auth/<br>      ├── components/<br>      ├── pages/<br>      ├── hooks/<br>      ├── services/<br>      └── authSlice.js</pre><p>This makes the codebase easier to navigate.</p><p>When working on authentication, all related files are located in one place.</p><h3>Recommended React Project Structure for 2026</h3><pre>src/<br>│<br>├── app/<br>│   ├── routes/<br>│   ├── store/<br>│   └── providers/<br>│<br>├── features/<br>│   ├── auth/<br>│   ├── products/<br>│   ├── orders/<br>│   └── users/<br>│<br>├── components/<br>│<br>├── hooks/<br>│<br>├── services/<br>│<br>├── utils/<br>│<br>├── assets/<br>│<br>├── layouts/<br>│<br>└── pages/</pre><p>Let’s understand each folder.</p><h3>1. app/</h3><p>Contains application-level configuration.</p><p>Examples:</p><ul><li>Routing configuration</li><li>Redux store setup</li><li>Global providers</li><li>Authentication setup</li></ul><p>Example:</p><pre>app/<br> ├── routes/<br> ├── store/<br> └── providers/</pre><h3>2. features/</h3><p>This is the most important folder.</p><p>Each business feature gets its own folder.</p><p>Example:</p><pre>features/<br> ├── auth/<br> ├── products/<br> ├── orders/<br> └── users/</pre><p>Each feature can contain:</p><pre>auth/<br> ├── components/<br> ├── pages/<br> ├── hooks/<br> ├── services/<br> └── types/</pre><p>This keeps related code together.</p><h3>3. components/</h3><p>Store reusable components used across multiple features.</p><p>Examples:</p><ul><li>Button</li><li>Input</li><li>Modal</li><li>Navbar</li><li>Loader</li></ul><p>Example:</p><pre>components/<br> ├── Button/<br> ├── Modal/<br> ├── Navbar/<br> └── Loader/</pre><p>Only truly reusable components should go here.</p><h3>4. hooks/</h3><p>Store global custom hooks.</p><p>Examples:</p><pre>hooks/<br> ├── useDebounce.js<br> ├── useLocalStorage.js<br> └── useTheme.js</pre><p>Feature-specific hooks should stay inside their respective feature folders.</p><h3>5. services/</h3><p>Contains API-related code.</p><p>Examples:</p><pre>services/<br> ├── api.js<br> ├── axiosInstance.js<br> └── authService.js</pre><p>This helps separate API logic from UI components.</p><h3>6. utils/</h3><p>Contains helper functions.</p><p>Examples:</p><pre>utils/<br> ├── formatDate.js<br> ├── currencyFormatter.js<br> └── validators.js</pre><p>Keep utility functions small and reusable.</p><h3>7. assets/</h3><p>Stores static resources.</p><p>Examples:</p><pre>assets/<br> ├── images/<br> ├── icons/<br> ├── fonts/<br> └── styles/</pre><h3>8. layouts/</h3><p>Stores reusable page layouts.</p><p>Examples:</p><pre>layouts/<br> ├── DashboardLayout.jsx<br> ├── AdminLayout.jsx<br> └── AuthLayout.jsx</pre><p>This prevents duplicate page structures.</p><h3>9. pages/</h3><p>Contains top-level route pages.</p><p>Examples:</p><pre>pages/<br> ├── Home.jsx<br> ├── About.jsx<br> └── Contact.jsx</pre><p>Feature-related pages can stay inside feature folders when appropriate.</p><h3>Additional Best Practices</h3><h3>1. Use Absolute Imports</h3><p>Instead of:</p><pre>import Button from &quot;../../../../components/Button&quot;;</pre><p>Use:</p><pre>import Button from &quot;@/components/Button&quot;;</pre><p>This keeps imports clean and readable.</p><h3>2. Keep Components Small</h3><p>A component should ideally do one job.</p><p>Bad example:</p><pre>Dashboard.jsx</pre><p>Contains:</p><ul><li>API calls</li><li>Business logic</li><li>UI rendering</li><li>Form validation</li></ul><p>Good example:</p><pre>Dashboard/<br> ├── Dashboard.jsx<br> ├── DashboardHeader.jsx<br> ├── DashboardStats.jsx<br> └── DashboardChart.jsx</pre><p>Smaller components are easier to maintain.</p><h3>3. Separate Business Logic from UI</h3><p>Avoid putting all logic inside components.</p><p>Instead:</p><ul><li>Components handle UI</li><li>Hooks handle state management</li><li>Services handle API calls</li></ul><p>This makes testing much easier.</p><h3>4. Create Shared Types</h3><p>If using TypeScript:</p><pre>types/<br> ├── user.ts<br> ├── product.ts<br> └── order.ts</pre><p>Shared types improve consistency across the application.</p><h3>When Should You Use This Structure?</h3><p>This structure works well for:</p><ul><li>SaaS applications</li><li>E-commerce platforms</li><li>Admin dashboards</li><li>Enterprise applications</li><li>Team projects</li><li>Long-term products</li></ul><p>For very small projects, a simpler structure may be enough.</p><p>Don’t over-engineer from the beginning.</p><p>Start simple and introduce more organization as the project grows.</p><h3>Conclusion</h3><p>There is no perfect React project structure. The best structure is the one that remains easy to understand as the application grows.</p><p>For modern React applications in 2026, a feature-based architecture is often the most practical approach because it keeps related code together and makes scaling much easier.</p><p>Instead of asking, “Where should this component go?”, you’ll naturally know where it belongs because everything is organized around features rather than file types. And when a project reaches thousands of lines of code, that small decision can save countless hours of development time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ca0e85fae6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JWT Authentication Done Right: Common Mistakes and Best Practices]]></title>
            <link>https://medium.com/@dinujachamodi/jwt-authentication-done-right-common-mistakes-and-best-practices-add63b7983b5?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/add63b7983b5</guid>
            <category><![CDATA[json-web-token]]></category>
            <category><![CDATA[jwt-authentication]]></category>
            <category><![CDATA[jwt-token]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Sun, 31 May 2026 19:20:00 GMT</pubDate>
            <atom:updated>2026-05-31T19:20:00.399Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnsd0EI3rjXem6l9LyqnFQ.png" /></figure><p>Authentication is one of the most important parts of modern web applications.<br> Most developers use JSON Web Tokens (JWT) because they are simple, fast, and easy to work with.</p><p>But in many beginner projects, JWT authentication is implemented in an unsafe way without realizing the security risks.</p><p>In this article, I’ll go through some common JWT mistakes developers make and the best practices to avoid them.</p><h3>What is JWT?</h3><p>JWT (JSON Web Token) is a token used to verify users after login.</p><p>When a user logs in successfully:</p><ul><li>Server creates a token</li><li>Token is sent to the client</li><li>Client stores the token</li><li>Token is sent with future requests</li></ul><p>Example:</p><pre>{<br>  &quot;userId&quot;: &quot;12345&quot;,<br>  &quot;role&quot;: &quot;admin&quot;<br>}</pre><p>A JWT usually has 3 parts:</p><pre>HEADER.PAYLOAD.SIGNATURE</pre><h3>Why JWT is Popular</h3><p>Some reasons why developers use JWT:</p><ul><li>Stateless authentication</li><li>Faster than session-based authentication</li><li>Easy to use with frontend frameworks like React</li><li>Works well with APIs and mobile apps</li><li>Scalable for large applications</li></ul><h3>Common JWT Mistakes</h3><h3>1. Storing JWT in Local Storage</h3><p>This is probably the most common mistake.</p><p>Many tutorials store tokens like this:</p><pre>localStorage.setItem(&quot;token&quot;, token);</pre><p>The problem is:</p><ul><li>If your app gets an XSS attack,</li><li>attackers can steal the token easily.</li></ul><h3>Better Option</h3><p>Use:</p><ul><li>HTTP-only cookies</li></ul><p>Why?</p><p>Because JavaScript cannot directly access HTTP-only cookies.</p><p>This gives better protection against token theft.</p><h3>2. Creating Tokens Without Expiry Time</h3><p>Some beginners create tokens without expiration.</p><p>Example:</p><pre>jwt.sign(payload, secretKey);</pre><p>This means the token can stay valid forever.</p><p>That is dangerous.</p><p>If someone steals the token, they can use it anytime.</p><h3>Best Practice</h3><p>Always add an expiration time.</p><p>Example:</p><pre>jwt.sign(payload, secretKey, {<br>  expiresIn: &quot;15m&quot;,<br>});</pre><p>Good practice:</p><ul><li>Access Token → short expiry</li><li>Refresh Token → longer expiry</li></ul><h3>3. Using Weak Secret Keys</h3><p>Another common issue is using weak secret keys.</p><p>Bad example:</p><pre>const secret = &quot;123456&quot;;</pre><p>Easy-to-guess secrets make JWT vulnerable.</p><h3>Better Practice</h3><p>Use:</p><ul><li>Long random secret keys</li><li>Environment variables</li></ul><p>Example:</p><pre>JWT_SECRET=mySuperSecureRandomSecretKey</pre><p>Never hardcode secrets inside your project.</p><h3>4. Sending Sensitive Data Inside JWT</h3><p>JWT payloads are not encrypted by default.</p><p>Anyone can decode them.</p><p>Bad example:</p><pre>{<br>  password: &quot;mypassword&quot;,<br>  creditCard: &quot;1234&quot;<br>}</pre><p>Never store:</p><ul><li>Passwords</li><li>Credit card details</li><li>Private information</li></ul><h3>Safe Example</h3><pre>{<br>  userId: &quot;123&quot;,<br>  role: &quot;user&quot;<br>}</pre><p>Keep payloads simple.</p><h3>5. Not Using HTTPS</h3><p>If your application uses HTTP instead of HTTPS:</p><ul><li>tokens can be intercepted during requests.</li></ul><p>This becomes very risky on public WiFi networks.</p><h3>Best Practice</h3><p>Always use HTTPS in production.</p><p>Especially for:</p><ul><li>Login systems</li><li>Payment systems</li><li>Admin dashboards</li></ul><h3>6. Not Validating Tokens Properly</h3><p>Some developers only decode the token.</p><p>Example:</p><pre>jwt.decode(token);</pre><p>This does NOT verify whether the token is valid.</p><h3>Correct Way</h3><p>Use:</p><pre>jwt.verify(token, secretKey);</pre><p>This checks:</p><ul><li>Signature</li><li>Expiration</li><li>Validity</li></ul><h3>Understanding Refresh Tokens</h3><p>A good authentication system usually has:</p><ul><li>Access Token</li><li>Refresh Token</li></ul><h3>1. Access Token</h3><p>Used for:</p><ul><li>Accessing protected routes</li></ul><p>Usually expires quickly:</p><pre>15 minutes</pre><h3>2. Refresh Token</h3><p>Used for:</p><ul><li>Generating new access tokens</li></ul><p>Usually has longer expiry:</p><pre>7 days<br>30 days</pre><h3>Why Refresh Tokens Matter</h3><p>Without refresh tokens:</p><ul><li>users get logged out very frequently.</li></ul><p>With refresh tokens:</p><ul><li>users stay logged in smoothly,</li><li>while still keeping access tokens short-lived.</li></ul><p>This improves both:</p><ul><li>Security</li><li>User experience</li></ul><h3>Simple JWT Flow</h3><h3>Step 1 — User Logs In</h3><p>Server creates:</p><ul><li>Access Token</li><li>Refresh Token</li></ul><h3>Step 2 — Access Token Expires</h3><p>Frontend sends refresh token to server.</p><h3>Step 3 — Server Verifies Refresh Token</h3><p>If valid:</p><ul><li>server creates a new access token.</li></ul><h3>Simple Example</h3><h3>Backend Login Example</h3><pre>const accessToken = jwt.sign(<br>  { userId: user._id },<br>  process.env.JWT_SECRET,<br>  { expiresIn: &quot;15m&quot; }<br>);<br><br>const refreshToken = jwt.sign(<br>  { userId: user._id },<br>  process.env.REFRESH_SECRET,<br>  { expiresIn: &quot;7d&quot; }<br>);</pre><h3>Best Practices Summary</h3><p>Here are some important JWT best practices:</p><h3>Do This</h3><ol><li>Use HTTPS</li><li>Add token expiry</li><li>Use refresh tokens</li><li>Store secrets in environment variables</li><li>Use HTTP-only cookies</li><li>Keep JWT payload small</li><li>Verify tokens properly</li></ol><h3>Avoid This</h3><ol><li>Storing sensitive data in JWT</li><li>Using weak secret keys</li><li>Tokens without expiration</li><li>Using localStorage carelessly</li><li>Sending tokens over HTTP</li></ol><h3>Final Thoughts</h3><p>JWT authentication is powerful and widely used in modern applications.<br> But simply making login work is not enough.</p><p>A secure authentication system should:</p><ul><li>protect user data,</li><li>prevent token theft,</li><li>handle token expiration properly,</li><li>and provide a smooth user experience.</li></ul><p>Even small mistakes in authentication can create serious security problems later.</p><p>So when building applications, it is always worth spending extra time to implement JWT authentication the right way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=add63b7983b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Microservices vs Monolithic Architecture: Which One Should You Actually Use?]]></title>
            <link>https://medium.com/@dinujachamodi/microservices-vs-monolithic-architecture-which-one-should-you-actually-use-6c91451eb910?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c91451eb910</guid>
            <category><![CDATA[microservicesarchitecture]]></category>
            <category><![CDATA[monolithic-architecture]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Wed, 13 May 2026 20:36:54 GMT</pubDate>
            <atom:updated>2026-05-13T20:43:17.683Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7fV9RptjQQPKXBrsApLHw.png" /></figure><p>When I first started learning software architecture, I thought microservices simply meant:</p><ul><li>multiple databases</li><li>multiple servers</li><li>multiple frontends</li></ul><p>But I later realized the real difference is much deeper than that.</p><p>This topic confuses a lot of beginners. Common questions include:</p><ul><li>Can microservices have one database?</li><li>Does microservices always need multiple frontends?</li><li>If there is one backend, is it still microservices?</li></ul><p>I was confused about these things too at the beginning. So let’s break everything down in simple terms with practical examples.</p><h3>First, What is Software Architecture?</h3><p>Software architecture is basically the structure of a software application. It defines:</p><ul><li>how components are organized</li><li>how systems communicate</li><li>how data flows</li><li>how the application scales and grows</li></ul><p>Two of the most common architectures are:</p><ol><li>Monolithic Architecture</li></ol><p>2. Microservices Architecture</p><h3>What is Monolithic Architecture?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*psI-iby70vLDZv7tkFTlwA.jpeg" /></figure><p>A monolithic application is built as <strong>one single system</strong> where everything is connected inside one project.</p><p>Usually, it has:</p><ul><li>one frontend</li><li>one backend</li><li>one database</li></ul><p>All features exist inside the same backend application.</p><h4>Example:</h4><p>Imagine a university management system with:</p><ul><li>student registration</li><li>course management</li><li>exam results</li><li>payments</li></ul><p>In a monolith:</p><ul><li>all features are inside one backend project</li><li>they share one database</li><li>everything is deployed together</li></ul><p>So if you change one feature, you often redeploy the entire system.</p><h4>Real World Analogy:</h4><p>Think of a small family-owned shop where:</p><ul><li>billing</li><li>inventory</li><li>customer support</li><li>sales</li></ul><p>all happen in one place. That’s a monolithic system.</p><h4>Advantages of Monolithic Architecture</h4><ol><li>Simple to build and understand</li></ol><p>2. Faster initial development</p><p>3. Easier deployment</p><p>4. Great for small projects</p><h4>Disadvantages of Monolithic Architecture</h4><ol><li>Hard to scale individual features</li></ol><p>2. Large, messy codebase over time</p><p>3. One bug can affect the whole system</p><p>4. Difficult for large teams</p><h3>What is Microservices Architecture?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWE0IPsHwtveuCj4SDndjg.webp" /></figure><p>Microservices architecture breaks the application into <strong>multiple small independent services</strong>, where each service handles one responsibility.</p><p>Examples:</p><ul><li>Authentication Service</li><li>Payment Service</li><li>Product Service</li><li>Notification Service</li></ul><p>Each service:</p><ul><li>runs independently</li><li>is deployed separately</li><li>can scale independently</li></ul><h4>The core idea (important)</h4><p>The biggest misunderstanding is thinking microservices means:</p><ul><li>multiple frontends</li><li>multiple databases</li></ul><p>But the real core idea is, <strong>multiple independent backend services</strong></p><p>That’s what defines microservices.</p><h4>What does a typical microservices system look like?</h4><p>Most commonly:</p><ul><li>one frontend</li><li>multiple backend services</li><li>multiple databases (ideal case)</li></ul><p><strong>Example:</strong></p><p><strong><em>Backend services:</em></strong></p><ul><li>User Service</li><li>Order Service</li><li>Payment Service</li><li>Notification Service</li></ul><p><strong><em>Databases:</em></strong></p><ul><li>each service ideally has its own database</li></ul><h3>Common Misconceptions About Microservices</h3><h4>1. “Microservices must have multiple frontends”</h4><p><em>False</em></p><p>Microservices can have:</p><ul><li>one frontend (very common)</li><li>or multiple frontends</li></ul><p>Example:</p><ul><li>web app</li><li>mobile app</li><li>admin panel</li></ul><p>All can use the same backend services.</p><h4>2. “Microservices must have multiple databases”</h4><p><em>Not strictly required</em></p><p>A microservices system can temporarily use:</p><ul><li>one shared database</li></ul><p>But this reduces independence between services.</p><p><strong>Ideal approach:</strong></p><p>Each service has its own database for:</p><ul><li>better scalability</li><li>better fault isolation</li><li>easier maintenance</li></ul><h4>3. “One backend means microservices”</h4><p><em>No</em></p><p>If there is only one backend application, it is usually, <strong>monolithic architecture</strong></p><p>Microservices require multiple independent backend services.</p><h3>Simple Real World Analogy</h3><p>Think about a shopping mall:</p><p><strong>Monolith:</strong></p><p>One giant shop handles everything.</p><p><strong>Microservices:</strong></p><p>Separate shops handle different tasks:</p><ul><li>clothing shop</li><li>food court</li><li>electronics shop</li></ul><p>They are independent but still part of the same mall.</p><h3>Why Large Companies Use Microservices?</h3><p>Companies like:</p><ul><li>Netflix</li><li>Amazon</li><li>Uber Eats</li></ul><p>use microservices because different systems have different scaling needs.</p><p>For example:</p><ul><li>payments must be highly reliable</li><li>recommendations need heavy computation</li><li>search needs fast scaling</li></ul><p>With microservices:</p><ul><li>each system can scale independently</li><li>one failure does not break everything</li></ul><h3>Monolith vs Microservices</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*51DonBgmRp8eV3-pjRSLOw.png" /></figure><h3>Which One Should You Actually Use?</h3><p>This is where many developers make mistakes.</p><h4>Choose Monolith If:</h4><ol><li>You are building a student project</li></ol><p>2. Your application is small</p><p>3. Your team is small</p><p>4. You want faster development</p><p>5. You do not need complex scaling</p><h4>Choose Microservices If:</h4><ol><li>Your system is very large</li></ol><p>2. Many teams work independently</p><p>3. Different modules need separate scaling</p><p>4. High availability is important</p><p>5. The application keeps growing rapidly</p><h3>A Practical Truth Many Developers Ignore</h3><p>Most real-world systems <strong>start as a monolith first</strong></p><p>Then later <strong>get split into microservices when needed</strong></p><p>Why?</p><p>Because starting with microservices too early adds complexity:</p><ul><li>multiple deployments</li><li>DevOps overhead</li><li>inter-service communication issues</li><li>debugging difficulty</li></ul><p>For small projects, this can slow you down a lot.</p><h3>Final Thoughts</h3><p>Both architectures are useful.</p><ul><li><strong>Monolithic architecture </strong>is simple, fast, and great for small systems</li><li><strong>Microservices architecture </strong>is scalable, flexible, and suited for large systems</li></ul><p>The important thing is not choosing the “popular” option, but choosing what actually fits your project.</p><p>And more importantly, understanding <strong>why</strong> an architecture is used matters far more than memorizing definitions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c91451eb910" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST API Design Best Practices]]></title>
            <link>https://medium.com/@dinujachamodi/rest-api-design-best-practices-df28fbc1887a?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/df28fbc1887a</guid>
            <category><![CDATA[rest-api]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Wed, 06 May 2026 19:56:37 GMT</pubDate>
            <atom:updated>2026-05-06T20:18:41.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ftPepqZ8hbGD8DCwVEusw.png" /></figure><p>Most APIs work fine during development, but not all APIs are easy to use in real projects. The difference is not how they are built, but how they are designed.</p><p>In real projects, bad API design does not break the system immediately. Instead, it slowly creates problems like confusion for frontend developers, messy backend code, and difficulty in maintaining the system. Small mistakes in design can later cause inconsistent behavior and frequent breaking changes.</p><p>Many developers only focus on making APIs work, not on making them clean and easy to use.</p><p>That is why API design is just as important as backend logic. In this article, we will look at some REST API best practices that are often ignored but very important in real-world development.</p><h3>1. Use proper HTTP methods (don’t misuse GET/POST)</h3><p>Many beginners use POST for everything. That is wrong.</p><p>Use methods properly:</p><ul><li><strong>GET</strong> : to fetch data (read from server, no changes made)</li><li><strong>POST</strong> : to create data (add new record to database)</li><li><strong>PUT</strong> : to update data fully (replace the entire existing record)</li><li><strong>PATCH</strong> : to update data partially (change only specific fields)</li><li><strong>DELETE</strong> : to remove data (delete a record from the database)</li></ul><h4>Example:</h4><ul><li><strong>Get all products</strong> : GET/products</li><li><strong>Create a product</strong> : POST/products</li><li><strong>Update a product (full update)</strong> : PUT/products/123</li><li><strong>Update a product (partial update)</strong> : PATCH/products/123</li><li><strong>Delete a product</strong> : DELETE/products/123</li></ul><p>Simple rule:<br> Don’t use /createProduct or /deleteProduct if HTTP methods already handle it.</p><h3>2. Use clear and consistent naming</h3><p>This is something many developers ignore.</p><p>Bad:</p><ul><li>/getAllProducts</li><li>/create_user</li><li>/delete_user</li></ul><p>Good:</p><ul><li>/products</li><li>/users</li><li>/orders</li></ul><p>Keep it:</p><ul><li>lowercase</li><li>plural nouns</li><li>consistent style</li></ul><p>This makes your API feel professional.</p><h3>3. Don’t put actions in URLs</h3><p>REST APIs are not function calls.</p><p>Bad:</p><ul><li>/getUserData</li><li>/updateUserProfile</li><li>/buyProductNow</li></ul><p>Good:</p><ul><li>/users</li><li>/users/:id</li><li>/orders</li></ul><p>Actions should come from HTTP methods, not URL names.</p><h3>4. Always return meaningful status codes</h3><p>Many APIs always return 200 OK, even when something fails. This is a bad practice.</p><p>Use proper status codes:</p><ul><li>200 : success</li><li>201 : created</li><li>400 : bad request</li><li>401 : unauthorized</li><li>404 : not found</li><li>500 : server error</li></ul><h4>Example:</h4><p>If login fails:</p><pre>{<br>  &quot;message&quot;: &quot;Invalid credentials&quot;<br>}</pre><p>Status code should be:<br> 401 Unauthorized</p><h3>5. Keep response structure consistent</h3><p>Frontend developers struggle when API responses change format every time.</p><p>Bad:</p><pre>{ &quot;user&quot;: &quot;John&quot; }</pre><p>Then somewhere else:</p><pre>{ &quot;data&quot;: { &quot;name&quot;: &quot;John&quot; } }</pre><p>Good approach:<br> Always keep one structure:</p><pre>{<br>  &quot;success&quot;: true,<br>  &quot;message&quot;: &quot;User fetched successfully&quot;,<br>  &quot;data&quot;: {<br>    &quot;name&quot;: &quot;John&quot;<br>  }<br>}</pre><p>This makes frontend integration much easier.</p><h3>6. Don’t expose unnecessary data</h3><p>Sometimes APIs send too much data.</p><p>Example:<br> You only need username, but API sends:</p><ul><li>password hash</li><li>internal IDs</li><li>admin flags</li></ul><p>Always filter what you send.</p><p>Bad:</p><pre>{<br>  &quot;username&quot;: &quot;john&quot;,<br>  &quot;password&quot;: &quot;$hashed$&quot;,<br>  &quot;role&quot;: &quot;admin&quot;<br>}</pre><p>Good:</p><pre>{<br>  &quot;username&quot;: &quot;john&quot;<br>}</pre><h3>7. Use versioning from the start</h3><p>Many developers ignore versioning until it breaks everything.</p><p>Good practice:</p><p>/api/v1/products</p><p>/api/v2/products</p><p>Why it matters:</p><ul><li>you can update API without breaking old apps</li><li>safer for production systems</li></ul><h3>8. Handle errors properly</h3><p>Don’t just return “error occurred”.</p><p>Bad:</p><pre>{<br>  &quot;error&quot;: &quot;something went wrong&quot;<br>}</pre><p>Good:</p><pre>{<br>  &quot;success&quot;: false,<br>  &quot;message&quot;: &quot;Product not found&quot;,<br>  &quot;errorCode&quot;: &quot;PRODUCT_404&quot;<br>}</pre><p>This helps debugging a lot.</p><h3>9. Add pagination for large data</h3><p>Never return thousands of records in one request.</p><p>Bad:<br> GET/products : returns 10,000 items</p><p>Good:<br> GET/products?page=1&amp;limit=10</p><p>Example response:</p><pre>{<br>  &quot;data&quot;: [],<br>  &quot;page&quot;: 1,<br>  &quot;limit&quot;: 10,<br>  &quot;totalPages&quot;: 50<br>}</pre><h3>10. Keep APIs predictable</h3><p>This is the most important rule.</p><p>A good API should feel “guessable”.</p><p>If you know:</p><ul><li>/user</li><li>/products</li></ul><p>Then you should easily guess:</p><ul><li>/orders</li><li>/categories</li></ul><p>If developers need documentation for every small thing, the API design is weak.</p><h3>Conclusion</h3><p>REST API design is not just about making endpoints work. It’s about making them:</p><ul><li>easy to understand</li><li>consistent</li><li>scalable</li><li>clean for frontend usage</li></ul><p>Most developers ignore these basics because they focus only on “making it work”. But in real-world projects and interviews, clean API design is what makes you stand out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df28fbc1887a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Modelling Wildfire Boundary Movements Using the Level Set Method]]></title>
            <link>https://medium.com/@dinujachamodi/modelling-wildfire-boundary-movements-using-the-level-set-method-2c20396a9244?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c20396a9244</guid>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Wed, 24 Dec 2025 19:30:28 GMT</pubDate>
            <atom:updated>2025-12-24T19:30:28.688Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>URSIE 2025 — Undergraduate Research Symposium &amp; Innovation Exhibition</strong></p><h3>Introduction</h3><p>I had the opportunity to visit the<strong> </strong>Undergraduate Research Symposium and Innovation Exhibition (URSIE) 2025 held at the Faculty of Science, University of Kelaniya. The exhibition showcased a wide range of undergraduate research projects from different disciplines. Visiting this event helped me gain a better understanding of how research ideas are developed, presented, and communicated. One research publication that attracted my attention was related to modelling wildfire spread using mathematical methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*mcopMmqlJoM73QRZgqvjcA.jpeg" /></figure><h3>Research Details</h3><p><strong>Research Title:</strong><br>Modelling Wildfire Boundary Movements Using Level Set Method</p><p><strong>Authors:</strong><br>Wijerathna P. W. G. D. T.<br>De Silva S. H. D. S.</p><p><strong>Affiliation:</strong><br>Department of Mathematics, University of Kelaniya, Sri Lanka</p><p><strong>Paper ID:</strong><br>03</p><h3>Brief Description of the Research</h3><p>Wildfires are uncontrolled fires that spread rapidly through forests and grasslands, causing serious damage to the environment and human life. Predicting wildfire spread is challenging because many factors influence fire behavior.</p><p>This research uses the <strong>Level Set Method</strong> to model the movement of wildfire boundaries over time. The fire front is represented using a mathematical function, allowing continuous and smooth boundary evolution.</p><p>The model considers multiple real-world factors, including:</p><ul><li>Wind speed and direction</li><li>Terrain slope</li><li>Vegetation and fuel characteristics</li><li>Moisture content</li><li>Bayesian correction to update predictions using new data</li></ul><p>Numerical simulations were carried out using <strong>MATLAB</strong> to observe how the wildfire boundary evolves under different conditions.</p><h3>Results and Discussion</h3><p>The simulation results show that environmental factors significantly affect the shape and direction of wildfire spread. Compared to traditional models, this approach provides more realistic predictions, which can support better wildfire management and decision-making.</p><h3>Ongoing Work</h3><p>Future work focuses on:</p><ul><li>Comparing this model with existing wildfire models</li><li>Extending the model to handle irregular and randomly generated fire shapes</li></ul><h3>Personal Learning Outcome</h3><p>Attending URSIE 2025 and reviewing this research helped me understand the practical application of mathematical modeling in solving real-world environmental problems. It also improved my awareness of research presentation and academic writing, which will be useful for my future studies.</p><h3>Conclusion</h3><p>The research <em>“Modelling Wildfire Boundary Movements Using Level Set Method”</em> presents a strong example of how advanced mathematical techniques can improve disaster prediction and management. It was one of the impactful undergraduate research projects showcased at URSIE 2025 and serves as an excellent reference for students interested in applied mathematics and environmental modeling.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c20396a9244" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OOP Concepts in Java: A Simple Beginner’s Guide]]></title>
            <link>https://medium.com/@dinujachamodi/oop-concepts-in-java-a-simple-beginners-guide-0bf0f7819e89?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bf0f7819e89</guid>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 14:02:55 GMT</pubDate>
            <atom:updated>2025-08-26T15:49:27.496Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*rwOgeSscIAmXlnWZIob4Rw.png" /></figure><p>Object-Oriented Programming (OOP) is one of the most popular programming paradigms. Instead of writing code as a collection of instructions, OOP allows us to model real-world entities as objects, making software easier to build, understand, and maintain. It helps create programs that are organized, reusable, and scalable.</p><p>In this article, we’ll cover the foundation of OOP, Classes and Objects, followed by the four main concepts: Encapsulation, Abstraction, Inheritance, and Polymorphism.</p><h4>Classes and Objects</h4><p><strong>Class:</strong> A blueprint or template for creating objects.</p><p><strong>Object:</strong> A specific instance of a class with its own attribute values.</p><p><strong><em>Code Example:</em></strong></p><pre>class Car {<br>    String brand;  // attribute of the Car class<br><br>    void drive() {<br>        System.out.println(&quot;Car is moving&quot;); // method to show car is moving<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        Car myCar = new Car();     // create a new Car object<br>        myCar.brand = &quot;Toyota&quot;;    // set brand attribute<br>        myCar.drive();             // call drive() method<br>    }<br>}</pre><p>Now let’s talk about the four oop concepts.</p><h4><strong>1. Encapsulation</strong></h4><p>Encapsulation means bundling data and methods in a class, and hiding data from outside.</p><p>To do Encapsulation in java:</p><ol><li>Make class variables<strong> </strong>private</li><li>Use getter(to read) and setter(to update) methods as public</li></ol><p><strong><em>Real world Example:</em></strong></p><p>In your ATM card, the card hides your bank account details, and you can only access money using a PIN</p><p><strong><em>Code Example:</em></strong></p><pre>class Person {<br>    private String name; // hidden attribute, cannot access directly<br><br>    // getter method to read the name<br>    public String getName() {<br>        return name;<br>    }<br><br>    // setter method to update the name<br>    public void setName(String newName) {<br>        this.name = newName;<br>    }<br>}</pre><h4>2. Abstraction</h4><p>Abstraction means showing only essential details while hiding unnecessary information.</p><p>In Java, abstraction is achieved using abstract classes or interfaces.</p><p><strong><em>Real world Example:</em></strong></p><p>When you drive a car, you see the steering wheel, pedals, and gear, but you don’t need to know how the engine works internally</p><p><strong><em>Code Example:</em></strong></p><pre>abstract class Animal {<br>    public abstract void sound(); // abstract method, no body<br>}<br><br>class Dog extends Animal {<br>    public void sound() {<br>        System.out.println(&quot;Bark!&quot;); // provide implementation<br>    }<br>}</pre><h4>3. Inheritance</h4><p>Lets a child class(subclass) use properties and methods of a parent class(superclass).</p><p>Shows an IS-A relationship (Ex: Dog is an Animal)</p><p>Use the extends keyword in Java.</p><p><strong><em>Real world Example:</em></strong></p><p>A dog inherits traits from an animal (can eat, sleep, make sound). The dog also has its own features like barking</p><p><strong><em>Code Example:</em></strong></p><pre>class Animal { // Parent class<br>    void eat() {<br>        System.out.println(&quot;Animal eats&quot;);<br>    }<br>}<br><br>class Dog extends Animal { // Child class<br>    void bark() {<br>        System.out.println(&quot;Dog barks&quot;);<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        Dog myDog = new Dog();<br>        myDog.eat();  // inherited method<br>        myDog.bark(); // child method<br>    }<br>}</pre><h4>4. Polymorphism</h4><p>Polymorphism Means “many forms”</p><p><strong><em>Real world Example:</em></strong></p><p>A person can be a teacher in a school, a passenger in a bus and a driver on the road. The same person behave differently depending on the role they are performing</p><p>There are 2 types of Polymorphism in Java:</p><ol><li><strong>Compile-time Polymorphism (Method Overloading)</strong></li></ol><p>Same method name with different parameter lists.</p><p><strong><em>Code Example:</em></strong></p><pre>class Calculator {<br>    int add(int a, int b) {<br>        return a + b; // add integers<br>    }<br><br>    double add(double a, double b) {<br>        return a + b; // add doubles<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        Calculator calc = new Calculator();<br>        System.out.println(calc.add(5, 3));     // prints: 8<br>        System.out.println(calc.add(5.5, 3.2)); // prints: 8.7<br>    }<br>}</pre><p><strong>2. Runtime polymorphism (Method Overriding)</strong></p><p>Child class overrides parent method.</p><p><strong><em>Code Example:</em></strong></p><pre>class Animal {<br>    void sound() {<br>        System.out.println(&quot;Animal sound&quot;); // parent method<br>    }<br>}<br><br>class Dog extends Animal {<br>    void sound() {<br>        System.out.println(&quot;Dog barks&quot;); // overridden method<br>    }<br>}<br><br>public class Main {<br>    public static void main(String[] args) {<br>        Animal animal = new Dog();  <br>        animal.sound();             // prints: Dog barks <br>    }<br>}</pre><h4>Conclusion</h4><p>Object-Oriented Programming makes it easier to model real-world problems in code. By mastering Classes and Objects along with Encapsulation, Abstraction, Inheritance, and Polymorphism, you can create programs that are organized, reusable, and easy to maintain. Start small, practice often, and OOP will soon become second nature in your Java projects.</p><h4>References</h4><ul><li>GeeksforGeeks. (2025, August 12). <em>Java OOP (Object-Oriented Programming) concepts</em>. GeeksforGeeks. <a href="https://geeksforgeeks.org/java/object-oriented-programming-oops-concept-in-java/">https://geeksforgeeks.org/java/object-oriented-programming-oops-concept-in-java/</a></li><li>Stackify. (n.d.). <em>OOPs concepts in Java</em>. Stackify. <a href="https://stackify.com/oops-concepts-in-java/">https://stackify.com/oops-concepts-in-java/</a></li><li>Raygun. (2023, July 11). <em>OOP concepts in Java: A beginner’s guide</em>. Raygun Blog. <a href="https://raygun.com/blog/oop-concepts-java/">https://raygun.com/blog/oop-concepts-java/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bf0f7819e89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building DROS: My First 16-bit Operating System in Assembly]]></title>
            <link>https://medium.com/@dinujachamodi/building-dros-my-first-16-bit-operating-system-in-assembly-eb6a46b7a7b8?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb6a46b7a7b8</guid>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 21:19:24 GMT</pubDate>
            <atom:updated>2025-06-24T09:23:57.856Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*KwgkkX2XVYNvt4-6fbawEg.avif" /></figure><h3>Introduction</h3><p>DROS is a simple 16-bit operating system I built from scratch in Assembly using NASM and tested with QEMU. It demonstrates how an OS boots, handles hardware directly, and processes user commands, all without using high-level languages. This project gave me hands-on insight into real-mode architecture, BIOS interrupts, and the fundamentals of system programming.</p><h3>Why write an OS?</h3><p>Creating a simple 16-bit OS like DROS, even without multitasking or a file system helped me:</p><ul><li>Understand how the CPU interacts with memory at a low level</li><li>Work directly with BIOS interrupts to manage screen and keyboard I/O</li><li>Explore how the boot process loads and starts an operating system</li><li>Build a basic command interpreter and see how it handles user input</li><li>Appreciate the inner workings of computers beyond modern operating systems</li></ul><p>It was a rewarding, hands-on dive into how computers operate beneath all the abstractions we usually work with.</p><h3>Tools used</h3><ul><li><strong>NASM -</strong>The assembler I used to write all my 16-bit x86 Assembly code. It’s lightweight and perfect for low-level OS development.</li><li><strong>QEMU -</strong>A virtual machine emulator that let me test my OS without needing real hardware.</li><li><strong>Ubuntu Linux</strong> -My main development environment. It provided all the tools I needed and made scripting and compiling much easier.</li><li><strong>Shell Scripts -</strong>I used simple bash scripts to automate the build and testing process, so I could focus more on the code itself.</li></ul><h3>Features of DROS</h3><h4><strong>Hardware information display</strong></h4><p>DROS can show the following system details:</p><ol><li>Base Memory and Extended Memory</li><li>Total Memory</li><li>CPU Vendor and Brand String</li><li>Number of Hard Drives</li><li>Mouse Connection Status</li><li>Number of Serial Ports and COM1 Address</li><li>CPU Features: FPU, MMX, SSE, SSE2</li></ol><h4>Built-in Command Line Interface (CLI)</h4><p>Supported commands:</p><ul><li><em>info</em> – Displays system and hardware info</li><li><em>help</em> – Lists all available commands</li><li><em>clear</em> – Clears the screen</li><li><em>about</em> – Shows author information</li><li><em>version </em>– Displays OS version</li><li><em>time</em> – Shows current BIOS system time</li><li><em>reboot</em> – Restarts the system</li></ul><h3>Full Build Process of DROS (with Commands)</h3><p>This is how I created <strong>DROS</strong>, a 16-bit real-mode operating system kernel, using NASM and QEMU.</p><h4>Step 1: Set Up the Development Environment</h4><p>Install the necessary tools on Ubuntu Linux.</p><pre>sudo apt update<br>sudo apt install nasm qemu genisoimage mtools</pre><h4>Step 2: Write the Bootloader and Kernel</h4><p>I wrote two main <em>.asm</em> files:</p><ul><li><strong>bootloader.asm </strong>-byte boot sector code adapted from MikeOS to load the kernel and start execution.</li><li><strong>kernel.asm</strong> -Contains the full OS logic (including commands like info, clear, help etc)</li></ul><h4>Step 3: Write the Build and Test Scripts</h4><h4><strong>build-linux.sh</strong></h4><p>This script assembles the kernel and prepares a floppy image.</p><pre>nasm -f bin bootload.asm -o bootload.bin<br>nasm -f bin kernel.asm -o kernel.bin<br><br># Create a 1.44MB floppy image and copy bootloader and kernel into it<br>dd if=/dev/zero of=dros.flp bs=512 count=2880<br>mcopy -i dros.flp bootload.bin <br>mcopy -i dros.flp kernel.bin </pre><p>Make it excecutable:</p><pre>chmod +x build-linux.sh</pre><h4>test-linux.sh</h4><p>This script runs the OS in QEMU.</p><pre>qemu-system-i386 -fda dros.flp</pre><p>Make it excecutable:</p><pre>chmod +x test-linux.sh</pre><h4>Step 4: Build and Run Your OS</h4><p>Run the following commands to build and test:</p><pre>sudo ./build-linux.sh <br>sudo ./test-linux.sh</pre><p>After build command, you will see the terminal as follow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*ov9J6cLloU70W13RbICksw.png" /></figure><p>After text command, you will see your DROS prompt like this:</p><p><strong>Welcome screen</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*gut8yGkRPqSc54xghDUFJg.png" /></figure><p><strong>Output of the help command</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*lH-n6c3TNdcrfluTlsU21Q.png" /></figure><p><strong>Output of the info command</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*kGnIrvht4T4sNb3mrP0t6A.png" /></figure><p><strong>Output of clear command</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*JiOodGznpHUChPB0sRDiTQ.png" /></figure><p><strong>Output of about, version, time, and reboot commands</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*ZhZ4J_I2loFGQ-PRWpX3Xg.png" /></figure><h3>Conclusion</h3><p>Building DROS was an eye-opening experience that deepened my understanding of how operating systems work at the lowest level. Through hands-on coding in Assembly and working directly with BIOS interrupts and hardware, I gained practical skills and a new appreciation for the complexity behind even the simplest OS features. This project laid a strong foundation for exploring more advanced OS concepts in the future.</p><p>Github Repository Link: <a href="https://github.com/Dinuja937/DROS">https://github.com/Dinuja937/DROS</a></p><h3>References</h3><p>MikeOS. (n.d.). <em>Write your own OS</em>. Retrieved June 24, 2025, from <a href="https://mikeos.sourceforge.net/write-your-own-os.html">https://mikeos.sourceforge.net/write-your-own-os.html</a></p><p>Chinthana, E. (2020). <em>JOSH Extended: A simple hobby OS in assembly language</em>. Medium. <a href="https://medium.com/@edpchinthana/josh-extended-e14a19dcb9e0">https://medium.com/@edpchinthana/josh-extended-e14a19dcb9e0</a></p><p>Setublog. (2021). <em>Hands-on to operating systems</em>. Medium. <a href="https://medium.com/setublog/hands-on-to-operating-systems-a847e9dc75f7">https://medium.com/setublog/hands-on-to-operating-systems-a847e9dc75f7</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb6a46b7a7b8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevOps Essentials: What Every Beginner Should Know]]></title>
            <link>https://medium.com/@dinujachamodi/devops-essentials-what-every-beginner-should-know-f36fd48c6220?source=rss-44259562a94e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f36fd48c6220</guid>
            <category><![CDATA[devops-for-beginners]]></category>
            <dc:creator><![CDATA[Dinuja Ranaweera]]></dc:creator>
            <pubDate>Sat, 03 May 2025 13:17:18 GMT</pubDate>
            <atom:updated>2025-05-03T13:28:02.021Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*0P3Bwt7TS4QXxAxx84LUeg.jpeg" /></figure><h4>What is DevOps?</h4><p>DevOps = Dev(Development) + Ops(Operations)</p><p>DevOps is primarily a culture where Development (Dev) and Operations (Ops) teams work together, using practical practices created by the people who do the work.</p><p>It’s not a tool, standard, product, or a job title.</p><h4>Goals of DevOps</h4><ul><li>Dev and Ops work together as one team</li><li>They share common goals like speed and stability</li><li>The goal is to deliver software faster with fewer failures</li><li>Both teams care about quick recovery when something goes wrong</li><li>Dev and Ops roles often overlap to support better teamwork</li></ul><h4>Key DevOps Practices</h4><p><strong>1. Build Automation</strong></p><p><strong><em>What it is:</em></strong><br> Automatically prepares code for deployment by compiling, testing, and packaging it.</p><p><strong><em>Why it’s important:</em></strong></p><ul><li>Fast</li><li>Consistent</li><li>Repeatable</li><li>Portable</li><li>Reliable</li></ul><p><strong>2. Continuous Integration (CI)</strong></p><p><strong><em>What it is:</em></strong><br> Developers frequently merge their code changes into a shared repository, with automated tests run each time.</p><p><strong><em>Why it’s important:</em></strong></p><ul><li>Early detection</li><li>Reduces last minute integration issues</li><li>Frequent release</li><li>Continuous testing</li><li>Good coding practices</li></ul><p><strong>3. Continuous Delivery(CD) and Continuous Deployment</strong></p><p><strong><em>What it is:</em></strong></p><ul><li><strong><em>Continuous Delivery</em></strong><em>:</em> Keeps the code always ready for deployment</li><li><strong><em>Continuous Deployment</em></strong><em>:</em> Automatically deploys every change to production</li></ul><p><strong><em>Why it’s important:</em></strong></p><ul><li>Faster time to market</li><li>Fewer problems caused by the deployment process</li><li>Lower risk</li><li>Reliable rollbacks</li><li>Fearless deployments</li></ul><p><strong>4. Infrastructure as Code (IaC)</strong></p><p><strong><em>What it is:</em></strong><br> Managing servers, networks, and environments using code and automation.</p><p><strong><em>Why it’s important:</em></strong></p><ul><li>Consistency</li><li>Reusability</li><li>Scalability</li><li>Self-documenting</li><li>Simplify the complexity</li></ul><p><strong>5. Configuration Management</strong></p><p><strong><em>What it is:</em></strong><br> Managing the setup and changes of infrastructure in a consistent and automated way.</p><p><strong><em>Why it’s important:</em></strong></p><ul><li>Save time</li><li>Insight</li><li>Maintainability</li><li>Reduces configuration drift</li></ul><p><strong>6. Orchestration</strong></p><p><strong><em>What it is:</em></strong><br> Automating and coordinating complex tasks and workflows across systems.</p><p><strong><em>Why it’s important:</em></strong></p><ul><li>Scalability</li><li>Stability</li><li>Save time</li><li>Self- service</li><li>Granular insight into resource usage</li></ul><p><strong>7. Monitoring</strong></p><p><strong><em>What it is:</em></strong><br> Tracking performance, stability, and resource usage of systems and applications.</p><p><strong><em>Why it’s important:</em></strong></p><ul><li>Fast recovery</li><li>Better root cause analysis</li><li>Visibility across teams</li><li>Automated response</li></ul><h4>DevOps Tools</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85S_qYuuTNKJDkqI-dwWGg.jpeg" /></figure><p>DevOps tools are software applications that help teams automate, manage, and streamline different parts of the software development and IT operations process such as coding, building, testing, deploying, and monitoring.</p><p><strong><em>The Periodic Table of DevOps Tools:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P3xoETmeW-M4cedcgDmFlw.png" /></figure><ol><li><strong>Build Automation</strong></li></ol><ul><li>Java- ant, maven, gradle</li><li>Javascript- npm, grunt, gulp</li><li>General/Unix- Make</li><li>Images/Containers- Packer</li></ul><p><strong>2. Continuous Integration (CI)</strong></p><ul><li>Jenkins</li><li>TravisCI</li><li>Bamboo</li></ul><p><strong>3. Configuration Management</strong></p><ul><li>Ansible</li><li>Puppet</li><li>Chef</li><li>Salt</li></ul><p><strong>4. Virtualization</strong></p><ul><li>VMWare ESX and ESXi</li><li>Microsoft Hyper-V</li><li>Citrix XenServer</li></ul><p><strong>5. Containerization</strong></p><ul><li>Docker</li></ul><p><strong>6. Monitoring</strong></p><p><strong><em>Infrastructure Monitoring Tools:</em></strong></p><ul><li>SenSu</li><li>NewRelic</li></ul><p><strong><em>Application Performance Monitoring Tools:</em></strong></p><ul><li>AppDynamics</li><li>NewRelic</li></ul><p><strong><em>Aggregation and Analytics Tools:</em></strong></p><p>• Elastic Stack</p><p><strong>7. Orchestration</strong></p><ul><li>Docker Swarm</li><li>Kubernetes</li><li>Zookeeper</li><li>Terraform</li></ul><h4>DevOps and the Cloud</h4><p>DevOps and Cloud are not same, but they help each other.</p><ul><li><strong><em>DevOps</em></strong> –a culture of collaboration between Dev and Ops</li><li><strong><em>The Cloud</em></strong> –remote servers on the internet that offer services in place of locally-hosted solutions.</li></ul><p>Many cloud services are built on DevOps practices.</p><p><strong>Cloud Service Models</strong></p><ol><li><strong><em>Infrastructure as a Service (IaaS)</em></strong></li></ol><ul><li>Virtual machines and storage are provided</li><li>Applications, operating systems, and configurations must be managed by the user</li><li><em>Examples:</em> Amazon ec2 instances, Microsoft Azure VMs and containers, Google Compute Engine</li></ul><p>2.<strong><em> Platform as a Service (PaaS)</em></strong></p><ul><li>A platform is provided to run and manage applications</li><li>Only the application and data need to be managed</li><li><em>Examples:</em> AWS Elastic Beanstalk, Heroku, Google App Engine</li></ul><p><strong>3. <em>Software as a Service (SaaS)</em></strong></p><ul><li>Complete software applications are provided over the internet</li><li>No setup or installation is required by the end user</li><li><em>Examples:</em> Gmail, Microsoft Office 365</li></ul><p><strong>4. <em>Serverless/ Function as a Service (FaaS)</em></strong></p><ul><li>Small code functions are run on demand</li><li>Billing is based on the number of function executions</li><li><em>Examples: </em>AWS Lambda, Azure functions, Google Cloud Functions</li></ul><h4>Conclusion</h4><p>DevOps is more than just a set of tools, it’s a cultural shift that brings development and operations teams together to build, test, and release software faster and more reliably. By adopting key DevOps practices like automation, continuous integration, infrastructure as code, and monitoring, teams can deliver high-quality software with greater efficiency and fewer failures. Whether you’re a developer, system administrator, or just starting your journey in tech, understanding DevOps fundamentals is essential in today’s fast-moving software world. As technology evolves, embracing DevOps will not only improve collaboration and speed but also drive innovation and business success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f36fd48c6220" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>