# Create my own library in BladeRunner

You are now able to make your own libraries in [BladeRunner](index.md). These [**_User Libraries_**](bladerunner-user-libraries.md) will reside inside your app.

BladeRunner will recognise the newly created folder as a library, as opposed to just a folder containing JS classes and objects. This means you can share your library code across multiple applications, as well as publishing code to make it available to other users of BladeRunner.

## Creating a new library

The 'create-library' command will add a library to an existing application directory:

1. To begin, open up the command-line interface on your machine. From here, navigate to your sdk directory in your BladeRunner installation folder.
2. Then execute the following command from within the _sdk_ directory, replacing _app-name_ with the name of your existing application, and _library-name_ with a name of your choosing:

   ```
   bladerunner create-library <app-name> <library-name> <library-namespace>
   ```

This should then have created a directory structure that resembles the following:

![user_libs_sc_1_EDIT](../../../images/user_libs_sc_1_EDIT.png)

Following on this structure,

* Source code can be placed within the _src_ directory
* Resources can be placed within the _resource_ directory
* Tests can be placed within the _test_ directory

## Directory structure for user libraries

Any resources that are used by a library must reside in the _resources_ directory, reflecting the structure of the _src_ directory, like this:

![user-libraries-screenshot_1](../../../images/user-libraries-screenshot_1.png)

So, the idea here is that if you refer to `pkg.OtherClass` within your code, then only `pkg1/config.xml` will be bundled. _However_, if you refer to `pkg1.pkg2.Class`, then it will cause both the resources at the same directory level _plus_ parent package levels to be bundled. In our example, this would give you the following:

* `pkg1/config.xml`
* `pkg1/pkg2/style.css`
* `pkg1/pkg2/template.html`

Therefore, by being placed at a higher level directory, common resources can be shared across classes in different packages. You can see that the way _resources_ are handled for user libraries differs from that for aspects, blades and bladesets - for user libraries, only the required resources are packaged, whereas for the other BladeRunner structures, everything is packaged.
