Next.jsReactStarter

nextjs-posthook-scheduling — Next.js Starter Template

By posthook

A Next.js and Posthook example project for task reminders that schedules reminders per event via webhook, without relying on cron or queues.

Explore the design

Compare the page layouts and mobile experience. Open any screenshot for a closer look.

2 previews
Desktop homepage1 / 2
Desktop captureTop of page

Actual screenshot captured by the server browser.

All pages & views 2

Screenshots show visual appearance; interactive behavior may differ.

Recorded 2026-10-03View source

What stands out

A quick read of the recorded project description.

01

Schedule per-event reminder webhooks with Posthook, with no cron or queues

02

When creating a task, schedule the hook before writing status, so a failed schedule does not leave a broken task

03

Validate status on delivery: tasks marked complete early cause the due hook to become a no-op

04

posthook.toml defines a daily cleanup sequence as configuration-as-code to delete tasks resolved more than 24 hours ago

05

Provides Docker Compose for a local database and posthook listen for forwarding deliveries locally

06

MIT licensed; code may be used, modified, and distributed for free

Template Details

This is a Next.js starter that demonstrates how to use Posthook to schedule a one-off reminder webhook for each task, without introducing cron, queues, or a workflow engine. The project includes a dashboard interface: when creating a task, a delayed webhook is scheduled through Posthook, and the page shows the trigger time as a countdown; after the hook fires, a callback route handles it and the task status changes to reminded. If the user manually marks the task complete before it fires, the delivered hook becomes a no-op due to status validation.

The data layer uses Drizzle ORM with PostgreSQL. The repository includes a docker compose configuration for a local database and provides a Vercel deploy button (which also provisions Neon Postgres). posthook.toml defines a daily cleanup sequence as configuration-as-code to delete tasks resolved more than 24 hours ago; during local development, you can use the posthook CLI to initialize and deploy that sequence, and use posthook listen to forward deliveries to the local service.

The README explicitly states that this is a demo project: in a real application, you need to add notification, email, or external API call logic in the reminder handler; in production, you should also replace the postbuild script with a proper database migration process, because drizzle-kit push may drop columns. The project is MIT licensed, and the code may be used, modified, and distributed for free, but external services such as Posthook, hosting, and databases may charge separately, and third-party assets such as demo images need separate license verification.

Next.jsStarter

Is it right for your project?

Use Cases

  • Learning how to integrate Posthook into Next.js for delayed webhook scheduling
  • Adding one-off reminders to tasks or events without setting up cron and queues
  • Referencing the status validation pattern to handle hooks invalidated by users completing tasks early
  • Using Sequences to configure periodic data cleanup tasks

Suitable For

  • Developers who want to understand Posthook scheduling and how it integrates with Next.js
  • Small projects that need reminders triggered per event rather than on a fixed schedule
  • Teams that want to manage scheduled cleanup sequences as configuration-as-code

Getting started & customization

Use these recorded setup notes alongside the repository instructions for your chosen version.

  1. 1

    Requires a Posthook API key and signing key, plus a PostgreSQL connection string

  2. 2

    For local development, first start the database with docker compose, then run npm run db:push and npm run dev

  3. 3

    Use npx posthook listen --forward http://localhost:3000 to forward deliveries to the local service

  4. 4

    After deployment, enter the deployment domain in the Posthook project settings, and deploy the cleanup sequence with posthook init and apply

  5. 5

    In production, replace the postbuild script with a proper migration process; drizzle-kit push may drop columns

Read repository instructions

License & source material

Usage conditions & limitations

Free to use · keep license notice

This entry covers the free version in the public repository under the MIT license; the free scope is the code in that version and does not mean external services or third-party assets are free.

Must comply with when using

  • You may use, modify, use commercially, and distribute the code in this version for free.
  • When distributing copies or substantial portions of the code, retain the original author's copyright notice and the full MIT license notice.
  • The code is provided as is; warranties and limitations of liability are governed by the original license and applicable law.

