Announcing the Spin Up Hub
Sohan Maheshwar
spin
spin up hub
fermyon
Building a new application from scratch can be daunting and developers are no strangers to this. In fact, one of the reasons for the growing popularity of containers is the ease of starting application development from a verifiable base that can be easily shared between developers. We’ve truly been inspired by the great content generated by the Spin community, and we want to make it accessible for everyone to build and innovate upon. With that spirit in mind, we’re proud to announce the launch of Spin Up Hub - a single location to find and use Spin templates, libraries, and plugins. Built by Fermyon and the Spin community, for the Spin community.
These resources are the quickest way to start building your Spin application and allow you to easily create the skeleton of an application or component, ready for the custom business logic to be filled in. The aim of the Spin Up Hub is to produce re-useable components for Spin, and ultimately increase your productivity as a Spin developer. Read on to learn more about how you can get started with these templates and also contribute templates of your own to the Spin Up Hub.
Spin Up Hub, spiffily spun
The release of Spin 1.x included the ability to easily use templates, add pre-built components through spin add
, and use plug-ins to extend the set of triggers available for Spin applications. Take for instance, Spin’s static fileserver. With spin add
, adding a frontend component to your Spin application is quick and easy. The application manifest and file structure skeleton is magically set up on your behalf - all you have to focus on is adding custom logic to your frontend component.
Since then, we’ve been hard at work creating templates that make it easy for you to get started with Spin. With the release of Spin Up Hub, all templates and plug-ins have a centralised repository for easier access. Resources that have the ‘verified by Fermyon’ have either been developed by or have been vetted by the Fermyon team.
Cracking Open The Hub - Example Resources
Here are some examples of resources from the Spin Up Hub.
Content Name | Language | Content Type | Description |
http-py | python | Template | This is the default HTTP trigger template for Python. It installs by default when installing Spin |
kv-explorer | Go | Template | Persist your non-relational data in a key/value store managed by Spin |
redis-go | go | Template | This is the default Redis pub-sub trigger template for Go |
spin-contrib-http | rust | Template | A bunch of helpers to build HTTP-based applications with Spin. Created by Thorsten |
spinlet | rust | Plugin | A plugin and runtime for building and running wasm32-wasi cli components as plugins for Spin. Created by Matheus |
static-fileserver | rust | Template | A simple static file server as a Spin HTTP component |
message-trigger | rust | Template | A generic messaging trigger for Spin. Created by Lee-Orr |
OpenAI | typescript | Template | The application exposes and endpoint to ask a question in the body of a POST request and get an answer in the response. Created by Robin |
You can see in the table above that there are different resource types The following is a list of the types of resources available on the Spin Up Hub.
- Examples
- Spin Application examples
- Code snippets
- Spin Templates
- Spin Plugins
- Libraries
Getting started
Here’s how you get started using a Spin template
To list available templates, run spin templates list
.
Adding a template to a Spin app is straightforward. Run spin add <template-name>
This works similarly to spin new
except that a pre-requisite is that spin.toml
file should already exist. The details of the new components from the template are then added to that spin.toml
file:
spin-add
Scaffold a new component into an existing application
spin add --help
USAGE:
spin add [OPTIONS] [ARGS]
ARGS:
<TEMPLATE_ID> The template from which to create the new application or component. Run `spin templates list` to see available options
<NAME> The name of the new application or component
Here’s how you get started using a Spin plugin
To list available plugins, run spin plugins list
.
To install a Spin plugin you can use the following command:
spin plugins install <plugin-name>
spin <plugin-name>
With the plugin installed, you can now call spin <plugin name>
to run it. For more info, you can read this page.
Contributing to the Spin Up Hub
As we move forward, we’ll be looking for and welcoming contributions to the Spin Up Hub. Contributing to the Spin Up Hub is straightforward. Each resource listed in the Hub is a markdown .md
file that points to a repository. This markdown file contains metadata about your resource. Here is a sample to get you started:
title = "Rust HTTP trigger template"
template = "render_hub_content_body"
date = "2022-10-15T00:22:56Z"
content-type = "text/html"
tags = ["rust", "http"]
[extra]
author = "fermyon"
type = "hub_document"
category = "Template"
language = "Rust"
created_at = "2022-10-15T00:22:56Z"
last_updated = "2022-10-15T00:22:56Z"
spin_version = ">v0.2"
summary = "A template to create an HTTP handler in Rust"
url = "https://github.com/fermyon/spin/tree/main/templates/http-rust"
---
Description of the resource
Be sure to make a description of the hub item in the body (below the ---
line). The content that you write below the ---
line will be the content shown when the card is expanded in a modal view.
Any contribution and interaction on any Fermyon project MUST follow our Code of Conduct. Here is the complete Contributor Guide to get you started. To interact with the Spin developer community, check out our Discord server.
That’s it from us, check out the Spin Up Hub right away.
---
Read more about today’s announcements: