Skip to content

About

Edge-native personal goal tracker with automated SMS reminders, dual Gregorian & Jalali calendars, and offline PWA support. Built with Next.js 16 on Cloudflare Workers & D1.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Checkpoint Logo

Checkpoint (Ϊ†Ϊ©β€ŒΩΎΩˆΫŒΩ†Ψͺ)

An edge-native, privacy-first personal goal tracker with automated SMS reminders and dual calendar support.

Next.js Cloudflare Workers Cloudflare D1 Google Workbox Tailwind CSS License

Live Demo β€’ Features β€’ Quick Start β€’ Cloudflare Deployment β€’ Architecture


πŸ“– What is Checkpoint?

Checkpoint is an ultra-fast, edge-hosted personal productivity system designed to keep you accountable to your long-term and short-term goals. Unlike standard todo lists that get forgotten inside browser tabs, Checkpoint sends timely, automated SMS notifications directly to your phone whenever an upcoming checkpoint or goal deadline is due.

Built natively for Cloudflare Workers using Next.js 16 (Turbopack) and OpenNext, Checkpoint delivers sub-millisecond global cold starts with zero server maintenance, zero monthly hosting bills, and maximum personal privacy.


✨ Key Features

  • 🎯 Milestone & Goal Management: Create, edit, and organize personal and professional goals with descriptions and target completion deadlines.
  • πŸ“± Automated SMS Reminders:
    • Direct integration with the SMS.ir REST API v1.
    • One-time milestone alerts and recurring reminder schedules.
    • Automatic Iranian mobile number normalization (+98..., 0098..., 09...).
    • Comprehensive delivery audit log (sent_log) with timestamps and status reporting.
  • πŸ—“οΈ Dual Calendar System (Gregorian & Jalali / Shamsi):
    • Full support for both Western (Gregorian) and Persian (Jalali/Ω‡Ψ¬Ψ±ΫŒ Ψ΄Ω…Ψ³ΫŒ) calendars.
    • Responsive, custom native date picker popovers adapted to the Google Material design language.
    • User-configurable default calendar preference stored locally.
  • 🌐 Full English & Persian Localization (i18n & RTL):
    • Seamless toggle between English (en) and Persian (fa).
    • Native Right-to-Left (RTL) typography and layout mirroring.
  • πŸ“² Progressive Web App (PWA) with Google Workbox:
    • Installable as a standalone app on iOS, Android, and Desktop.
    • Powered by Google Workbox 7.3.0 with Stale-While-Revalidate caching for static assets, Cache-First for media, and Network-First navigation.
    • Dedicated bilingual offline fallback page with automated reconnect detection.
  • ⚑ Edge-Native Architecture:
    • Hosted globally on Cloudflare Workers edge network via @opennextjs/cloudflare.
    • Backed by Cloudflare D1 (distributed SQLite) and Drizzle ORM with automated migrations.
  • πŸ”’ Secure Single-User Session Auth:
    • Password hashing using bcrypt with constant-time verification.
    • Tamper-proof HTTP-only session cookies and bearer-token protection for automated cron workers.

πŸ—οΈ Architecture & Tech Stack

graph TD
    Client["πŸ“± Browser / PWA (Google Workbox SW)"] -->|HTTPS / Next.js 16| Worker["⚑ Cloudflare Worker (OpenNext Runtime)"]
    Worker -->|Auth & Routing| MW["Proxy / Middleware (next-intl + Session)"]
    Worker -->|Queries & Relations| Drizzle["Drizzle ORM"]
    Drizzle -->|SQL Binding| D1["πŸ—„οΈ Cloudflare D1 (SQLite Database)"]
    Cron["⏰ Scheduled Cron Trigger"] -->|POST /api/check-reminders| Worker
    Worker -->|X-API-KEY| SMS["πŸ“‘ SMS.ir REST API v1"]
    SMS -->|SMS Dispatch| Phone["πŸ“² Destination Mobile Number"]
Loading
Layer Technology
Framework Next.js 16.3.5 with Turbopack & App Router
Runtime Cloudflare Workers via @opennextjs/cloudflare
Database Cloudflare D1 (Serverless distributed SQLite)
ORM Drizzle ORM & Drizzle Kit
PWA & SW Google Workbox 7.3.0
Styling Tailwind CSS v4 & Radix UI primitives
Localization next-intl (English & Persian RTL)
Calendar jalaali-js for dual Shamsi/Gregorian conversions
SMS Gateway SMS.ir REST API v1

