Deploy Hooks
Automatically rebuild your static site when theStacc publishes new content.
Deploy hooks let your static site rebuild automatically whenever theStacc publishes, updates, or unpublishes a blog post. Without deploy hooks, you'd need to manually trigger a rebuild every time content changes.
How deploy hooks work
1. You publish a blog in theStacc
2. theStacc sends a POST request to your deploy hook URL
3. Your hosting platform receives the request and starts a new build
4. During the build, your site fetches the latest content from the Public Blog API
5. New static HTML pages are generated and deployed
The entire process takes 1-3 minutes depending on your site's build time.
Events that trigger a rebuild
theStacc fires a deploy hook when:
- A new blog is published
- A published blog is updated (content edited, then synced)
- A published blog is unpublished (removed from your site)
Draft changes, generation, or approval steps do not trigger a rebuild.
Setting up deploy hooks
Step 1: Get your deploy hook URL
#### Cloudflare Pages
- Go to your project in the Cloudflare dashboard
- Navigate to Settings > Builds & deployments > Deploy hooks
- Click Add deploy hook
- Name it "theStacc" and select your production branch
- Copy the generated URL (looks like
https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/...)
#### Vercel
- Go to your project in the Vercel dashboard
- Navigate to Settings > Git > Deploy Hooks
- Create a hook named "theStacc" for your main branch
- Copy the generated URL (looks like
https://api.vercel.com/v1/integrations/deploy/...)
#### Netlify
- Go to your site in the Netlify dashboard
- Navigate to Site configuration > Build & deploy > Build hooks
- Click Add build hook
- Name it "theStacc" and select your production branch
- Copy the generated URL (looks like
https://api.netlify.com/build_hooks/...)
#### GitHub Pages
GitHub Pages doesn't have built-in deploy hooks. Use a GitHub Actions workflow instead:
- Create a repository dispatch workflow in
.github/workflows/rebuild.yml:
name: Rebuild site
on:
repository_dispatch:
types: [thestacc-publish]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and deploy
run: |
npm install
npm run build
- Use a webhook-to-dispatch service, or set up a simple Cloudflare Worker that converts the theStacc webhook into a GitHub repository dispatch event.
Step 2: Add the URL to theStacc
- Go to Settings > Publishing > API Access in your theStacc dashboard
- Find the Deploy Hook section
- Paste your deploy hook URL
- Click Test to verify the connection — this triggers a test build on your hosting platform
- Save
Build optimization
Each deploy hook triggers a full site rebuild. Keep builds fast:
- Cache API responses — If your framework supports build caching, the theStacc API returns
Cache-ControlandETagheaders - Incremental builds — Frameworks like Next.js and Astro support incremental static regeneration. Only new or changed pages get rebuilt
- Limit unnecessary rebuilds — theStacc only triggers hooks for published content changes, not drafts or internal edits
Monitoring builds
After setting up deploy hooks:
- Publish a test blog in theStacc
- Check your hosting platform's build logs — you should see a new build triggered within seconds
- Once the build completes, verify the new blog appears on your site
- Check the published URL in your browser and confirm content renders correctly
If the build doesn't trigger, verify:
- The deploy hook URL is correct and active
- Your hosting platform hasn't disabled automatic builds
- Your API key is configured in the hosting platform's environment variables
Debouncing
If you publish multiple blogs at once (e.g., approving a batch), theStacc waits 30 seconds after the last publish event before firing the deploy hook. This prevents multiple redundant builds and keeps your hosting platform's build queue clean.
Security
Deploy hook URLs are stored securely and never exposed in the frontend. The URLs themselves act as authentication — anyone with the URL can trigger a build. If you suspect your URL has been compromised:
- Delete the current hook on your hosting platform
- Create a new one
- Update the URL in theStacc settings
Next steps
- Review the Public Blog API reference for all available endpoints
- Follow the Static Site Integration guide if you haven't set up your site yet