<?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: four clover</title>
    <description>The latest articles on DEV Community by four clover (@fourcloverleaf).</description>
    <link>https://dev.to/fourcloverleaf</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%2F3551719%2F75cbd0b5-bb12-4140-b6b0-01f773444837.webp</url>
      <title>DEV Community: four clover</title>
      <link>https://dev.to/fourcloverleaf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fourcloverleaf"/>
    <language>en</language>
    <item>
      <title>How to Deploy a Discord Bot on Vercel 🚀</title>
      <dc:creator>four clover</dc:creator>
      <pubDate>Tue, 07 Oct 2025 19:10:59 +0000</pubDate>
      <link>https://dev.to/fourcloverleaf/how-to-deploy-a-discord-bot-on-vercel-110c</link>
      <guid>https://dev.to/fourcloverleaf/how-to-deploy-a-discord-bot-on-vercel-110c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Woohoo! My First Ever Article! ✌️&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Stuck at any step? Join us on Discord.&lt;br&gt;&lt;br&gt;
Got an error? Join us on Discord.&lt;br&gt;&lt;br&gt;
Found a bug? Join us on Discord.  &lt;/p&gt;

&lt;p&gt;You get the point! If you need help with &lt;a href="https://github.com/discordhttps/discord.https" rel="noopener noreferrer"&gt;discord.https&lt;/a&gt;, join our Discord community: &lt;a href="https://discord.gg/pSgfJ4K5ej" rel="noopener noreferrer"&gt;https://discord.gg/pSgfJ4K5ej&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a Discord Application
&lt;/h2&gt;

&lt;p&gt;First, we need to create a Discord Application and obtain its credentials.&lt;/p&gt;

&lt;p&gt;Open the &lt;a href="https://discord.com/developers/applications" rel="noopener noreferrer"&gt;Discord Developer Portal&lt;/a&gt;. Ensure you have a Discord account and are signed in.&lt;/p&gt;

&lt;p&gt;In the top-right corner, click &lt;strong&gt;New Application&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Enter a name for your application and, if you want, review the terms.&lt;/p&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%2F8vlm2eh8hj21jf2ozcjv.png" 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%2F8vlm2eh8hj21jf2ozcjv.png" alt="Image" width="467" height="271"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s personalize it.&lt;/p&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%2F0z5ozntv947e3scpaic1.png" 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%2F0z5ozntv947e3scpaic1.png" alt="Image" width="800" height="306"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, invite the bot to a server. I recommend using a test server you own.&lt;/p&gt;

&lt;p&gt;Go to the &lt;strong&gt;Installation&lt;/strong&gt; tab and copy the invite URL:&lt;/p&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%2F3l6mdtrv04wzusk2xoz9.png" 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%2F3l6mdtrv04wzusk2xoz9.png" alt="Image" width="800" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste the invite link into your browser and add the bot to your chosen server.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating a New Project
&lt;/h2&gt;

&lt;p&gt;To simplify bot creation, we’ll use a CLI tool called &lt;code&gt;create-discord-https&lt;/code&gt;. Fun fact: Its code was &lt;del&gt;stolen&lt;/del&gt; &lt;em&gt;inspired&lt;/em&gt; from &lt;code&gt;create-vite&lt;/code&gt; ✨.&lt;/p&gt;
&lt;h3&gt;
  
  
  What is discord.https ?
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/discordhttps/discord.https" rel="noopener noreferrer"&gt;discord.https&lt;/a&gt; is a robust, modular library for handling Discord HTTP interactions, built with a router architecture similar to the popular Express library.&lt;/p&gt;

&lt;p&gt;Now, let’s get started. Run the CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-discord-https@latest
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Follow the prompts to set up your project.&lt;/p&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%2Fnnbzpuraurd6lu36zuux.png" 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%2Fnnbzpuraurd6lu36zuux.png" alt="Image" width="800" height="302"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Structure
&lt;/h3&gt;

&lt;p&gt;If you are wondering, don’t wonder! Assuming your CLI ran smoothly, you should see something like this:&lt;/p&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%2Fg3ftdbpu8uzegea0p4c0.png" 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%2Fg3ftdbpu8uzegea0p4c0.png" alt="Image" width="274" height="516"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, don't wonder, Let me explain a &lt;del&gt;each&lt;/del&gt; few files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;index.js&lt;/code&gt;&lt;/strong&gt;: Name speaks itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;api/interactions.js&lt;/code&gt;&lt;/strong&gt;: Read the doc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;DevLayer.js&lt;/code&gt;&lt;/strong&gt;: Simplifies development by managing a local tunnel (details in the file for beginners) and automatically registering commands when they change. &lt;strong&gt;Do not delete&lt;/strong&gt; the generated &lt;code&gt;__dev_layer_cache__&lt;/code&gt; file, it’s used to detect command changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;spawner.js&lt;/code&gt;&lt;/strong&gt;: Runs &lt;code&gt;vercel dev&lt;/code&gt; and opens a local tunnel for you. Why not put this in &lt;code&gt;index.js&lt;/code&gt;? Because in a serverless environment, state is lost between HTTP requests, so this ensures the tunnel stays nicely.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Registering Commands
&lt;/h2&gt;

&lt;p&gt;Run the development server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you see this:&lt;/p&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%2Fdqyo2i1x9k024scwbqb1.png" 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%2Fdqyo2i1x9k024scwbqb1.png" alt="Image" width="415" height="41"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Either copy the link into your browser or Ctrl+click it. The system will detect command changes and register them automatically, super handy for development!&lt;/p&gt;

&lt;p&gt;Once done, press &lt;strong&gt;Ctrl+C&lt;/strong&gt; to stop the Vercel server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying to Vercel
&lt;/h2&gt;

&lt;p&gt;&lt;del&gt;Time to install the Vercel CLI&lt;/del&gt; Oh, nevermind it’s already installed from the previous &lt;code&gt;npm i&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Deploy your project with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx vercel &lt;span class="nt"&gt;--prod&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you’re not logged in, log in to Vercel, then press &lt;strong&gt;Enter&lt;/strong&gt; to accept the default options, they’re sufficient.&lt;/p&gt;

&lt;p&gt;Visit &lt;a href="https://vercel.com" rel="noopener noreferrer"&gt;vercel.com&lt;/a&gt;, find your project in the dashboard (it’ll appear if the deploy command succeeded), and note the deployment URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interaction Endpoint Configuration
&lt;/h2&gt;

&lt;p&gt;Locate your Vercel deployment URL (e.g., &lt;code&gt;https://cool-bot.vercel.app&lt;/code&gt;) in the Vercel dashboard. Append &lt;code&gt;/interactions&lt;/code&gt; to it (e.g., &lt;code&gt;https://cool-bot.vercel.app/interactions&lt;/code&gt;) and visit the URL in your browser. If everything is set up correctly, you’ll see:&lt;/p&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%2Fq7qxbgdvm9mmmxc62lvi.png" 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%2Fq7qxbgdvm9mmmxc62lvi.png" alt="Image" width="587" height="209"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;haha.. very funny... :/&lt;/p&gt;

&lt;p&gt;You should see a message saying &lt;strong&gt;"server is alive!"&lt;/strong&gt;&lt;br&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%2Fow3taovhu2tblnft9jt6.png" 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%2Fow3taovhu2tblnft9jt6.png" alt="Image" width="184" height="37"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, go to the &lt;a href="https://discord.com/developers/applications" rel="noopener noreferrer"&gt;Discord Developer Portal&lt;/a&gt;, select your application, and navigate to the &lt;strong&gt;General Information&lt;/strong&gt; section:&lt;/p&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%2Fz1vorcsr2irync4jxmaw.png" 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%2Fz1vorcsr2irync4jxmaw.png" alt="Image" width="221" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Paste your interaction endpoint URL (e.g., &lt;code&gt;https://cool-bot.vercel.app/interactions&lt;/code&gt;):&lt;/p&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%2F2gl7le1uoxqsn7aw4kt9.png" 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%2F2gl7le1uoxqsn7aw4kt9.png" alt="Image" width="800" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Save Changes&lt;/strong&gt;. If successful, you’ll see:&lt;/p&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%2Fmwb9j79t57279pyq9qjr.png" 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%2Fmwb9j79t57279pyq9qjr.png" alt="Image" width="800" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If not, retrace your steps, buddy!&lt;/p&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%2F9boxo3089i5kmg1sng2j.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%2F9boxo3089i5kmg1sng2j.gif" alt="Image" width="362" height="498"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Final Steps
&lt;/h2&gt;

&lt;p&gt;Head to the server where you invited the bot. Type &lt;code&gt;/&lt;/code&gt; in a channel, and you should see:&lt;/p&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%2F7gab18gjk9ull72v4my0.png" 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%2F7gab18gjk9ull72v4my0.png" alt="Image" width="671" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Try the &lt;code&gt;/jokes&lt;/code&gt; command:&lt;/p&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%2Ftr3inbk4bdfh1djnrrh6.png" 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%2Ftr3inbk4bdfh1djnrrh6.png" alt="Image" width="695" height="401"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You’ve got jokes, with a sprinkle of &lt;a href="https://github.com/discordhttps/discord.https" rel="noopener noreferrer"&gt;discord.https&lt;/a&gt; branding—because why not? 😅 (Feel free to tweak the commands to make them your own!)&lt;/p&gt;

&lt;p&gt;Don't forget to star &lt;a href="https://github.com/discordhttps/discord.https" rel="noopener noreferrer"&gt;discord.https&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus Notes
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/discordhttps/discord.https" rel="noopener noreferrer"&gt;discord.https&lt;/a&gt; supports features like &lt;code&gt;editReply&lt;/code&gt;, &lt;code&gt;followUp&lt;/code&gt;, and more. In a serverless environment like Vercel, use &lt;a href="https://vercel.com/changelog/waituntil-is-now-available-for-vercel-functions" rel="noopener noreferrer"&gt;&lt;code&gt;waitUntil&lt;/code&gt;&lt;/a&gt; to handle these functions. Methods like &lt;code&gt;.reply()&lt;/code&gt; or, &lt;code&gt;deferReply()&lt;/code&gt; will close the connection, so you need to use &lt;code&gt;waitUntil&lt;/code&gt; for any follow-up actions.&lt;/p&gt;

</description>
      <category>vercel</category>
      <category>tutorial</category>
      <category>discord</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
