Skip to content

Commit cf262b8

Browse files
committed
update readme
1 parent 8674184 commit cf262b8

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

README.md

+25-26
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
A high-performance API for building Shopify Functions using WebAssembly (WASM).
44

5-
65
## Architecture
76

87
The WASM API consists of these main components:
98

10-
1. **Core (`core/`)**
11-
- Low-level WASM bindings and memory management
12-
- Handles raw memory operations and string handling
13-
- Provides the foundation for the API layer
14-
- Manages direct WASM imports/exports
9+
1. **Provider (`provider/`)**
10+
- Implements low-level WASM operations for:
11+
- Memory management and allocation
12+
- Input/output serialization
13+
- Context lifecycle management
14+
- Used by the API layer for high-level operations
15+
- Integrates with trampoline for WASM module linking
16+
17+
2. **Core (`core/`)**
18+
- Defines fundamental types and interfaces
19+
- Used by both API and provider layers
1520

16-
2. **API (`api/`)**
17-
- High-level interface for writing Shopify Functions
18-
- Provides the `#[shopify_function]` macro
19-
- Handles input/output operations with a user-friendly API
20-
- Built on top of the core package
21+
3. **API (`api/`)**
22+
- High-level Rust interface for writing Shopify Functions
23+
- Includes examples and documentation
2124

22-
3. **Trampoline (`trampoline/`)**
23-
- Bridges communication between your WASM module and Shopify's runtime
24-
- Handles memory sharing between guest and provider modules
25-
- Manages string operations and object property access
26-
- Creates the necessary WASM imports/exports
25+
4. **Trampoline (`trampoline/`)**
26+
- Bridges communication between WASM modules
2727

2828
## Getting Started
2929

@@ -32,13 +32,6 @@ The WASM API consists of these main components:
3232
- [Rust](https://www.rust-lang.org/tools/install) (latest stable version)
3333
- [wasm-pack](https://rustwasm.github.io/wasm-pack/installer/) for building WebAssembly modules
3434

35-
### Installation
36-
37-
Add the Shopify Function WASM API to your `XYZ`:
38-
39-
```
40-
// todo
41-
```
4235

4336
### Basic Usage
4437

@@ -59,15 +52,21 @@ fn function(context: &mut Context) -> Result<()> {
5952
}
6053
```
6154

62-
The trampoline tool bridges communication between your WASM module and Shopify's runtime. You can trampoline your function by:
55+
To build a function example, create a new example and build it targeting `wasm32-wasi` with `shopify_function_wasm_api` as the provider:
56+
57+
```shell
58+
cargo build --release --target wasm32-wasip1 -p shopify_function_wasm_api --example echo
59+
```
60+
61+
62+
The trampoline tool bridges communication between your WASM module and Shopify's runtime. To trampoline your function wasm:
6363

6464
```shell
6565
# Short flags
6666
cargo run -p shopify_function_wasm_api_trampoline -- -i input.wasm -o output.wasm
6767
```
6868

69-
70-
For more examples, check out the [examples directory](./api/examples/).
69+
For examples, check out the [examples directory](./api/examples/).
7170

7271
## Documentation
7372

0 commit comments

Comments
 (0)