Developer Tools
Relevant source files
The following files were used as context for generating this wiki page:
Developer Tools consist of internal utilities, mock servers, and CI/CD scripts that maintain code quality, verify documentation accuracy, and automate the release lifecycle. These tools ensure that both the library code and its public-facing documentation remain synchronized and functional.
Documentation Verification (Resend.DocsCheck)
The Resend.DocsCheck tool validates C# code snippets embedded within documentation files. It ensures that examples provided to users are syntactically correct and compatible with the current version of the SDK.
Compilation Logic
The tool scans a root directory for .mdx files and extracts code blocks marked with ```csharp .NET. It wraps each extracted block into a standard C# Program class with a Main method. It then uses the Roslyn compiler (CSharpCompilation) to attempt a library-style compilation in memory.
The tool adds standard assembly references during compilation, including System.Runtime, System.Net.Http, and the core IResend interface.
Sources: tools/Resend.DocsCheck/Program.cs:88-106, tools/Resend.DocsCheck/Program.cs:175-195, tools/Resend.DocsCheck/api-check.sh
Status Results
| Result | Condition | Output |
|---|---|---|
| Ok | Code block compiles successfully. | aok |
| Warn | Code block starts with // (missing sample). | wrn |
| Fail | Compilation errors occur. | err + Diagnostics |
| Sources: tools/Resend.DocsCheck/Program.cs:141-155, tools/Resend.DocsCheck/Program.cs:211-228 |
API Mock Server (Resend.ApiServer)
The Resend.ApiServer provides a local mock of the Resend API. It allows developers to test SDK functionality without making actual network requests to the production Resend environment.
Automation Controller
The AutomationController simulates endpoints for managing marketing automations. It returns hardcoded or randomly generated ObjectId instances for creation and duplication tasks.
Sources: tools/Resend.ApiServer/Controllers/AutomationController.cs:24-34, tools/Resend.ApiServer/Controllers/AutomationController.cs:122-132
Webhook Controller
The WebhookController manages the lifecycle of webhooks and provides logs for webhook events. It supports rotating signing secrets and listing delivery attempts.
Sources: tools/Resend.ApiServer/Controllers/WebhookController.cs:64-74, tools/Resend.ApiServer/Controllers/WebhookController.cs:157-179
CI/CD and Release Automation
The project uses shell scripts to automate the publication of NuGet packages and the creation of GitHub releases.
Release Workflow
The release.sh script enforces environment variables and version consistency before proceeding with the build. It verifies that the GITHUB_REF tag matches the version specified in the project properties.
| Step | Action | Command |
|---|---|---|
| Verification | Match Tag with Project Version | dotnet msbuild -getProperty:Version |
| Clean | Remove previous builds | dotnet clean -c Release |
| Test | Run unit and integration tests | dotnet test -c Release |
| Pack | Generate .nupkg files | dotnet pack -c Release |
| Publish | Push to NuGet.org | dotnet nuget push |
| Release | Create GitHub Release | gh release create |
| Sources: cicd/release.sh:31-40, cicd/release.sh:54-65 |
Sources: cicd/release.sh:23-26, cicd/release.sh:63-71
Developer Tool Summary
These tools facilitate a robust development environment. DocsCheck prevents documentation rot by validating examples against the compiler. ApiServer provides a predictable environment for integration testing. release.sh ensures that only verified, version-consistent builds reach the production NuGet registry.