Skip to main content
This tutorial walks you through building a complete formae plugin that manages files on an SFTP server. By the end, you’ll have a production-ready plugin with:
  • A File resource type with mutable and immutable properties
  • Full CRUD operations (Create, Read, Update, Delete)
  • Discovery to find existing files on the server
  • Integration tests and conformance tests
  • CI configuration for GitHub Actions

Prerequisites

Before starting, ensure you have:
  • Go 1.25 or later: go version
  • PKL CLI: Installation guide
  • formae CLI: installed and accessible in your PATH
  • Docker: for running the test SFTP server

Test server setup

We’ll use a Docker-based SFTP server for development and testing:
This creates an SFTP server with:
  • Host: localhost
  • Port: 2222
  • Username: testuser
  • Password: testpass
  • Writable directory: /upload
Verify it’s running:

Tutorial structure

This tutorial uses test-driven development (TDD). For each CRUD operation, we’ll:
  1. Write a failing test
  2. Implement the code to make it pass
  3. Refactor if needed

The asyncsftp library

SFTP operations are inherently synchronous (blocking I/O), but formae’s plugin SDK supports an async pattern for long-running operations. We provide an asyncsftp library that wraps the standard SFTP client with an async interface:
This pattern is common when integrating with infrastructure APIs. The library handles the complexity internally, so your plugin code just uses the clean async interface.

Source code

The complete source code for this tutorial is available at: github.com/platform-engineering-labs/formae-plugin-sftp
Ready? Let’s start with 01 - Project Scaffold.