A secure, non-egress compliant backend service for monitoring external health check endpoints and reporting their status to Atlassian Forge applications.
This custom backend server enables health monitoring of external services while maintaining compliance with Atlassian's "Runs on Atlassian" policy. It acts as a bridge between external services and your Forge application, handling health checks and secure communication.
- Health Check Service: Monitors external service endpoints
- Tenant Management: Secure multi-tenant data storage
- Cryptographic Security: Ed25519 key-based authentication
- Scheduled Monitoring: Automated periodic health checks
- Forge Integration: Secure communication with Forge triggers
The backend uses a sophisticated tenant-based security model:
- Key Generation: Each tenant (cloudId) gets a unique Ed25519 key pair
- Public Key Registration: During service registration, the public key is sent to Forge
- Signature Verification: All subsequent requests are cryptographically signed
- Forge Validation: Forge validates signatures using the stored public key
1. Service Registration:
- Backend generates Ed25519 key pair for tenant
- Public key sent to Forge during REGISTER action
- Forge stores public key for tenant
2. Health Check Updates:
- Backend signs data with private key
- Forge validates signature using stored public key
- Only valid signatures are processed
- Periodic Checks: Automatic health checks every 5 minutes
- Real-time Status: Live status updates sent to Forge
- Error Handling: Comprehensive error logging and recovery
- Ed25519 Cryptography: Industry-standard digital signatures
- Tenant Isolation: Separate keys and data per tenant
- Non-egress Compliance: All data processing within Atlassian infrastructure
- Efficient Monitoring: Optimized health check scheduling
- Scalable Architecture: Handles multiple tenants and services
- Graceful Shutdown: Proper cleanup on service termination
Serves the service registration page for users to add new health check endpoints.
Registers a new health check service:
- Validates input data
- Performs initial health check
- Stores tenant information
- Sends registration data to Forge
PORT: Server port (default: 8080)BACKEND_URL: Public URL for the backend service
Set the backend URL in your Forge app:
forge variables set BACKEND_URL https://your-backend-service.com- Your backend server must be accessible via HTTPS
- Local development requires a tunnel service (ngrok, etc.)
- The tunnel URL must be set as the
BACKEND_URLForge variable - Without HTTPS, the Forge app will show "Backend URL Not Configured" error
- ngrok: Most popular, stable, free tier available
- Cloudflare Tunnel: More reliable for production use
- LocalTunnel: Simple but less stable
- URL Changes: Free tunnel services often change URLs on restart
- Node.js 18+
- ngrok or similar HTTPS tunnel service
- Forge CLI installed and configured
-
Install Dependencies
npm install
-
Start the Backend Server
npm run start
-
Set up HTTPS Tunnel (Required)
Since Forge applications require HTTPS, you need to expose your local server using a tunnel service:
# Install ngrok (if not already installed) npm install -g ngrok # Start ngrok tunnel on port 8080 ngrok http 8080
This will give you a public HTTPS URL like:
https://d69055ad7ba7.ngrok.app -
Configure Forge Variables
Navigate to your Forge app directory and set the backend URL:
cd .. forge variables set BACKEND_URL https://d69055ad7ba7.ngrok.app
Replace
https://d69055ad7ba7.ngrok.appwith your actual ngrok URL.
If you prefer other tunnel services:
- Cloudflare Tunnel:
cloudflared tunnel --url http://localhost:8080 - LocalTunnel:
npx localtunnel --port 8080 - Serveo:
ssh -R 80:localhost:8080 serveo.net
For development with hot reload:
npm run devnpm run build
npm run start:prodHere's a complete step-by-step example of setting up the application:
# 1. Install dependencies
npm install
# 2. Start the backend server
npm run start
# Server will start on http://localhost:8080
# 3. In a new terminal, start ngrok tunnel
ngrok http 8080
# This will output something like:
# Forwarding https://d69055ad7ba7.ngrok.app -> http://localhost:8080
# 4. Navigate to your Forge app directory
cd ..
# 5. Set the backend URL variable
forge variables set BACKEND_URL https://d69055ad7ba7.ngrok.app
# 6. Deploy your Forge app (if not already deployed)
forge deploy
# 7. Install your Forge app
forge installAfter completing these steps, your Forge app should be able to communicate with the backend server through the HTTPS tunnel.
src/
├── middleware/ # Express middleware
├── routes/ # API endpoints
├── services/ # Business logic
├── utils/ # Helper functions
├── types.ts # TypeScript definitions
├── constants.ts # Configuration
└── server.ts # Main server file
- Authorization: Keys serve as the primary authentication mechanism for Forge web triggers
- Data Integrity: Cryptographic signatures ensure data hasn't been tampered with
- Tenant Isolation: Each tenant has separate keys, preventing cross-tenant access
- Non-repudiation: Digital signatures provide proof of data origin
- Generation: New Ed25519 key pair created per tenant
- Registration: Public key sent to Forge during first service registration
- Validation: Forge validates all subsequent requests using the public key
- Rotation: Keys can be regenerated if needed (requires re-registration)
This backend is designed to be fully compliant with Atlassian's "Runs on Atlassian" policy:
- ✅ No data egress from Atlassian infrastructure
- ✅ All processing within approved boundaries
- ✅ Secure communication with Forge applications
- ✅ Proper tenant data isolation
- Health Check Results: Detailed logging of all health check attempts
- Error Tracking: Comprehensive error logging with context
- Performance Metrics: Monitoring of response times and success rates
- Security Events: Logging of authentication and authorization events
- Node.js 18+
- TypeScript 5+
- Forge CLI
npm run start- Start production servernpm run dev- Start development server with hot reloadnpm run build- Compile TypeScriptnpm run start:prod- Start compiled server
MIT License - see LICENSE file for details.