#  Creating a Bitbucket Server plugin

Just like the other Atlassian web applications, Bitbucket Server embeds the [Atlassian Plugin Framework](https://developer.atlassian.com/display/DOCS/Plugin+Framework) and has full support for the [Atlassian Plugin SDK](https://developer.atlassian.com/display/DOCS/Getting+Started). 

The first step for any developer embarking on tackling an Atlassian plugin is to
[install the Atlassian Plugin SDK](https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project).
Once you're comfortable with the SDK, you have three options with how to proceed: [starting from scratch](#Starting_from_scratch),
[following a tutorial](#Following_a_tutorial) or [forking an existing plugin](#Forking_an_existing_plugin).

## Starting from scratch

If you have some experience with Bitbucket Server plugins or the Atlassian plugin framework, you might consider starting from
scratch by creating a plugin using the Atlassian SDK:

1. [Install the Atlassian Plugin SDK](https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project).
2. Run *atlas-create-stash-plugin* and follow the prompts to create your plugin.
3. Run *atlas-create-stash-plugin-module* from the root directory of your plugin or hand edit your
*atlassian-plugin.xml* file to add additional modules to your plugin.
4. Run *atlas-run* from the root directory of your plugin to start Bitbucket Server with your plugin installed. See the
[Atlassian Plugin SDK Documentation](https://developer.atlassian.com/display/DOCS/Working+with+the+SDK)
for more information on developing and debugging your plugin.
5. Use the reference materials and examples from this site to flesh out the functionality of your plugin.

 <div class="aui-message info shadowed">
     <h4 class="title"><a name="Video-Tutorial"></a>Video tutorial</h4>
     <span class="aui-icon icon-info"></span>
     <p>
        See the above commands in action in this <a href="https://developer.atlassian.com/blog/2015/01/beer-o-clock-stash-plugin-tutorial/">30 minute video tutorial</a>.
     </p>
     <p>
        Note: This tutorial pre-dates the renaming of the product to "Bitbucket Server" from "Stash", but is still a useful resource.
     </p>
 </div>

## Following a tutorial

1. [Install the Atlassian Plugin SDK](https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project).
2. Choose and follow one of the [Bitbucket Server plugin tutorials](../tutorials-and-examples/bitbucket-server-tutorials.html).

## Forking an existing plugin

1. [Install the Atlassian Plugin SDK](https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project).
2. Create a [Bitbucket account](https://bitbucket.org).
3. Browse our [collection of open source Bitbucket Server plugins](http://atlassian.bitbucket.org/#bitbucketserver) and fork it into your
personal account. You can choose whether to make your fork public or private.
4. Modify the plugin to suit your needs.

