Skip to content

dark1zinn/bun-ffi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 Bun FFI Example

A sample project demonstrating integration between Rust and JavaScript using FFI (Foreign Function Interface) with the Bun runtime.

  • 🇧🇷 Procurando algo em Português? Veja este README.

📋 Description

This project shows how to:

  • 🦀 Use Rust code in JavaScript
  • ⚡ Leverage Bun's power for FFI
  • 🔧 Compile native libraries
  • 🧪 Test the integration

🛠️ Prerequisites

  • Bun installed
  • Rust installed
  • Cargo (comes with Rust)

📥 Installation

bun install

🎯 Available Scripts

Command Description
bun dev 🔄 Updates dependencies and runs tests
bun build-rs 🦀 Compiles Rust code
bun up 🏗️ Executes complete build (Rust + JS)

🚀 How to Use

  1. Clone the repository
  2. Install dependencies:
bun install
  1. Run complete build:
bun up
  1. For development:
bun dev

🏗️ Project Structure

📦 bun-ffi
 ┣ 📂 rust          # Rust code
 ┣ 📂 src           # TypeScript code
 ┣ 📂 dist          # Compiled files
 ┗ 📜 bun_build.js  # Build script

🤝 Contributing

Feel free to open issues and pull requests!

📝 License

MIT


⭐ If this project was helpful to you, consider giving it a star!

About

A simple template to develop Rust code usable on Typescript via Bun's FFI

Resources

License

Stars

Watchers

Forks