Additional costs & items to verify

  • Using this template requires registering a Posthook account and obtaining an API key and signing key; this is an external service dependency and may incur costs.
  • The deploy button provisions a Neon Postgres database, which depends on that external hosted database service and may be charged separately.
  • The cleanup sequence must be connected to the project via the Posthook CLI and deployed to the Posthook service, depending on its external platform.
  • In production, you must replace the postbuild migration script yourself; otherwise drizzle-kit push may drop database columns.
  • Demo images, fonts, icons, and other third-party assets must be checked against their respective licenses and cannot be judged solely by the code's MIT license.
  • External services such as domains, hosting, databases, payments, or AI may be charged separately.
View Original Text Basis

Permission is hereby granted, free of charge

Original License Text

Add your `POSTHOOK_API_KEY` and `POSTHOOK_SIGNING_KEY` from [posthook.io]

Original README

provisions a Neon Postgres database

Original README

npx posthook init # connects your project, keeps the sequence config

Original README

For production, replace the `postbuild` script with a proper migration workflow (`drizzle-kit push` can drop columns)

Original README
https://github.com/posthook/nextjs-posthook-scheduling/blob/main/LICENSEhttps://github.com/posthook/nextjs-posthook-scheduling/blob/main/README.md

Compiled by DeepSeek based on repository license and README ·2026-10-03. Results only cover the materials read; dependencies, images, fonts, and subsequent term changes are subject to their respective original texts.

Project checks & description sources

Template Information

Source platforms
GitHub
Documentation and maintenance reference score
More documented · 83 / 100
Technologies
Next.js · React
Website type
Starter
How this score is calculated

Our heuristic uses license records (up to 30), a demo link (12), a preview (10), stars (15), recorded maintenance (15), description completeness (8), feature records (5) and classification data (5). It is not a code, security or performance test, or a Google score. A link does not establish tested functionality.

What to verify for this project

Repository update recorded
2026-04-06
Screenshot last checked
2026-10-03

A demo link is listed. Check it with your own content and viewport sizes; its presence does not confirm that forms, authentication or payments work.

The catalog identifies Next.js as the primary stack. Check the actual dependency manifest and lockfile for versions and hosting requirements. These notes use recorded metadata, not a code audit or a deployment test.

Use a selection guide →

How this description was prepared

AI-assisted description based on catalog records and repository material. Repository authors are not automatically the reviewers of this description.

Automatically checked against source and license rules; no manual editorial review.

Inspect the recorded source material

SHA-256: 43791a559aa9623b9d67d31b8a91ea4b9f92cc54aebcc5f81e19d966fc5f3f25

2026-10-03T04:16:01.696Z

Source file / repository
# Posthook + Next.js Reminders

Schedule webhooks that fire at the right time — no cron, no queues, no workflow engines. Built with [Posthook](https://posthook.io?utm_source=nextjs-posthook-scheduling&utm_medium=readme&utm_campaign=vercel) for durable per-event scheduling.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fposthook%2Fnextjs-posthook-scheduling&env=POSTHOOK_API_KEY,POSTHOOK_SIGNING_KEY&envDescription=Get%20your%20API%20key%20and%20signing%20key%20from%20posthook.io&envLink=https%3A%2F%2Fposthook.io%2Fapp%2Fsignup%3Futm_source%3Dnextjs-posthook-scheduling%26utm_medium%3Ddeploy-button%26utm_campaign%3Dvercel&stores=%5B%7B%22type%22%3A%22integration%22%2C%22integrationSlug%22%3A%22neon%22%2C%22productSlug%22%3A%22neon%22%2C%22protocol%22%3A%22storage%22%7D%5D&project-name=posthook-scheduling&repository-name=posthook-scheduling)

![Screenshot](screenshot.png)

## How It Works

1. **Create a task** — schedules a reminder webhook via Posthook
2. **Countdown ticks** — the dashboard shows when the hook will fire
3. **Hook fires** — Posthook delivers the webhook, task status changes to "reminded"
4. **Mark done early** — the pending hook no-ops on delivery (state verification pattern)

In a real app, the webhook handler would also send a notification, trigger a workflow, or call an external API.

## Deploy to Production

1. Click the **Deploy with Vercel** button above (provisions a Neon Postgres database)
2. Add your `POSTHOOK_API_KEY` and `POSTHOOK_SIGNING_KEY` from [posthook.io](https://posthook.io/app/signup?utm_source=nextjs-posthook-scheduling&utm_medium=readme&utm_campaign=vercel)
3. Set your deployment domain in your Posthook project settings (e.g., `my-app.vercel.app`)
4. Set up the cleanup sequence:
   ```bash
   npx posthook init       # connects your project, keeps the sequence config
   npx posthook apply      # deploys the sequence to Posthook
   ```

## Local Development

```bash
git clone https://github.com/posthook/nextjs-posthook-scheduling.git
cd nextjs-posthook-scheduling
npm install
docker compose up -d db
cp .env.example .env.local    # add your Posthook API key + signing key
npm run db:push
npm run dev
```

In another terminal, forward Posthook deliveries to your local server:

```bash
npx posthook listen --forward http://localhost:3000
```

Open [http://localhost:3000](http://localhost:3000), create a task with a 30s delay, and watch it fire.

## Posthook Patterns

See [PATTERNS.md](PATTERNS.md) for detailed explanations and copy-pasteable code:

- **Schedule hooks before committing state** — if scheduling fails, no broken task
- **State verification on delivery** — mark done before the hook fires, it no-ops
- **Handler as extension point** — add your notification/email/API call logic

## Recurring Cleanup with Sequences

This starter includes a daily cleanup sequence defined in `posthook.toml` using [Posthook Sequences](https://docs.posthook.io/essentials/sequences). It deletes resolved tasks older than 24 hours. See the [Deploy to Production](#deploy-to-production) section for setup.

## Project Structure

```
app/
  page.tsx                    # Dashboard UI
  create-form.tsx             # Task creation form
  mark-done-button.tsx        # Complete task action
  api/
    tasks/route.ts            # POST (create), GET (list)
    tasks/[id]/route.ts       # GET (detail), PATCH (complete)
    webhooks/
      remind/route.ts         # Posthook reminder callback
      cleanup/route.ts        # Posthook sequence: daily cleanup
lib/
  posthook.ts                 # Posthook client (lazy singleton)
  tasks.ts                    # Task logic + Posthook scheduling
  store.ts                    # Data access layer (Drizzle)
  types.ts                    # TypeScript types
  db/schema.ts                # Drizzle schema
  db/index.ts                 # Database connection
posthook.toml                 # Sequences config (config-as-code)
```

## Customize

- Change `REMINDER_DELAY` env var to set the default delay (e.g., `30s`, `5m`, `1h`, `1d`)
- Add new webhook handlers for different hook types
- Add notification logic (email, Slack, push) inside the remind handler
- See [PATTERNS.md](PATTERNS.md) for advanced patterns
- For production, replace the `postbuild` script with a proper migration workflow (`drizzle-kit push` can drop columns)

## Environment Variables

| Variable | Required | Description |
|---|---|---|
| `DATABASE_URL` | Yes | Postgres connection string |
| `POSTHOOK_API_KEY` | Yes | Posthook API key |
| `POSTHOOK_SIGNING_KEY` | Yes | Posthook signing key |
| `REMINDER_DELAY` | No | Default reminder delay (default: `1h`) |

## Tech Stack

- [Next.js](https://nextjs.org) 16 (App Router)
- [Posthook](https://posthook.io?utm_source=nextjs-posthook-scheduling&utm_medium=readme&utm_campaign=vercel) for durable per-event scheduling
- [Drizzle ORM](https://orm.drizzle.team) + PostgreSQL
- [Tailwind CSS](https://tailwindcss.com)

## License

MIT
Report a correction

Explore similar templates

Compare previews and descriptions within the same stack and category.