> For the complete documentation index, see [llms.txt](https://subsembly.gitbook.io/subsembly/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://subsembly.gitbook.io/subsembly/getting-started/cli/subsembly-compile.md).

# subsembly compile

Project compilation

### Overview

Compiles current **`Subsembly`** project. More specifically it installs the dependencies and generates the required files for the Runtime to support the `metadata` interface used by PolkadotJS. Lastly, it compiles the **`Subsembly`** Runtime into the hex encoded `wasm` binary file (WASM blob).

### Workflow&#x20;

The workflow of the compile command is following:

1. Make sure the dependencies are installed by checking **`node_modules`** folder.
2. &#x20;Generate metadata of the project&#x20;
   1. Parse system and other modules inside **`assembly/pallets`** directory to extract storage entries, calls and constants.&#x20;
   2. Generate files:&#x20;
      1. **`metadata.ts`**&#x20;

         Contains a function that returns SCALE encoded metadata of the project
      2. **`dispatcher.ts`**

         Contains a function that is used to dispatch extrinsic calls of corresponding modules&#x20;
   3. Build **`wasm`** file:&#x20;

      Compile AS project into **`.wasm`** file, hex encode the binary and save it in build directory.

### Build folder

AssemblyScript places compiled **`wasm`** files inside the build folder in the root directory. The hex encoded **`wasm`** bytecode of **`Subsembly`** runtime is also placed in the same folder.

### Syntax

```
subsembly compile
```

### Examples

```
# creates new compiled wasm of the runtime in /build directory
subsembly compile
```

And the result of this command is reflected in build folder:

![Picture 2. Build folder files](https://3486155078-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MVLPB3fCkGpKnqkQwlo%2F-MW9DHcmYVMfFre4pFkp%2F-MW9RQ7jtlZlpLx6YSuN%2Fimage.png?alt=media\&token=0acd8d8b-68a1-4a5e-8b3d-fcfbe5fddf5a)