πŸš€ Quick Start (Local Development)

1. Prerequisites

Ensure you have the following installed:

2. Clone the Repository

git clone https://github.com/Josheqani/checkpoint.git
cd checkpoint

3. Install Dependencies

pnpm install

4. Configure Environment Variables

Copy the provided example environment template:

cp .env.example .dev.vars
cp .env.example .env.local

Generate your personal password hash and random secrets:

# Generate bcrypt password hash (replace 'mypassword' with your chosen password):
node -e "console.log(require('bcryptjs').hashSync('mypassword', 10))"

# Generate random 32-byte hex secret for SESSION_SECRET:
openssl rand -hex 32

# Generate random 32-byte hex secret for CRON_SECRET:
openssl rand -hex 32

Update your .dev.vars file:

NEXTJS_ENV=development
AUTH_USERNAME=admin
AUTH_PASSWORD_HASH=$2b$10$...your_bcrypt_hash...
SESSION_SECRET=...your_session_secret...
CRON_SECRET=...your_cron_secret...
SMSIR_API_KEY=your_sms_ir_api_key
SMSIR_LINE_NUMBER=30000000000000

5. Initialize Local SQLite Database

Run D1 migrations locally:

pnpm exec wrangler d1 execute checkpoint-db --local --file=drizzle/0000_warm_red_shift.sql
pnpm exec wrangler d1 execute checkpoint-db --local --file=drizzle/0001_tired_doctor_doom.sql

6. Run the Development Server

pnpm dev

Open http://localhost:3000 in your browser. Log in with your configured username and password.


☁️ Self-Hosted Cloudflare Deployment

Deploying your personal Checkpoint instance to Cloudflare takes less than 5 minutes.

1. Create a Cloudflare D1 Database

Log into your Cloudflare account via Wrangler:

pnpm exec wrangler login

Create the remote D1 database:

pnpm exec wrangler d1 create checkpoint-db

Wrangler will output configuration information similar to:

