cd..blog

AdonisJS, Bun & Bun Cloud: A Modern CI/CD DevOps Stack

const published = "Mar 3, 2026, 10:36 PM";const readTime = 4 min;
adonisjsbunbuncloudci-cddevops
Explore integrating AdonisJS, Bun, and Bun Cloud with CI/CD for a high-performance, automated web application. Learn practical steps for a robust developer experience.

AdonisJS, Bun & Bun Cloud: A Modern CI/CD DevOps Stack

Building robust, high-performance web applications requires a thoughtful combination of frameworks, runtimes, and deployment strategies. This post demonstrates how to integrate AdonisJS, Bun, and Bun Cloud with a solid CI/CD pipeline, offering a powerful and efficient development and deployment workflow.

AdonisJS: The Robust Backend Framework

AdonisJS is a full-stack TypeScript-first web framework that emphasizes developer experience, convention over configuration, and a rich ecosystem. It provides a structured approach to building scalable APIs and web applications.

First, let's scaffold a new AdonisJS project using Bun as our package manager:

bun create adonisjs/core-app@latest bun-cloud-app
cd bun-cloud-app
bun install

Create a simple controller and route to expose an endpoint. For instance, app/Controllers/Http/HomeController.ts:

// app/Controllers/Http/HomeController.ts
import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'

export default class HomeController {
  public async index({ response }: HttpContextContract) {
    return response.json({ message: 'Hello from AdonisJS on Bun Cloud!' })
  }
}

And register the route in start/routes.ts:

// start/routes.ts
import Route from '@ioc:Adonis/Core/Route'

Route.get('/', 'HomeController.index')

Bun: The All-in-One JavaScript Runtime & Toolkit

Bun is an incredibly fast JavaScript runtime, package manager, bundler, and test runner, all in one. Its native performance significantly accelerates development cycles and improves application startup times.

We'll use Bun to manage dependencies and run our AdonisJS application. To start the development server:

bun dev

For production, Bun can build your AdonisJS application into a single executable or highly optimized files. AdonisJS ships with a build command that Bun can execute:

bun run build

This command compiles your TypeScript code and prepares it for production, leveraging Bun's speed for the build process.

Bun Cloud: Effortless Serverless Deployment

Bun Cloud is a simplified, high-performance serverless platform designed specifically for Bun applications. It offers automatic scaling, global distribution, and zero-downtime deployments, making it ideal for modern web services.

To deploy your AdonisJS application to Bun Cloud, you'll first need to ensure you have the Bun CLI installed and are logged in. Create a bunfig.toml file at the root of your project to configure the deployment:

# bunfig.toml
[deploy]
entrypoint = "build/server.js"

This tells Bun Cloud to use the compiled server.js file generated by AdonisJS's build process. Now, deploy it:

bun deploy

Bun Cloud automatically detects your bun.lockb file and installs dependencies, then deploys your application. You'll get a URL to access your live service.

CI/CD & DevOps: Automating the Workflow

Integrating CI/CD ensures that every code change is automatically built, tested, and potentially deployed, leading to faster, more reliable releases. We'll use GitHub Actions for this.

Create a .github/workflows/deploy.yml file:

# .github/workflows/deploy.yml
name: Deploy to Bun Cloud

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: oven-sh/setup-bun@v1
        with:
          bun-version: latest
      - name: Install dependencies
        run: bun install
      - name: Run tests
        run: bun test # Assuming you have tests configured
      - name: Build application
        run: bun run build
      - name: Deploy to Bun Cloud
        env:
          BUN_CLOUD_TOKEN: ${{ secrets.BUN_CLOUD_TOKEN }}
        run: bun deploy

This workflow checks out your code, sets up Bun, installs dependencies, runs tests, builds the AdonisJS application, and finally deploys it to Bun Cloud using a BUN_CLOUD_TOKEN stored as a GitHub Secret. This token can be generated from your Bun Cloud account settings.

Conclusion

By combining AdonisJS for a structured, TypeScript-first backend, Bun for lightning-fast development and production, and Bun Cloud for effortless serverless deployment, you create a modern, high-performance web application stack. The addition of CI/CD with GitHub Actions automates your workflow, ensuring consistency, reliability, and speed from development to production. This integrated approach empowers developers to focus on innovation rather than infrastructure complexities.