<?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>DEV Community: Vikash Rathee</title>
    <description>The latest articles on DEV Community by Vikash Rathee (@vikashrathee).</description>
    <link>https://dev.to/vikashrathee</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%2F151975%2F7c132fad-2ae2-4008-a364-f1144f580b0d.jpg</url>
      <title>DEV Community: Vikash Rathee</title>
      <link>https://dev.to/vikashrathee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vikashrathee"/>
    <language>en</language>
    <item>
      <title>I built an URL shortener with Cloudflare KV</title>
      <dc:creator>Vikash Rathee</dc:creator>
      <pubDate>Sat, 09 Dec 2023 10:49:55 +0000</pubDate>
      <link>https://dev.to/vikashrathee/i-built-an-url-shortener-with-cloudflare-kv-5b7i</link>
      <guid>https://dev.to/vikashrathee/i-built-an-url-shortener-with-cloudflare-kv-5b7i</guid>
      <description>&lt;p&gt;I am building an open source, highly scalable, and low-cost &lt;a href="https://github.com/dayschedule/idm"&gt;URL shortener with Cloudflare KV&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1y7QmOfz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h311hzymq49wsdho18bt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1y7QmOfz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h311hzymq49wsdho18bt.png" alt="URL shortening software" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By low-cost I mean, just $5 per month on Cloudflare worker and a free plan for basic requirement -&lt;/p&gt;

&lt;h2&gt;
  
  
  Idea
&lt;/h2&gt;

&lt;p&gt;At &lt;a href="https://dayschedule.com/"&gt;DaySchedule&lt;/a&gt;, we had many customer upvoted for a URL shortener feature with auto-expirable links to book an appointment instead sharing their original URL.&lt;/p&gt;

&lt;p&gt;So, I decided to try Cloudflare for this project - &lt;/p&gt;

&lt;p&gt;By leveraging Cloudflare KV's capabilities, the goal was to develop a solution that offered not only &lt;a href="https://idm.in/"&gt;URL shortening&lt;/a&gt; but also customization options, analytics, and scalability, all while maintaining a significantly lower cost compared to our established services on AWS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://developers.cloudflare.com/kv/api/write-key-value-pairs/#expiring-keys"&gt;Expirable links&lt;/a&gt; using &lt;code&gt;cacheTtl&lt;/code&gt; option on KV&lt;/li&gt;
&lt;li&gt;Custom domain using Cloudflare for SaaS&lt;/li&gt;
&lt;li&gt;Analytics using &lt;a href="https://developers.cloudflare.com/analytics/analytics-engine/worker-querying/#querying"&gt;Worker analytics&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  API
&lt;/h2&gt;

&lt;p&gt;I used &lt;a href="https://hono.dev/"&gt;hono.dev&lt;/a&gt; by &lt;a class="mentioned-user" href="https://dev.to/yusukebe"&gt;@yusukebe&lt;/a&gt; for API routing, and it's blazing fast and offers Cloudflare pages template to build Edge projects quickly.&lt;/p&gt;

&lt;p&gt;Here is an example of &lt;code&gt;server.ts&lt;/code&gt; from their docs -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Hono } from 'hono'
const app = new Hono()

app.get('/', (c) =&amp;gt; c.text('Hono!'))

export default app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Controller
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/dayschedule/idm/blob/main/functions/routes/links.ts"&gt;&lt;code&gt;/links&lt;/code&gt; API&lt;/a&gt; is all I need to create, update and manage the short links.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const links = new Hono&amp;lt;{ Bindings: Bindings }&amp;gt;();

links.post(
  '/',
  validator('json', (value, c) =&amp;gt; {
    const parsed = linkSchema.safeParse(value);
    if (!parsed.success) {
      return c.json(parsed, 400);
    }
    return parsed.data as ShortLink;
  }),
  async (ctx) =&amp;gt; {
    const data = ctx.req.valid('json');
    // Set expire_at if given, or fallback to 1 month expiry
    const expireAt = data.expire_at
      ? dayjs(data.expire_at).unix()
      : dayjs().add(1, 'month').unix();
    if (expireAt &amp;lt;= dayjs().unix()) {
      return ctx.json(
        { message: 'The expire_at must be greater then current date time' },
        400
      );
    }

    let key = data.key || nanoid(7);
    let exists = await ctx.env.SHORTLINKS.get(key);
    while (exists) {
      key = nanoid(7);
      exists = await ctx.env.SHORTLINKS.get(key);
    }
    await ctx.env.SHORTLINKS.put(key, JSON.stringify(data), {
      expiration: expireAt,
    });
    return ctx.json(
      { ...data, key: key, short_url: `https://idm.in/${key}` },
      200
    );
  }
);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Code explanations -
&lt;/h3&gt;

&lt;p&gt;This code is &lt;code&gt;POST&lt;/code&gt; request to create short links. Here's a breakdown of the code to explain what all I am doing:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;const links = new Hono&amp;lt;{ Bindings: Bindings }&amp;gt;():&lt;/code&gt; It creates an instance of the Hono object.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Validation with zod - The &lt;code&gt;validator('json', (value, c) =&amp;gt; {...}):&lt;/code&gt; function is used as a middleware for validating the incoming JSON payload defined in &lt;code&gt;linkSchema&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Set expiration: Checks if an expiry date is provided in the payload. If not, it sets an expiry date one month from the current date and time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Generates a unique key for the link using &lt;code&gt;nanoid(7)&lt;/code&gt; or uses the provided key from the payload if available.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Stores the link data (converted to a JSON string) in the Cloudflare KV (&lt;code&gt;SHORTLINKS&lt;/code&gt;) with an expiration time based on the calculated expiry date.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The demo is available on &lt;a href="https://idm.in/"&gt;IDM&lt;/a&gt;, it's free to use and open-sourced on Github to &lt;strong&gt;build your own custom URL shortener&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MULdIwNu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khcz4xrgxyzr19ua8auq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MULdIwNu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khcz4xrgxyzr19ua8auq.gif" alt="Short your links" width="800" height="504"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can clone the repo to deploy on your Cloudflare account.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/dayschedule/idm"&gt;Star the repository&lt;/a&gt; on Github to show your support :-)&lt;/p&gt;

</description>
      <category>urlshortener</category>
      <category>bitly</category>
      <category>shortlink</category>
      <category>cloudflare</category>
    </item>
    <item>
      <title>How to embed appointment scheduling widget on your website?</title>
      <dc:creator>Vikash Rathee</dc:creator>
      <pubDate>Mon, 03 Apr 2023 12:02:57 +0000</pubDate>
      <link>https://dev.to/vikashrathee/how-to-embed-appointment-scheduling-widget-on-your-website-2lhj</link>
      <guid>https://dev.to/vikashrathee/how-to-embed-appointment-scheduling-widget-on-your-website-2lhj</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--A8UwCfO---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/715jjlvttedzj8ezwamn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A8UwCfO---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/715jjlvttedzj8ezwamn.png" alt="Appointment scheduler" width="880" height="431"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Embedding a Dayschedule &lt;a href="https://www.npmjs.com/package/dayschedule-widget"&gt;appointment scheduling widget&lt;/a&gt; on your website is a great way to simplify the appointment scheduling process for your clients. Here are the steps to follow:&lt;/p&gt;

&lt;h2&gt;
  
  
  Choose a appointment scheduling widget
&lt;/h2&gt;

&lt;p&gt;There are many scheduling widgets available online, such as  &lt;a href="https://calendly.com/"&gt;Calendly&lt;/a&gt;, &lt;a href="https://doodle.com/en/"&gt;Doodle&lt;/a&gt;, &lt;a href="https://acuityscheduling.com/"&gt;Acuity Scheduling&lt;/a&gt; and &lt;a href="https://dayschedule.com/"&gt;DaySchedule&lt;/a&gt;. Research different options and choose one that meets your business needs.&lt;/p&gt;

&lt;p&gt;In this post, I am going to show you how to embed the &lt;a href="https://github.com/dayschedule/dayschedule-widget"&gt;dayschedule widget&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Sign up for an account
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Login to &lt;a href="https://app.dayschedule.com/signup"&gt;Dayschedule&lt;/a&gt; (or create a new account, it's free for basic use), &lt;/li&gt;
&lt;li&gt;Create a resource &lt;/li&gt;
&lt;li&gt;Set availability, questions etc.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/z7_IwonRrp0"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Customize your scheduling widget
&lt;/h2&gt;

&lt;p&gt;Customize your scheduling widget to fit the design and branding of your website. You can set color, upload logo etc.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0lL8g9K_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yy96v52sjwad0rp2oakb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0lL8g9K_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yy96v52sjwad0rp2oakb.png" alt="Customize your scheduling widget" width="880" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Generate an embed code
&lt;/h2&gt;

&lt;p&gt;Once your scheduling widget is customized, &lt;a href="https://dayschedule.com/widget"&gt;generate an embed code&lt;/a&gt;. This code is what you will use to add the widget to your website.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2yw9wA-h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vyl1fknuw369qo6p9glj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2yw9wA-h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vyl1fknuw369qo6p9glj.png" alt="Generate an embed code" width="787" height="570"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Add the embed code to your website
&lt;/h2&gt;

&lt;p&gt;Install the package from NPM&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 dayschedule-widget
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the code to open appointment booking popup on click.&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;button type="button" 
    onClick="bookAppointment()"&amp;gt;
    Book an appointment
&amp;lt;/button&amp;gt;

function bookAppointment(){
  daySchedule.initPopupWidget({
    "url": "https://demo.dayschedule.com",
    "type": "popup",
    "color": {
            "primary": "#0f0980",
        "secondary": "#afeefe"
    }
  })
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;See examples - &lt;a href="https://stackblitz.com/@vickyRathee/collections/dayschedule-appointment-bookings"&gt;https://stackblitz.com/@vickyRathee/collections/dayschedule-appointment-bookings&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And paste the embed code into the HTML of your website where you want the scheduling widget to appear. This could be on a contact page, a services page, or a dedicated scheduling page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test your scheduling widget
&lt;/h2&gt;

&lt;p&gt;Once you have added the scheduling widget to your website, test it out to make sure it is functioning properly. Schedule a test appointment to make sure the process works as expected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Promote your scheduling widget
&lt;/h2&gt;

&lt;p&gt;Now that your scheduling widget is embedded on your website, promote it to your clients and customers. Include a link to the scheduling widget in email signatures, social media posts, and other marketing materials.&lt;/p&gt;

</description>
      <category>scheduling</category>
      <category>widget</category>
      <category>calendly</category>
      <category>appointment</category>
    </item>
    <item>
      <title>Introducing Agenty "Agents for Machine Intelligence"</title>
      <dc:creator>Vikash Rathee</dc:creator>
      <pubDate>Tue, 02 Apr 2019 15:33:06 +0000</pubDate>
      <link>https://dev.to/vikashrathee/introducing-agenty-agents-for-machine-intelligence-2hfg</link>
      <guid>https://dev.to/vikashrathee/introducing-agenty-agents-for-machine-intelligence-2hfg</guid>
      <description>

&lt;p&gt;Hi, Dev Community!&lt;/p&gt;

&lt;p&gt;We have been working on &lt;a href="https://www.agenty.com/"&gt;Agenty&lt;/a&gt; from a long time, and today I am so excited to show it to the Dev community.&lt;/p&gt;

&lt;p&gt;We are launching 4 agents today :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scraping agents&lt;/strong&gt; : Point-and-Click web scraping agent to extract data from websites of choices. Convert websites into api in lass then 2 minutes (see my video &lt;a href="https://www.agenty.com/docs/video-tutorials.aspx"&gt;https://www.agenty.com/docs/video-tutorials.aspx&lt;/a&gt; ) or install the extension from Chrome store - &lt;a href="https://chrome.google.com/webstore/detail/agenty-advanced-web-scrap/gpolcofcjjiooogejfbaamdgmgfehgff"&gt;https://chrome.google.com/webstore/detail/agenty-advanced-web-scrap/gpolcofcjjiooogejfbaamdgmgfehgff&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Textract agents&lt;/strong&gt; : Extract text and metadata from almost any documents in batch&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OCR agents&lt;/strong&gt; : Extract text from images and pdfs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bar code recognition agent&lt;/strong&gt; - Recognize the bar code number and it's type from products photo captured by mobile or cameras.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All agents are API ready, see the documentation - &lt;a href="https://www.agenty.com/docs/api"&gt;https://www.agenty.com/docs/api&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to our website and signup to get 100 pages credit free to try any agent you like. And you can go PRO anytime if you like it, the &lt;a href="https://www.agenty.com/pricing/"&gt;pricing plans&lt;/a&gt; just starts from $29 per month (10x lower then import.io for web scraping whose plans starts from $299)&lt;/p&gt;

&lt;p&gt;I’ll keeps checking this page today to answer any comments, feedback you have, really looking forward to it :)&lt;/p&gt;


</description>
      <category>webscraping</category>
      <category>machineintelligence</category>
      <category>ocr</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