{
  "binding": "DB",
  "database_name": "checkpoint-db",
  "database_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}

Copy the database_id and ensure it matches wrangler.jsonc:

"d1_databases": [
  {
    "binding": "DB",
    "database_name": "checkpoint-db",
    "database_id": "your-database-id-here",
    "migrations_dir": "drizzle"
  }
]

2. Apply Database Migrations on Cloudflare

Apply the initial database schema to your remote production D1 database:

pnpm exec wrangler d1 execute checkpoint-db --remote --file=drizzle/0000_warm_red_shift.sql
pnpm exec wrangler d1 execute checkpoint-db --remote --file=drizzle/0001_tired_doctor_doom.sql

3. Set Production Secrets on Cloudflare

Store your credentials securely in Cloudflare Secret storage:

pnpm exec wrangler secret put AUTH_USERNAME
pnpm exec wrangler secret put AUTH_PASSWORD_HASH
pnpm exec wrangler secret put SESSION_SECRET
pnpm exec wrangler secret put CRON_SECRET
pnpm exec wrangler secret put SMSIR_API_KEY
pnpm exec wrangler secret put SMSIR_LINE_NUMBER

Tip: If you don't provide SMSIR_LINE_NUMBER, Checkpoint will automatically query the SMS.ir /v1/line discovery endpoint and use your primary active sender line.

4. Build and Deploy

Build the OpenNext bundle and deploy directly to Cloudflare:

pnpm run deploy

Your app will be live at https://checkpoint.<your-subdomain>.workers.dev (or your custom domain configured in Cloudflare).


⏰ Automated Reminder Scheduler (Cloudflare Native Cron)

Checkpoint executes automated reminder checks natively on the Cloudflare Workers edge every 5 minutes (*/5 * * * *).

  • Zero External Dependencies: Cloudflare triggers the Worker's scheduled handler automatically on the exact minute with sub-millisecond precision.
  • Edge Security: Runs internally on Cloudflare's network, invoking /api/check-reminders directly.
  • Quota-Friendly: Uses only 288 runs/day out of Cloudflare's 100,000 free daily requests.

Configuration (wrangler.jsonc)

The schedule is pre-configured in wrangler.jsonc:

"triggers": {
  "crons": ["*/5 * * * *"] // Runs every 5 minutes on Cloudflare Edge
}

Manual Trigger / External Webhook (Optional)

You can also trigger the endpoint manually or via any webhook service:

  • Endpoint: POST https://your-domain.workers.dev/api/check-reminders
  • Header: Authorization: Bearer <CRON_SECRET>

πŸ“± Progressive Web App (PWA) Installation

Checkpoint is a full-featured Progressive Web App. You can install it on your device for an app-like experience with offline capabilities:

  • iOS (Safari):
    1. Open your deployed URL in Safari.
    2. Tap the Share button (box with upward arrow).
    3. Scroll down and select Add to Home Screen.
  • Android (Chrome / Brave / Edge):
    1. Open the URL in your browser.
    2. Tap the menu (three dots) or click the Install Checkpoint banner.
    3. Select Install.
  • Desktop (Chrome / Edge / macOS / Windows):
    1. Click the Install icon on the right side of the browser URL bar.
    2. Checkpoint will run in its own dedicated, chromeless window.

πŸ”‘ Environment Variables Reference

Variable Description Required Default / Example
AUTH_USERNAME Admin login username Yes admin
AUTH_PASSWORD_HASH Bcrypt hash of the login password Yes $2b$10$...
SESSION_SECRET Cryptographic secret for signing JWT session cookies Yes 32-byte hex string
CRON_SECRET Bearer token for triggering /api/check-reminders Yes 32-byte hex string
SMSIR_API_KEY API Key from your SMS.ir developer console Yes String key
SMSIR_LINE_NUMBER Sender line number for SMS dispatch Optional 3000... (auto-detected if omitted)
NEXTJS_ENV Environment indicator Optional development / production

πŸ“‚ Project Structure

checkpoint/
β”œβ”€β”€ drizzle/                    # SQL migrations managed by Drizzle Kit
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ favicon.ico             # Multi-resolution favicon (16/32/48)
β”‚   β”œβ”€β”€ favicon.svg             # Scalable modern checkmark SVG
β”‚   β”œβ”€β”€ manifest.json           # PWA Web App Manifest
β”‚   β”œβ”€β”€ offline.html            # Bilingual offline fallback page
β”‚   β”œβ”€β”€ sw.js                   # Google Workbox 7.3 Service Worker
β”‚   └── icons/                  # 192x192, 512x512, maskable, apple-touch icons
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ [locale]/           # Localized Next.js App Router pages
β”‚   β”‚   β”‚   β”œβ”€β”€ goals/          # Goal listing & creation views
β”‚   β”‚   β”‚   β”œβ”€β”€ history/        # SMS delivery history log
β”‚   β”‚   β”‚   β”œβ”€β”€ login/          # Secure admin login form
β”‚   β”‚   β”‚   β”œβ”€β”€ settings/       # Calendar & default mobile settings
β”‚   β”‚   β”‚   β”œβ”€β”€ layout.tsx      # Root localized layout with PWA metadata
β”‚   β”‚   β”‚   └── page.tsx        # Dashboard with active checkpoints & statistics
β”‚   β”‚   └── api/                # Edge API routes (goals, reminders, auth, cron)
β”‚   β”œβ”€β”€ components/             # Reusable UI components & native date pickers
β”‚   β”œβ”€β”€ db/                     # D1 client connection & Drizzle schema
β”‚   β”œβ”€β”€ i18n/                   # next-intl configuration & English/Persian routing
β”‚   β”œβ”€β”€ lib/                    # SMS.ir client, Tehran time utilities, session auth
β”‚   └── middleware.ts           # Next.js proxy & edge session guard
β”œβ”€β”€ wrangler.jsonc              # Cloudflare Workers & D1 database bindings
β”œβ”€β”€ next.config.ts              # Next.js configuration
└── package.json

πŸ›‘οΈ License

This project is open-source and available under the MIT License.

About

Edge-native personal goal tracker with automated SMS reminders, dual Gregorian & Jalali calendars, and offline PWA support. Built with Next.js 16 on Cloudflare Workers & D1.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages