Skip to main content

Installation

This guide will walk you through installing Bejibun and creating your first application. Before you begin, ensure your system meets the minimum requirements.

Requirements

Bejibun is built specifically for Bun and requires a modern development environment.

Runtime Requirements

SoftwareVersion
BunLatest Stable
TypeScriptIncluded
Node.jsNot Required
GitRecommended
To verify your Bun installation:
bun --version
Example output:
1.x.x
If Bun is not installed, follow the instructions below.

Installing Bun

Bejibun relies on Bun as its runtime, package manager, and development toolchain.

Linux & macOS

Install Bun using the official installation script:
curl -fsSL https://bun.sh/install | bash
After installation, restart your terminal and verify:
bun --version

Windows

Install Bun using PowerShell:
powershell -c "irm bun.sh/install.ps1 | iex"
Verify the installation:
bun --version

Updating Bun

To update Bun to the latest version:
bun upgrade
Keeping Bun updated ensures you receive performance improvements, bug fixes, and security updates.

Creating a New Application

The fastest way to start a new project is with the Bejibun CLI. Run:
bunx @bejibun/cli create my-app
Or:
bunx @bejibun/cli my-app
The CLI will generate a new project structure and install the required dependencies. Example:
Creating project...

 Generating application files
 Installing dependencies
 Creating environment configuration
 Preparing project structure

Application created successfully.

Navigate to the Project

Move into your newly created application:
cd my-app
Your project directory should look similar to:
my-app/
├── app/
├── config/
├── database/
├── public/
├── routes/
├── storage/
├── tests/
├── .env
├── bunfig.toml
└── package.json
The exact structure may vary depending on the framework version and installed packages.

Environment Configuration

Most applications require environment-specific configuration. Bejibun stores environment variables inside the .env file. Example:
APP_NAME=Bejibun
APP_ENV=development
APP_URL=http://localhost:3000

PORT=3000
You can customize these values as needed. For larger applications, environment variables are commonly used to configure:
  • Databases
  • Cache systems
  • Storage providers
  • Authentication services
  • External APIs

Starting the Development Server

Once the project is created, start the development server:
bun dev
Example output:
Bejibun v1.x.x

Server started successfully.

Local: http://localhost:3000
Open your browser and visit:
http://localhost:3000
You should see your application running.

Development Workflow

During development, Bejibun automatically reloads when source files change.
bun dev
This allows you to edit code and see changes immediately without manually restarting the server. Typical workflow:
Edit File

Save

Framework Reloads

Refresh Browser

Verifying the Installation

To confirm that everything is working correctly: Create a simple route.
Router.get("/", async () => {
  return {
    framework: "Bejibun",
    status: "running"
  };
});
Visit:
http://localhost:3000
Expected response:
{
  "framework": "Bejibun",
  "status": "running"
}
If you see this response, your installation is working correctly.

Using the CLI

The Bejibun CLI provides generators and development utilities. Display available commands:
bun ace list
Example:
make:controller
make:model
make:migration
make:seeder
make:validator
route:list
migrate:latest
migrate:rollback
These commands help automate common development tasks.

Creating Your First Controller

Generate a controller:
bun ace make:controller HomeController
Generated file:
app/Controllers/HomeController.ts
Example:
export default class HomeController {
  async index() {
    return {
      message: "Welcome to Bejibun"
    };
  }
}
Register the route:
Router.get("/", "HomeController@index");
Visit your application to see the response.

Creating Your First Model

Generate a model:
bun ace make:model User
Generated file:
app/Models/User.ts
Example:
export default class User extends BaseModel {}
Models provide a convenient way to interact with database records.

Running Database Migrations

If your application uses a database, run migrations after configuration. Generate a migration:
bun ace make:migration create_users_table
Execute migrations:
bun ace migrate:latest
Successful output:
 Migration completed
Your database schema is now up to date.

Production Installation

For production deployments: Install dependencies:
bun install --production
Build the application if required:
bun run build
Start the server:
bun start
Production environments should also configure:
  • Reverse proxies
  • HTTPS
  • Environment variables
  • Monitoring
  • Logging
Deployment topics are covered in a later section of the documentation.

Troubleshooting

Bun Command Not Found

If you receive:
bun: command not found
Ensure Bun is installed correctly and available in your system PATH. Verify:
bun --version

Port Already in Use

If the configured port is unavailable:
EADDRINUSE
Change the port in your environment configuration:
PORT=4000
Restart the development server afterward.

Dependency Installation Fails

Clear the dependency cache and reinstall:
rm -rf node_modules
rm bun.lock

bun install
Then start the application again.

Next Steps

Congratulations! Your Bejibun environment is now ready. Continue with:
  • Creating Your First Application
  • Project Structure
  • Configuration
  • Environment Variables
  • Request Lifecycle
In the next guide, you’ll build a complete application and learn how the framework components work together.