Comment on page
Creating your first extension from scratch
Learn how to create a basic extension.
We are moving Blueprint's documentation to a brand new website within the following weeks. This documentation website will phase out in the future.
Welcome, developers! This documentation marks the beginning of your journey with Blueprint. Here, we will guide you on how to create your first extension. Let's dive right in and see how it's done.
To get started, you need to obtain Blueprint. You can download it from GitHub, PterodactylMarket, sourceXchange or BuiltByBit. Once downloaded, unzip the files and upload them to your server's
/var/www/pterodactyl
directory. If you need detailed instructions on how to install Blueprint, you can refer to the Blueprint installation guide.After installing Blueprint, it's time to initialize your extension. To do this, run the following command and select "Barebones" as template.
blueprint -init
This command will prompt you to provide various details such as the extension's name, identifier, version, author, and more. Fill in the required information, and Blueprint will generate the necessary files for your extension. These files will be saved in the
.blueprint/dev
folder. To navigate to this folder, use the following command while you're in the /var/www/pterodactyl
directory.cd .blueprint/dev
During the early stages of Blueprint extension development, it is recommended to edit your extension's files in the
.blueprint/dev
folder on your server.Now that your extension is initialized, let's start coding. We'll begin by creating a simple admin page that displays the version, author, and identifier of your extension.
- 1.Open the
view.blade.php
file. - 2.Add the following lines of code to make it readable for users:
<p>Version: ..
Author: ..
Identifier: ..</p>
- 3.To simplify things, we can use placeholders that Blueprint will automatically replace once your extension is installed. Modify the code as follows:
<p>Version: ^#version#^
Author: ^#author#^
Identifier: ^#identifier#^</p>
This will serve as a placeholder until Blueprint replaces the values dynamically.
- 4.To enhance the page, we can use the HTML
<code>
tag. Update the code as follows:
<p>Version: <code>^#version#^</code>
Author: <code>^#author#^</code>
Identifier: <code>^#identifier#^</code></p>
Now you can view this updated content on your extension's page. But before that, we need to build the extension.
From time to time, testing extensions is necessary. To do so, run the following command:
blueprint -build
This command will install your development files as an extension would be installed, allowing you to test its functionality.
This guide assumes you develop your extension directly with blueprint.sh. If you want to learn other ways of exporting extensions check out "Getting your extension ready for installation".
To share your extension with others, you need to export it. This process generates an install-able
extension.blueprint
file that can be distributed or shared.To export your extension, execute the following command:
blueprint -export
Wait for the export process to complete. Once finished, you will find your extension files located in your Pterodactyl directory as an
extension.blueprint
file.In this documentation, you have learned how to create a Blueprint extension by following these key steps:
- 1.Download and install Blueprint.
- 2.Initialize your extension and provide necessary details.
- 3.Code your extension and learning the basics of placeholders.
- 4.Testing your extension with build commands.
- 5.Export your extension as an extension file.
Now, you can share or customize your Blueprint extension as needed. If you will be posting your extension on GitHub, make sure to add the pterodactyl-blueprint tag to your project. Happy coding!
Last modified 27d ago