Templates, Stacks & Boilerplates

Copyable Docker Compose stacks, Cloud VPS bootstrap scripts, edge worker templates, and webhook handlers for freelancers, developers, and hobbyists.

Docker Compose n8n

n8n + Caddy Docker Compose Stack

Production-ready docker-compose.yml and Caddyfile for deploying self-hosted n8n with automatic Let's Encrypt SSL.

View Full Guide
yaml
services:
  n8n:
    image: n8nio/n8n:latest
    restart: unless-stopped
    environment:
      - N8N_HOST=n8n.example.com
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.example.com/
    volumes:
      - ./n8n_data:/home/node/.n8n

  caddy:
    image: caddy:2
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./caddy_data:/data
Bash Script Infrastructure

Cloud VPS Docker & Firewall Bootstrap (Ubuntu/Debian)

1-minute script to configure a fresh $4/mo VPS (DigitalOcean, Hetzner, Linode) with Docker, Compose, and hardened UFW firewall rules.

View Full Guide
bash
#!/usr/bin/env bash
# Quick VPS setup for automation nodes
set -euo pipefail

echo "==> Updating apt repositories..."
sudo apt update && sudo apt upgrade -y

echo "==> Installing Docker & Compose..."
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker "$USER"

echo "==> Configuring UFW firewall..."
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw --force enable

echo "==> Docker VPS Ready! Log out and log back in to apply docker group permissions."
Worker Script Cloudflare Workers

Cloudflare Edge Rate Limiter Worker

Sliding-window rate limiting proxy using Cloudflare Durable Objects to safeguard origin APIs.

View Full Guide
javascript
export class RateLimiter {
  constructor(state, env) {
    this.state = state;
    this.env = env;
    this.requests = [];
  }

  async fetch(request) {
    const now = Date.now();
    const windowMs = 60000;
    this.requests = this.requests.filter(t => now - t < windowMs);

    if (this.requests.length >= 60) {
      return new Response('Too Many Requests', { status: 429 });
    }

    this.requests.push(now);
    return new Response(JSON.stringify({ allowed: true, remaining: 60 - this.requests.length }));
  }
}
Node.js Script APIs

Stripe HMAC Signature Verifier & Express Webhook Handler

Production Stripe webhook listener verifying raw cryptographic HMAC signatures and updating subscription states in PostgreSQL.

View Full Guide
javascript
import express from 'express';
import Stripe from 'stripe';
import { Pool } from 'pg';

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const app = express();

app.post('/webhook', express.raw({ type: 'application/json' }), async (req, res) => {
  const sig = req.headers['stripe-signature'];
  let event;

  try {
    event = stripe.webhooks.constructEvent(req.body, sig, process.env.STRIPE_WEBHOOK_SECRET);
  } catch (err) {
    return res.status(400).send(`Webhook Error: ${err.message}`);
  }

  if (event.type === 'customer.subscription.updated') {
    const sub = event.data.object;
    await pool.query(
      'UPDATE subscriptions SET status = $1, current_period_end = to_timestamp($2) WHERE stripe_subscription_id = $3',
      [sub.status, sub.current_period_end, sub.id]
    );
  }

  res.json({ received: true });
});
Workflow YAML GitHub Actions

GitHub Actions CI/CD Pipeline Template

Automated test, lint, and Cloudflare Pages deploy action with concurrency controls and secret injection.

View Full Guide
yaml
name: Deploy to Cloudflare Pages
on:
  push:
    branches: [main]

jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm ci
      - run: npm run build
      - uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages deploy dist --project-name=workflow-vault
Node.js Script AI Agents

Claude & Notion Article Summarizer

Batch fetch unprocessed Notion database pages, generate structured executive summaries with Claude 3.5 Sonnet, and write back blocks.

View Full Guide
javascript
import { Client } from '@notionhq/client';
import Anthropic from '@anthropic-ai/sdk';

const notion = new Client({ auth: process.env.NOTION_API_KEY });
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY });

const response = await anthropic.messages.create({
  model: 'claude-3-5-sonnet-20241022',
  max_tokens: 1000,
  messages: [{ role: 'user', content: 'Summarize key takeaways in 3 concise bullet points.' }]
});

console.log(response.content[0].text);
Scenario JSON Make

Make (Integromat) Webhook Router Scenario Blueprint

Exportable scenario definition routing incoming webhooks to Airtable with duplicate deduplication and error handler fallback.

View Full Guide
json
{
  "name": "Webhook to Airtable Sync",
  "scenario": "Airtable Inbound Router",
  "trigger": "Custom Webhook (Instant)",
  "idempotencyFilter": "SEARCH Airtable WHERE Event_ID = {{1.eventId}}",
  "branches": [
    { "condition": "totalBundles == 0", "action": "Airtable: Create Record (Events)" },
    { "condition": "totalBundles > 0", "action": "Ignore Duplicate" }
  ],
  "errorHandler": {
    "action": "Airtable: Create Record (Dead-Letter Queue)",
    "directive": "Resume"
  }
}