---
# System prepended metadata

title: Browser

---

# Browser

Developing for the browser with Tauri.

## Glue library

Develop a glue library for your project. Basically, instead of directly calling the Tauri API's, you develop your project 100% browser compatible, only using functions from your glue library. Then it's up to the glue library to support conditional compilation that you can easily switch between Tauri and Browser mode.

The way I do that for Nuxt is developing a Nuxt module that i then pass a variable to based on whether or not some Tauri environment variables are available.

## WASM

Tauri can't be compiled itself into WASM, but your command functions might be possible to compile. What I recommend doing then is using the glue library approach and then loading a WASM library that you compile using `wasm-pack` where that library has your Tauri project (or a core library) as a dependency, pulling in functions from it, and compiling them in a WASM compatible manner.

This is the approach I use for my projects, compiling a WASM library that's in the browser version of my Nuxt glue module loads the WASM version of the backend, and in some functions it'll use Javascript functions, in other parts where it's possible it'll use the WASM functions. In a browser context you'll want to stick to Javascript for a lot of the stuff you can make because a lot of the stuff you can make in WASM is quite annoying to deal with, for example using LocalStorage is easier in Javascript than in WASM, and the main reason you might be using SQLite in the Tauri version is probably because it's persistent on the users disk, in the browser context it's just better overall to stick to javascript for such a function, but for things like API requests where I'm using `reqwest` in Tauri anyway I might as well just add that function to a core library so that Tauri and WASM run the exact same function since `reqwest` is actually WASM compatible.
