<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nurul Islam Rimon</title>
    <description>The latest articles on Forem by Nurul Islam Rimon (@nurulislamrimon).</description>
    <link>https://forem.com/nurulislamrimon</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1261378%2F595704c6-5506-4591-b369-09b64fef67ff.png</url>
      <title>Forem: Nurul Islam Rimon</title>
      <link>https://forem.com/nurulislamrimon</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nurulislamrimon"/>
    <language>en</language>
    <item>
      <title>Secure Your Server in 5 Minutes: Ditch Root + Password SSH Forever</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Mon, 26 Jan 2026 11:26:09 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/secure-your-server-in-5-minutes-ditch-root-password-ssh-forever-11cl</link>
      <guid>https://forem.com/nurulislamrimon/secure-your-server-in-5-minutes-ditch-root-password-ssh-forever-11cl</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywc97gjkcau071wdv286.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fywc97gjkcau071wdv286.jpg" alt=" " width="784" height="1168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why root login is dangerous
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Root + password = easy target for bots. One weak password = full server compromise.&lt;/strong&gt;&lt;br&gt;
The secure way (best practice in 2025):&lt;/p&gt;
&lt;h2&gt;
  
  
  Steps:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Create a normal sudo user
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;adduser admin
usermod -aG sudo admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Set up SSH key authentication
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir -p /home/admin/.ssh
chmod 700 /home/admin/.ssh
chown admin:admin /home/admin/.ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Add public key
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# On your local machine: copy public key
cat ~/.ssh/id_ed25519.pub   # or id_rsa.pub

# On server (as admin user):
nano ~/.ssh/authorized_keys   # paste the key
chmod 600 ~/.ssh/authorized_keys
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Test login
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh admin@YOUR_SERVER_IP
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ol&gt;
&lt;li&gt;Disable root &amp;amp; password login
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PermitRootLogin no
PasswordAuthentication no
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Restart SSH:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl restart ssh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Done!&lt;/strong&gt;&lt;br&gt;
Your server is now way harder to hack.&lt;br&gt;
Use ed25519 keys (faster &amp;amp; more secure):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ssh-keygen -t ed25519 -C "your@email.com"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
      <category>ubuntu</category>
      <category>systemadmin</category>
      <category>system</category>
    </item>
    <item>
      <title>Monitoring Linux servers without Grafana, Docker, or agents</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Thu, 22 Jan 2026 06:10:47 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/monitoring-linux-servers-without-grafana-docker-or-agents-37l5</link>
      <guid>https://forem.com/nurulislamrimon/monitoring-linux-servers-without-grafana-docker-or-agents-37l5</guid>
      <description>&lt;p&gt;Checking server health usually means running the same commands again and again:&lt;/p&gt;

&lt;p&gt;top, free, df, ss, ps…&lt;/p&gt;

&lt;p&gt;Grafana is powerful — but often overkill for quick monitoring.&lt;/p&gt;

&lt;p&gt;So I built Server Status.&lt;/p&gt;

&lt;p&gt;A real-time, Grafana-inspired dashboard that runs entirely inside the terminal.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No browser.&lt;/li&gt;
&lt;li&gt;No services.&lt;/li&gt;
&lt;li&gt;No setup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Just run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server-status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsxg6hf85flgzj4k9e2pd.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsxg6hf85flgzj4k9e2pd.gif" alt=" " width="1110" height="760"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  And instantly see:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;CPU (total + per core)&lt;/li&gt;
&lt;li&gt;Memory &amp;amp; swap&lt;/li&gt;
&lt;li&gt;Disk usage&lt;/li&gt;
&lt;li&gt;Network RX/TX&lt;/li&gt;
&lt;li&gt;Active connections&lt;/li&gt;
&lt;li&gt;Processes&lt;/li&gt;
&lt;li&gt;Top CPU-hungry tasks&lt;/li&gt;
&lt;li&gt;Service status (nginx, mysql, docker, custom)&lt;/li&gt;
&lt;li&gt;Fast. Lightweight. Flicker-free.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Install in 10 seconds:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/nurulislamrimon/server-status/main/server-status.sh -o server-status
chmod +x server-status
sudo mv server-status /usr/local/bin/server-status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Customize it:
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server-status --refresh 2 --services "nginx,mysql,docker"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub: &lt;a href="https://github.com/nurulislamrimon/server-status" rel="noopener noreferrer"&gt;https://github.com/nurulislamrimon/server-status&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If it helps you, a ⭐ means a lot.&lt;/p&gt;

&lt;p&gt;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -&lt;br&gt;
Code. Scale. Repeat.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Nurul Islam Rimon,&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Fullstack Dev at ExpertSquad.net&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>opensource</category>
      <category>monitoring</category>
    </item>
    <item>
      <title>Uploading Files to Cloudflare R2 from the Frontend (No Axios Needed!)</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Tue, 13 May 2025 10:43:29 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/uploading-files-to-cloudflare-r2-from-the-frontend-no-axios-needed-5600</link>
      <guid>https://forem.com/nurulislamrimon/uploading-files-to-cloudflare-r2-from-the-frontend-no-axios-needed-5600</guid>
      <description>&lt;p&gt;&lt;em&gt;Are you building a file upload feature for your web app?&lt;br&gt;
Want to keep things fast and efficient without using any backend for the actual upload?&lt;br&gt;
Let me show you how to upload files directly to Cloudflare R2 using a pre-signed URL and plain fetch — no axios, no SDKs, no stress.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Generate a Signed Upload URL on the Server&lt;/strong&gt;&lt;br&gt;
To avoid exposing your R2 credentials on the frontend, you should generate a signed PUT URL on the backend. &lt;br&gt;
&lt;a href="https://medium.com/@nurulislamrimon/how-to-generate-signed-urls-for-aws-s3-objects-using-node-js-visit-private-assets-3477d84e11da" rel="noopener noreferrer"&gt;Click here&lt;/a&gt; to read article about generating signed url.&lt;/p&gt;

&lt;p&gt;Here’s an example response from your backend API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "signedUrl": "https://your-bucket.r2.cloudflarestorage.com/filename.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;amp;..."
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 2: Upload from the Frontend Using Fetch&lt;br&gt;
Here’s a minimal example using an HTML file input and plain JavaScript:&lt;/p&gt;

&lt;p&gt;✅ HTML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;input type="file" id="fileInput" /&amp;gt;
&amp;lt;button onclick="uploadFile()"&amp;gt;Upload&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ JavaScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;async function uploadFile() {
  const input = document.getElementById('fileInput');
  const file = input.files[0];
  if (!file) return alert("Please select a file!");

  // 1. Get a signed upload URL from your backend
  const res = await fetch(`/api/r2-signed-url?filename=${encodeURIComponent(file.name)}`);
  const { signedUrl } = await res.json();

  // 2. Upload the file directly to R2
  const uploadRes = await fetch(signedUrl, {
    method: 'PUT',
    body: file,
  });

  if (uploadRes.ok) {
    alert("✅ Upload successful!");
  } else {
    alert("❌ Upload failed.");
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Why This Works&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;No extra libraries (no axios)&lt;/li&gt;
&lt;li&gt;Faster uploads because the file goes straight from browser → Cloudflare&lt;/li&gt;
&lt;li&gt;Secure: your app’s R2 credentials stay on the server&lt;/li&gt;
&lt;li&gt;Scalable: you don’t stress your backend with file payloads&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Don't Forget CORS!&lt;/strong&gt;&lt;br&gt;
Make sure your R2 bucket has CORS enabled for PUT requests.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;CORSRule&amp;gt;
  &amp;lt;AllowedMethod&amp;gt;PUT&amp;lt;/AllowedMethod&amp;gt;
  &amp;lt;AllowedOrigin&amp;gt;*&amp;lt;/AllowedOrigin&amp;gt; &amp;lt;!-- or restrict to your domain --&amp;gt;
  &amp;lt;AllowedHeader&amp;gt;*&amp;lt;/AllowedHeader&amp;gt;
&amp;lt;/CORSRule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📌 Author: Nurul Islam Rimon&lt;br&gt;
🔧 Fullstack Developer | Expertsquad&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cloudflarechallenge</category>
      <category>javascript</category>
      <category>server</category>
    </item>
    <item>
      <title>Stop Using Repetitive Validation Logic – Embrace Zod</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Sun, 11 May 2025 06:25:00 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/stop-using-repetitive-validation-logic-embrace-zod-cn6</link>
      <guid>https://forem.com/nurulislamrimon/stop-using-repetitive-validation-logic-embrace-zod-cn6</guid>
      <description>&lt;p&gt;If you're a backend or fullstack developer, you've probably written this kind of code more times than you'd like to admit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (!req.body.email || !req.body.password) {
  return res.status(400).json({ message: 'Missing fields' });
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It works... but it gets messy really fast.&lt;br&gt;
As your project grows, repeating this kind of manual validation on every route becomes painful and error-prone.&lt;/p&gt;

&lt;p&gt;Let me introduce you to something better.&lt;/p&gt;
&lt;h2&gt;
  
  
  ✅ Meet Zod – The Cleaner Way to Validate
&lt;/h2&gt;

&lt;p&gt;Zod is a TypeScript-first schema validation library. It helps you define what your data should look like and automatically validates it.&lt;/p&gt;

&lt;p&gt;No more writing if (!email) and if (typeof password !== 'string') every time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔧 Example: Login Request Validation&lt;/strong&gt;&lt;br&gt;
Let’s take a simple login API example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;❌ Without Zod:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.post('/login', (req, res) =&amp;gt; {
  const { email, password } = req.body;

  if (!email || !password) {
    return res.status(400).json({ message: 'Missing email or password' });
  }

  if (typeof email !== 'string' || typeof password !== 'string') {
    return res.status(400).json({ message: 'Invalid input types' });
  }

  // Continue with login logic...
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is already ugly — and we’ve just started.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✅ With Zod:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { z } from 'zod';

const loginSchema = z.object({
  email: z.string().email(),
  password: z.string().min(6),
});

app.post('/login', (req, res) =&amp;gt; {
  const result = loginSchema.safeParse(req.body);

  if (!result.success) {
    return res.status(400).json({ message: 'Invalid input', errors: result.error.format() });
  }

  const { email, password } = result.data;

  // Continue with login logic...
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Much cleaner. More reliable. Fully typed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔁 Reusability Is a Bonus&lt;/strong&gt;&lt;br&gt;
Once you define a schema, you can reuse it anywhere: routes, services, unit tests, even the frontend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// validators/user.ts
export const registerSchema = z.object({
  name: z.string().min(1),
  email: z.string().email(),
  password: z.string().min(6),
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use it wherever you need:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { registerSchema } from './validators/user';

const result = registerSchema.safeParse(req.body);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No more duplicate validation logic across your app.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💥 Bonus: It Works with TypeScript Seamlessly&lt;/strong&gt;&lt;br&gt;
Zod works great with TypeScript out of the box.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type LoginInput = z.infer&amp;lt;typeof loginSchema&amp;gt;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get type-safety and runtime validation. No extra setup needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So,&lt;/strong&gt;&lt;br&gt;
If you’re tired of repeating the same if (!value) checks and want your code to look cleaner, safer, and more modern — try Zod.&lt;br&gt;
It’s simple to use, works beautifully with TypeScript, and helps you write better backend logic faster.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Let your validation work for you, not against you.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
      <category>zod</category>
      <category>webdev</category>
      <category>backend</category>
      <category>backenddevelopment</category>
    </item>
    <item>
      <title>🔌 Accessing Localhost from the Internet – Simple Tunneling Tools</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Sun, 04 May 2025 11:49:06 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/accessing-localhost-from-the-internet-simple-tunneling-tools-13p9</link>
      <guid>https://forem.com/nurulislamrimon/accessing-localhost-from-the-internet-simple-tunneling-tools-13p9</guid>
      <description>&lt;p&gt;When you're building a web app on your local machine, sometimes you need to share it with someone online — maybe a teammate, client, or even for testing on your mobile device. But localhost only works on your computer.&lt;/p&gt;

&lt;p&gt;That’s where tunneling tools come in! They create a secure public URL that maps to your local server. Below are three popular options:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. 🌐 ngrok
&lt;/h2&gt;

&lt;p&gt;Website: &lt;a href="https://ngrok.com" rel="noopener noreferrer"&gt;https://ngrok.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How it works: You run a command like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ngrok http 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and ngrok gives you a public HTTPS link that forwards traffic to your &lt;code&gt;localhost:3000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very fast and reliable&lt;/li&gt;
&lt;li&gt;Works well with webhooks (e.g., Stripe, GitHub)&lt;/li&gt;
&lt;li&gt;Dashboard to inspect requests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Free tier has time and region limits&lt;/li&gt;
&lt;li&gt;Requires an account after initial use&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. 🌍 localtunnel
&lt;/h2&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/localtunnel/localtunnel" rel="noopener noreferrer"&gt;https://github.com/localtunnel/localtunnel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt;&lt;br&gt;
Install it globally with&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -g localtunnel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;lt --port 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Super simple and open source&lt;/li&gt;
&lt;li&gt;No signup required&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can be slower or less reliable than others&lt;/li&gt;
&lt;li&gt;Fewer features, no UI&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. ☁️ Cloudflare Tunnel (formerly Argo Tunnel)
&lt;/h2&gt;

&lt;p&gt;Docs: &lt;a href="https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/" rel="noopener noreferrer"&gt;https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;How it works:&lt;br&gt;
You install Cloudflare’s &lt;code&gt;cloudflared&lt;/code&gt; CLI and connect your app through Cloudflare.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pros:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Very secure&lt;/li&gt;
&lt;li&gt;Great if you're already using Cloudflare DNS&lt;/li&gt;
&lt;li&gt;Free with more generous limits than ngrok&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Cons:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slightly more setup steps&lt;/li&gt;
&lt;li&gt;Best for advanced users or teams&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🧠 Final Thoughts&lt;/strong&gt;&lt;br&gt;
These tunneling tools are a must-have in every web developer’s toolkit. They save time, help with collaboration, and enable real-time testing across devices or the internet.&lt;/p&gt;

&lt;p&gt;Just pick the one that fits your workflow and you're good to go!&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;

</description>
      <category>localhost</category>
      <category>webdev</category>
      <category>tunnel</category>
      <category>development</category>
    </item>
    <item>
      <title>Jin – The Easiest Way to View JSON from Any API</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Sun, 04 May 2025 10:36:14 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/jin-the-easiest-way-to-view-json-from-any-api-jn</link>
      <guid>https://forem.com/nurulislamrimon/jin-the-easiest-way-to-view-json-from-any-api-jn</guid>
      <description>&lt;p&gt;If you've ever needed to test an API endpoint or just wanted to see the structure of a JSON response quickly, you know it can be a hassle opening heavy tools or browser consoles. That’s where Jin comes in — a beautifully minimal and fast JSON API viewer that works right in your browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌟 What Is Jin?&lt;/strong&gt;&lt;br&gt;
Jin is a lightweight web app that lets you paste any public API URL and view its JSON response instantly in a clean, color-coded format. No signup, no installation, no clutter — just the JSON you want, clearly formatted and easy to read.&lt;/p&gt;

&lt;p&gt;Whether you're a developer, a student, or someone working with APIs, Jin is your quick go-to tool.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;✨ Key Features&lt;/strong&gt;&lt;br&gt;
Instant Visualization: Paste your API link, hit Enter, and instantly see the response.&lt;/p&gt;

&lt;p&gt;Syntax Highlighting: Color-coded formatting helps you easily distinguish keys, values, strings, numbers, and booleans.&lt;/p&gt;

&lt;p&gt;Clean UI: Designed with simplicity and elegance in mind — easy to use even on your first visit.&lt;/p&gt;

&lt;p&gt;Dark Mode Output: Keeps your eyes comfortable while browsing complex JSON data.&lt;/p&gt;

&lt;p&gt;Keyboard Friendly: Supports Enter to fetch — no need to click the button every time.&lt;/p&gt;

&lt;p&gt;No Setup Needed: It's hosted on GitHub Pages, meaning it's always online and ready to use.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧪 How to Use It&lt;/strong&gt;&lt;br&gt;
Visit &lt;a href="https://nurulislamrimon.github.io/jin/" rel="noopener noreferrer"&gt;https://nurulislamrimon.github.io/jin/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste any API endpoint URL into the input box&lt;br&gt;
Example: &lt;a href="https://jsonplaceholder.typicode.com/users" rel="noopener noreferrer"&gt;https://jsonplaceholder.typicode.com/users&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press Enter or click Fetch&lt;/p&gt;

&lt;p&gt;Instantly see the JSON response formatted in a beautiful and readable way&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🌍 Share-Ready &amp;amp; Discoverable&lt;/strong&gt;&lt;br&gt;
Jin is SEO-optimized and comes with social meta tags. So when you share it on social media, you’ll see a clean preview and description — perfect for sharing tools within dev teams or communities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🧰 Perfect For:&lt;/strong&gt;&lt;br&gt;
Developers quickly testing endpoints&lt;/p&gt;

&lt;p&gt;Students learning how APIs work&lt;/p&gt;

&lt;p&gt;QA testers validating JSON structures&lt;/p&gt;

&lt;p&gt;Anyone who wants a fast and clean way to preview JSON&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try It Now&lt;/strong&gt;&lt;br&gt;
👉 &lt;a href="https://nurulislamrimon.github.io/jin/" rel="noopener noreferrer"&gt;Launch Jin&lt;/a&gt;&lt;br&gt;
No login. No setup. Just paste, fetch, and read.&lt;/p&gt;

&lt;p&gt;Thanks&lt;br&gt;
N I Rimon&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>json</category>
      <category>api</category>
      <category>restapi</category>
    </item>
    <item>
      <title>Steps to Use Subdomains on localhost Manually</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Sat, 03 May 2025 12:25:35 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/steps-to-use-subdomains-on-localhost-manually-2ee1</link>
      <guid>https://forem.com/nurulislamrimon/steps-to-use-subdomains-on-localhost-manually-2ee1</guid>
      <description>&lt;p&gt;&lt;strong&gt;1. Edit the hosts file&lt;/strong&gt;&lt;br&gt;
Tell your computer that certain domain names point to your own machine.&lt;/p&gt;

&lt;p&gt;Open your hosts file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows: C:\Windows\System32\drivers\etc\hosts&lt;/li&gt;
&lt;li&gt;macOS/Linux: /etc/hosts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Add this at the bottom:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;127.0.0.1 myapp.localhost
127.0.0.1 api.myapp.localhost
127.0.0.1 admin.myapp.localhost
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Save the file. (You might need admin rights.)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Start Your Local Server&lt;/strong&gt;&lt;br&gt;
Make sure your local server (Node.js, PHP, etc.) is running and listening on localhost.&lt;/p&gt;

&lt;p&gt;If you're using Express, you can detect subdomains like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.use((req, res, next) =&amp;gt; {
  console.log(req.subdomains); // ['api'] from api.myapp.localhost
  next();
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Open in Browser&lt;/strong&gt;&lt;br&gt;
Now you can visit:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://myapp.localhost" rel="noopener noreferrer"&gt;http://myapp.localhost&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://api.myapp.localhost" rel="noopener noreferrer"&gt;http://api.myapp.localhost&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://admin.myapp.localhost" rel="noopener noreferrer"&gt;http://admin.myapp.localhost&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each one still points to your local machine.&lt;/p&gt;

&lt;p&gt;If you don't want to config manually &lt;a href="https://medium.com/@nurulislamrimon/what-is-lvh-me-the-dev-friendly-domain-you-didnt-know-you-needed-3eb8c4fe57e3" rel="noopener noreferrer"&gt;read this&lt;/a&gt;. lvh.me could help you to use subdomain in localhost.&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Resolving CORS Errors in a NestJS App Deployed on Vercel</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Wed, 23 Apr 2025 06:23:10 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/resolving-cors-errors-in-a-nestjs-app-deployed-on-vercel-jb</link>
      <guid>https://forem.com/nurulislamrimon/resolving-cors-errors-in-a-nestjs-app-deployed-on-vercel-jb</guid>
      <description>&lt;p&gt;When deploying a NestJS application on Vercel, you may encounter CORS (Cross-Origin Resource Sharing) issues, particularly when your API is accessed from different domains. To resolve these issues and allow your application to accept cross-origin requests, you can configure the necessary CORS headers in your Vercel deployment settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why CORS is Important
&lt;/h2&gt;

&lt;p&gt;CORS is a security mechanism that allows servers to control which domains are permitted to access their resources. This is important to prevent malicious websites from interacting with your server on behalf of the user without their consent. When you deploy a NestJS application and try to access its API from another domain, the browser sends a preflight request to check if the server allows it. If the server doesn't respond with the correct headers, you’ll encounter CORS errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;In Vercel, you can manage CORS headers using a combination of rewrites and headers in your vercel.json configuration file. This configuration will allow your API to accept requests from any domain, which is particularly useful during development or when you want to expose your API to the public.&lt;/p&gt;

&lt;p&gt;Here’s a step-by-step guide on how to configure CORS headers in your Vercel deployment:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Update Your vercel.json Configuration
&lt;/h2&gt;

&lt;p&gt;You can set up rewrites and headers in the vercel.json file. This will ensure that all incoming requests to your Vercel server will correctly include the necessary CORS headers.&lt;/p&gt;

&lt;p&gt;Here’s an example configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "rewrites": [
    {
      "source": "/(.*)",
      "destination": "/api"
    }
  ],
  "headers": [
    {
      "source": "/(.*)",
      "headers": [
        { "key": "Access-Control-Allow-Credentials", "value": "true" },
        { "key": "Access-Control-Allow-Origin", "value": "*" },
        {
          "key": "Access-Control-Allow-Methods",
          "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT"
        },
        {
          "key": "Access-Control-Allow-Headers",
          "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"
        }
      ]
    }
  ]
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Explanation of the Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Rewrites:&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This part of the configuration ensures that all incoming requests to any path (/(.*)) are rewritten to the /api route. You can adjust the destination based on your application structure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Headers:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The headers section defines the CORS headers that will be sent with every request:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access-Control-Allow-Credentials: Allows cookies and credentials to be included in the request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access-Control-Allow-Origin: Specifies which origins are allowed to access the resources. Setting it to * allows requests from any domain. Be cautious with this in production environments, as it might open up your API to abuse.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access-Control-Allow-Methods: Specifies which HTTP methods are allowed when making requests. In this case, it allows all common HTTP methods.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access-Control-Allow-Headers: Specifies which headers can be used in the actual request.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  2. Deploy Your Changes to Vercel
&lt;/h2&gt;

&lt;p&gt;Once you've updated the vercel.json file, deploy your changes to Vercel. This will automatically apply the CORS configuration, allowing your application to accept cross-origin requests from any domain.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
N I Rimon&lt;/p&gt;

</description>
      <category>nestjs</category>
      <category>vercel</category>
      <category>serverless</category>
      <category>programming</category>
    </item>
    <item>
      <title>🌙 Daily MySQL Backup (Windows)</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Mon, 21 Apr 2025 14:37:40 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/daily-mysql-backup-windows-ml5</link>
      <guid>https://forem.com/nurulislamrimon/daily-mysql-backup-windows-ml5</guid>
      <description>&lt;h2&gt;
  
  
  🧾 What It Does
&lt;/h2&gt;

&lt;p&gt;📦 Exports your MySQL database to a .sql file&lt;br&gt;
🕒 Runs automatically every day&lt;br&gt;
🧹 Deletes old backups after 7 days (optional)&lt;/p&gt;
&lt;h2&gt;
  
  
  📁 Folder Setup
&lt;/h2&gt;

&lt;p&gt;Create this folder on your PC:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D:\datas\Automatic_Backup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🧑‍💻 Backup Script
&lt;/h2&gt;

&lt;p&gt;Create a file named:&lt;br&gt;
D:\datas\Automatic_Backup\auto_mysql_backup.bat&lt;/p&gt;

&lt;p&gt;Paste this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@echo off
set TIMESTAMP=%DATE:~10,4%-%DATE:~4,2%-%DATE:~7,2%_%TIME:~0,2%-%TIME:~3,2%
set TIMESTAMP=%TIMESTAMP: =0%

set BACKUP_DIR=D:\datas\Automatic_Backup
set DB_HOST=82.197.71.175
set DB_USER=ni
set DB_PASS=your_password_here
set DB_NAME=bdcommerce_37295

mkdir "%BACKUP_DIR%" 2&amp;gt;nul
mysqldump -h %DB_HOST% -u %DB_USER% -p%DB_PASS% %DB_NAME% &amp;gt; "%BACKUP_DIR%\%DB_NAME%_%TIMESTAMP%.sql"

forfiles /p "%BACKUP_DIR%" /m *.sql /d -7 /c "cmd /c del @path"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Replace your_password_here with your actual password.&lt;/p&gt;

&lt;h2&gt;
  
  
  🕒 Automate It
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Open Task Scheduler&lt;/li&gt;
&lt;li&gt;Click Create Basic Task&lt;/li&gt;
&lt;li&gt;Trigger: Daily&lt;/li&gt;
&lt;li&gt;Action: Start a Program → Select your .bat file&lt;/li&gt;
&lt;li&gt;Done 🎉&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;✅ Example Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bdcommerce_37295_2025-04-21_03-00.sql
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Regards,&lt;br&gt;
N I Rimon&lt;/p&gt;

</description>
      <category>database</category>
      <category>programming</category>
      <category>backup</category>
      <category>devops</category>
    </item>
    <item>
      <title>How to Deploy a NestJS App on Vercel – The Simple Guide (Deploy API on Vercel)</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Mon, 21 Apr 2025 10:17:05 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/how-to-deploy-a-nestjs-app-on-vercel-the-simple-guide-gfn</link>
      <guid>https://forem.com/nurulislamrimon/how-to-deploy-a-nestjs-app-on-vercel-the-simple-guide-gfn</guid>
      <description>&lt;p&gt;Want to deploy your NestJS backend on Vercel? Great choice! Vercel is super fast and easy to use, and it supports serverless apps out of the box. Here’s a step-by-step guide to help you get your NestJS app live in minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You’ll Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Node.js installed&lt;/li&gt;
&lt;li&gt;A NestJS project (nest new my-app)&lt;/li&gt;
&lt;li&gt;A GitHub account&lt;/li&gt;
&lt;li&gt;A Vercel account&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: Create Your NestJS App
&lt;/h2&gt;

&lt;p&gt;If you haven’t created your app yet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -g @nestjs/cli
nest new my-app
cd my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Add vercel.json File
&lt;/h2&gt;

&lt;p&gt;In the root of your project, create a file called vercel.json.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "version": 2,
  "builds": [
    {
      "src": "src/main.ts",
      "use": "@vercel/node"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "src/main.ts",
      "methods": ["GET", "POST", "PUT", "PATCH", "DELETE"]
    }
  ]
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells Vercel how to build and route your app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Deploy to Vercel
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Option A: With Vercel CLI&lt;/strong&gt;&lt;br&gt;
Install Vercel CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -g vercel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

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

&lt;/div&gt;



&lt;p&gt;Follow the prompts — done!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option B: Through GitHub&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Push your code to GitHub.&lt;/li&gt;
&lt;li&gt;Go to vercel.com, click “New Project”.&lt;/li&gt;
&lt;li&gt;Import your repo, and Vercel handles the rest.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That’s It!&lt;br&gt;
Your NestJS app is now deployed on a URL like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://your-project-name.vercel.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use .env for secrets → add them in Vercel's settings.&lt;/li&gt;
&lt;li&gt;Keep api/index.ts minimal — it’s your serverless function.&lt;/li&gt;
&lt;li&gt;Use vercel dev to test locally like production.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regards,&lt;br&gt;
N I Rimon&lt;/p&gt;

</description>
      <category>vercel</category>
      <category>nestjs</category>
      <category>serverless</category>
      <category>api</category>
    </item>
    <item>
      <title>Are SQL Joins Expensive?</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Thu, 17 Apr 2025 11:10:27 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/are-sql-joins-expensive-1ejb</link>
      <guid>https://forem.com/nurulislamrimon/are-sql-joins-expensive-1ejb</guid>
      <description>&lt;p&gt;If you’re building a web app or working with a database, you’ve probably used joins — they help you combine data from multiple tables.&lt;br&gt;
But you might wonder:&lt;br&gt;
"Are joins slow or expensive?"&lt;/p&gt;

&lt;p&gt;Let’s break it down in a simple way.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is a Join?
&lt;/h2&gt;

&lt;p&gt;A join is a way to get related data from two or more tables.&lt;br&gt;
Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT users.name, orders.total
FROM users
JOIN orders ON users.id = orders.user_id;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives you the user’s name along with their order total.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Joins Are Fast
&lt;/h2&gt;

&lt;p&gt;Joins work well when:&lt;br&gt;
✅ You use indexes on foreign keys (like user_id)&lt;br&gt;
✅ You limit the number of rows with WHERE or LIMIT&lt;br&gt;
✅ You select only the fields you need&lt;br&gt;
✅ You don’t join too many tables at once&lt;/p&gt;

&lt;p&gt;Modern databases like MySQL or PostgreSQL are built to handle joins efficiently.&lt;/p&gt;

&lt;h2&gt;
  
  
  When Joins Can Be Slow
&lt;/h2&gt;

&lt;p&gt;Joins get slow when:&lt;br&gt;
❌ You don’t use indexes&lt;br&gt;
❌ You join huge tables without filters&lt;br&gt;
❌ You use too many nested joins&lt;br&gt;
❌ You join unnecessary data (e.g., SELECT * everywhere)&lt;/p&gt;

&lt;p&gt;Also, repeating joins in loops (N+1 problem) can make things worse, especially with ORMs.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 How to Keep Joins Fast
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Always index your join fields&lt;/li&gt;
&lt;li&gt;Use SELECT column_name, not SELECT *&lt;/li&gt;
&lt;li&gt;Filter your queries with WHERE&lt;/li&gt;
&lt;li&gt;Don’t fetch unnecessary related data&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you’re using an ORM like Prisma, it does joins smartly under the hood. Just don’t over-fetch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Are joins expensive?
&lt;/h2&gt;

&lt;p&gt;🤞 Not really — if used the right way.&lt;/p&gt;

&lt;p&gt;They’re safe, powerful, and essential for working with relational data.&lt;/p&gt;

&lt;p&gt;Just follow a few best practices, and you’ll be fine!&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
N I Rimon&lt;/p&gt;

</description>
      <category>sql</category>
      <category>mysql</category>
      <category>database</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Avoid Repeating Types and Arrays in TypeScript</title>
      <dc:creator>Nurul Islam Rimon</dc:creator>
      <pubDate>Wed, 16 Apr 2025 13:42:00 +0000</pubDate>
      <link>https://forem.com/nurulislamrimon/how-to-avoid-repeating-types-and-arrays-in-typescript-21km</link>
      <guid>https://forem.com/nurulislamrimon/how-to-avoid-repeating-types-and-arrays-in-typescript-21km</guid>
      <description>&lt;p&gt;When working with TypeScript, you might define both a list of values and a type like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type Fruit = 'apple' | 'banana' | 'orange';

const fruits = ['apple', 'banana', 'orange'];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But writing the same values twice is:&lt;/p&gt;

&lt;p&gt;❌ Not clean&lt;/p&gt;

&lt;p&gt;❌ Hard to update&lt;/p&gt;

&lt;p&gt;❌ Easy to make mistakes&lt;/p&gt;

&lt;p&gt;Let’s learn a better way!&lt;/p&gt;

&lt;h2&gt;
  
  
  One Simple Trick: Write Once, Use Everywhere
&lt;/h2&gt;

&lt;p&gt;You can define your list once, and TypeScript can turn it into a type automatically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fruits = ['apple', 'banana', 'orange'] as const;

type Fruit = (typeof fruits)[number];
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now:&lt;/p&gt;

&lt;p&gt;✅ fruits is a normal array you can use in your app&lt;/p&gt;

&lt;p&gt;✅ Fruit is a type that only allows 'apple' | 'banana' | 'orange'&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits&lt;/strong&gt;&lt;br&gt;
✅ Autocomplete works in your editor&lt;/p&gt;

&lt;p&gt;✅ You only update one place&lt;/p&gt;

&lt;p&gt;✅ Code is cleaner and safer&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Tip&lt;/strong&gt;&lt;br&gt;
Use as &lt;em&gt;&lt;strong&gt;const&lt;/strong&gt;&lt;/em&gt; to make TypeScript treat the array as readonly, so it can safely create the union type.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br&gt;
N I Rimon&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>programming</category>
      <category>productivity</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
