Skip to content
KortzLabPublic

About

A dark, atmospheric, heavily animated digital notebook inspired by the concept of Death Note.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

27 Commits

Folders and files

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

Repository files navigation

Death Note β€” an unofficial, cinematic notebook

DEATH NOTE

Every name is a door. Some only open once.

Next.js TypeScript PostgreSQL Three.js GSAP Tailwind CSS
License: MIT Last commit Stars CI

Live Demo Β· h4sib.pro Β· kortzlab.pro Β· Discord: kirawth Β· Social: hasibwth


A dark, atmospheric, heavily animated digital notebook inspired by the concept of Death Note. Styled in stark, rainy black and white with gothic cathedral light; red appears only where it matters: apples, shinigami eyes and the last seconds before the ink sets. Open the cursed book, read its rules, and write in ink. Everything you see is original: the notebook, the shinigami, the rules, the cathedral backdrop, the sounds (synthesised in your browser) and the effects.

Note

Unofficial fan project. Not affiliated with the creators or publishers of Death Note. For fiction and fun only. Don't use this to threaten or harass real people.

🎬 Preview

The notebook falls The cover opens, pages curl
The notebook lying in the ash after its fall The open 3D notebook, a page curling as it turns
Writing in ink, with the 40-second ring The rules write themselves as you scroll
Handwritten names in the notebook with countdown rings and a candle A rule being revealed word by word
Sponsor modal (70% to charity) Mobile (CSS fallback)
Sponsor modal with amount chips and the live charity split The lightweight intro on a phone
Recording the GIFs (intro fall, page flip, ink writing, sponsor modal)

Animated previews are best recorded by hand. Placeholders to fill in:

  • .github/assets/gifs/intro-fall.gif β€” load /, wait for the book to land and open it
  • .github/assets/gifs/page-flip.gif β€” on /notebook, drag a page corner slowly
  • .github/assets/gifs/ink-writing.gif β€” type a name and let the 40-second ring finish
  • .github/assets/gifs/sponsor-modal.gif β€” open the wax seal, pick chips and a custom amount

On Windows: press Win+Alt+R (Xbox Game Bar) or use ScreenToGif at 30 fps, 1280Γ—720, then keep each GIF under ~8 MB. Turn sound on in the header first if you also record video.

✨ Features

  • Cinematic intro (WebGL) β€” drifting ash and embers, the notebook falls in slow motion, lands with a camera shake and a dust burst, tilts toward your cursor with light sliding over the leather. An etched gothic title flickers like embers. Click or drag to open the heavy cover.
  • A real-feeling book β€” 3D pages that curl as they turn (vertex-shader bending), plus a DOM flip-book for writing with drag/swipe, edge buttons, ← β†’ and the mouse wheel, bending shadows, aged paper, stains, a swaying ribbon bookmark, contents page and handwritten page numbers.
  • Writing in ink β€” every typed character bleeds onto the page; a 40-second ring starts after a name is written, then a red flash, a heartbeat, and the ink sets darker. Ink drips, a candle that flickers harder when you type fast, and wind lifting the page when idle.
  • Shinigami presence β€” an original silhouette appears behind the book now and then, its eyes following your cursor. Whispers fade in at the margins. A hidden apple opens a secret page, and the Konami code unlocks Shinigami Eyes.
  • Guests write immediately (localStorage). Signed-in users (e-mail and password) sync to PostgreSQL with debounced autosave, a "saved" ink stamp and a one-click import of guest notes. Search, edit, delete, export a page as PNG or PDF, or share an image with names blurred.
  • The Open Book β€” one public notebook everyone can write in, no sign-in needed. Unlimited pages (loaded a chapter at a time), autosaved on write, live "new names" updates, pen names, page jumps and a random page. Authors can withdraw their own entries.
  • Shared pages β€” share any note from your notebook or the Open Book. It gets its own page (/n/<id>) with a generated preview image and shows up on the home page. Owners can unshare.
  • Candles & reports β€” light a candle for a page (one per person), or report it. Three reports from different people hide an item until a moderator reviews it in /admin.
  • Privacy & safety β€” your own notebook stays private; public content goes through the same content guard (threats, slurs, personal data), strict rate limits, and IPs are only ever stored as salted hashes.
  • Sponsor with crypto (OxaPay) β€” recommended chips and a custom amount, a live "70% goes to charity" split, verified webhooks only, a themed return page and an opt-in supporters page.
  • Accessible & fast β€” reduced-motion version with fades only, lazy-loaded 3D with an ink loading bar, 2D fallback for weak or missing WebGL, keyboard navigation and ARIA labels. Lighthouse (desktop): Accessibility 100, Performance 92–99.

🧰 Tech Stack

Layer Choice
Framework Next.js 16 (App Router), React 19, TypeScript 6 (strict)
Styling Tailwind CSS 4, self-hosted OFL fonts (UnifrakturCook, IM Fell English, Caveat, Homemade Apple)
Animation GSAP 3 + ScrollTrigger, Motion (Framer Motion), CSS 3D
3D Three.js via @react-three/fiber and @react-three/drei
Data PostgreSQL 16 + Prisma 7 (driver adapter @prisma/adapter-pg)
Auth Auth.js v5 (e-mail/password with argon2id)
Validation Zod 4 on the client and the server
Sound Howler.js playing sounds synthesised at runtime (no audio files)
Payments OxaPay v1 invoices and HMAC-SHA512 callbacks
Tests Vitest (unit), Playwright (end-to-end)

Deviations from the original brief: Auth.js v5 is still published as a beta tag but is the App Router-native version; TypeScript 6 is used instead of 7 because tooling around Next.js still relies on the JavaScript compiler API; Motion is the current name of Framer Motion.

πŸ›οΈ Architecture

flowchart LR
  subgraph Browser
    UI[Next.js pages<br/>React 19] --> FX[GSAP Β· Motion Β· R3F/Three.js]
    UI --> LS[(localStorage<br/>guest notes)]
    UI --> SND[Howler<br/>synth sounds]
  end

  subgraph Server[Next.js server]
    API[/Route handlers<br/>Zod Β· CSRF Β· rate limit/]
    AUTH[Auth.js]
    WH[/OxaPay webhook<br/>HMAC verify Β· idempotent/]
  end

  DB[(PostgreSQL<br/>Prisma)]
  OXA[OxaPay API]

  UI -- notes, sponsor --> API
  UI -- sign in --> AUTH
  API --> DB
  AUTH --> DB
  API -- create invoice --> OXA
  OXA -- payer pays --> OXA
  OXA -- signed callback --> WH --> DB
  UI -. redirect .-> OXA
  OXA -. return_url .-> UI
Loading
Payment flow in detail
  1. The modal validates the amount with Zod and calls POST /api/sponsor.
  2. The server validates again, stores a sponsorships row with status pending, then calls POST https://api.oxapay.com/v1/payment/invoice with amount, currency: USD, order_id, callback_url, return_url and a description. The key is sent in the merchant_api_key header.
  3. The browser is redirected to the returned payment_url.
  4. OxaPay calls /api/webhooks/oxapay. The route verifies the HMAC header (HMAC-SHA512 of the raw body with the merchant key), stores the delivery in webhook_events keyed by a SHA-256 of the body (duplicates are ignored), checks the amount, and moves the status forward only (pending β†’ paying β†’ paid, paid β†’ refunded; never backwards).
  5. /sponsor/return only reads the stored status. The return URL never marks anything as paid.

πŸš€ Getting Started (Windows / PowerShell first)

Requirements: Node.js 20.9+ (22 LTS recommended), Docker Desktop, Git.

git clone https://github.com/KortzLab/DeathNote.git
cd DeathNote
npm install

Start PostgreSQL in Docker:

npm run db:up

Create your .env from the example and fill it in (see the table below):

Copy-Item .env.example .env

A minimal local .env:

NEXT_PUBLIC_SITE_URL=http://localhost:3000
DATABASE_URL=postgresql://deathnote:deathnote@localhost:5432/deathnote?schema=public
AUTH_SECRET=<generate one: npx auth secret>
AUTH_TRUST_HOST=true

Run the migrations, seed demo data and start the dev server:

npm run db:migrate
npm run db:seed
npm run dev

Open http://localhost:3000. The seed prints a demo account (demo@deathnote.local) with a fresh random password each time it runs.

On macOS/Linux the same npm scripts work; use cp .env.example .env instead of Copy-Item.

Useful scripts
Script What it does
npm run dev Development server
npm run build / npm start Production build / server
npm run lint Β· npm run typecheck Β· npm run format Quality checks
npm test Unit tests (Vitest)
npm run test:e2e End-to-end tests (Playwright)
npm run db:up / db:down Start / stop Postgres in Docker
npm run db:migrate Β· db:deploy Β· db:seed Β· db:studio Prisma
npm run webhook:test -- <order_id> [status] Send a signed test callback to your local server
npm run seed:public Add 15 sample Open Book entries and 10 shared pages (safe to re-run, works in production)

πŸ” Environment Variables

Names and descriptions only. Never commit real values; .env is ignored by git.

Variable Required Description
NEXT_PUBLIC_SITE_URL βœ… Public URL of the site, used for callbacks, OG tags and the sitemap
GOOGLE_SITE_VERIFICATION ⬜ Google Search Console verification code (meta tag content)
BING_SITE_VERIFICATION ⬜ Bing Webmaster Tools verification code (msvalidate.01 content)
DATABASE_URL βœ… PostgreSQL connection string
AUTH_SECRET βœ… Secret used by Auth.js to sign sessions (npx auth secret)
AUTH_TRUST_HOST ⬜ true when running behind a proxy or on a VPS
ADMIN_EMAILS ⬜ Comma-separated admin e-mails (see Admin access below)
OXAPAY_ENABLED ⬜ true to show the sponsor buttons and accept payments
OXAPAY_MERCHANT_API_KEY ⬜ OxaPay merchant key (server only, never logged or sent to the client)

OXAPAY_ENABLED and the two *_SITE_VERIFICATION codes are read when pages are built, so redeploy after changing them.

πŸ›‘οΈ Admin access

/admin holds the sponsorship ledger and the moderation queue. An account is an admin only when both are true: its e-mail is in ADMIN_EMAILS, and it was created on the server with the admin script. The site's own sign-up refuses admin e-mails, so nobody can claim yours first.

  1. Put your e-mail in ADMIN_EMAILS on the server and redeploy (or restart).

  2. On the server, with the production DATABASE_URL and ADMIN_EMAILS in the environment, run:

    npm run admin:create -- you@example.com

    Type a unique password (8+ characters) at the hidden prompt. Running it again resets the password and signs out every earlier admin session.

  3. Open /signin, sign in with that e-mail and password, then visit /admin.

Admin rights last 12 hours after you sign in; after that /admin asks you to sign in again (your notebook session is unaffected). Anyone else, signed in or not, gets a plain 404.

πŸ—„οΈ Database & Migrations

Tables: users, accounts, sessions, verification_tokens (Auth.js), notebooks, pages, notes (soft delete, indexed by owner/page/name), sponsorships (amounts in cents, charity share, status, OxaPay track id), webhook_events (idempotency + audit) and rate_limits.

npm run db:migrate          # create/apply migrations in development
npm run db:deploy           # apply migrations in production
npm run db:seed             # demo data (refuses to run with NODE_ENV=production)
npm run db:studio           # browse the data

The schema lives in prisma/schema.prisma; configuration in prisma.config.ts.

πŸ§ͺ Testing

npm test            # unit: validation, content guard, amounts, webhook signature, status transitions
npm run test:e2e    # e2e: guest writes β†’ refresh β†’ still there; sponsor modal amount selection

The first e2e run needs a browser: npx playwright install chromium. The sponsor test runs when OXAPAY_ENABLED=true (no payment is ever created by the tests).

Testing the OxaPay webhook locally (tunnel)

OxaPay must reach your machine, so expose port 3000 with a tunnel:

# Option A: Cloudflare Tunnel (winget install Cloudflare.cloudflared)
cloudflared tunnel --url http://localhost:3000

# Option B: ngrok (winget install ngrok.ngrok)
ngrok http 3000
  1. Set NEXT_PUBLIC_SITE_URL in .env to the tunnel URL (for example https://random-words.trycloudflare.com), set OXAPAY_ENABLED=true and your OXAPAY_MERCHANT_API_KEY, then restart npm run dev.

  2. Open the sponsor modal through the tunnel URL and create an invoice. The callback URL sent to OxaPay is <NEXT_PUBLIC_SITE_URL>/api/webhooks/oxapay.

  3. Without a real payment, simulate one: copy the order_id from /admin or Prisma Studio and run

    npm run webhook:test -- dn_xxxxxxxxxxxxxxxx Paid

    The script signs the body with your local key exactly like OxaPay does.

☁️ Deployment

Vercel + managed Postgres (Neon, Supabase, Railway…)
  1. Create a Postgres database and copy its connection string.
  2. Import the repository in Vercel. Add every variable from the table above in Settings β†’ Environment Variables (NEXT_PUBLIC_SITE_URL = your production URL).
  3. Set the build command to npx prisma migrate deploy && next build (or run npm run db:deploy once from your machine against the production database).
  4. Set the OxaPay callback domain in your OxaPay merchant settings if required.
  5. Deploy, then create the admin account (see Admin access above).
VPS (Node 22 + reverse proxy)
git clone https://github.com/KortzLab/DeathNote.git && cd DeathNote
npm ci
cp .env.example .env   # fill in production values, AUTH_TRUST_HOST=true
npm run db:deploy
npm run build
npm start              # listens on :3000; run it with pm2 or a systemd service

Put Caddy or Nginx in front for HTTPS. Keep .env readable only by the service user.

πŸ—‚οΈ Project Structure

Show the tree
.
β”œβ”€β”€ .github/                 # CI, issue/PR templates, funding, README assets
β”œβ”€β”€ prisma/                  # schema, migrations, seed
β”œβ”€β”€ scripts/                 # send-test-webhook.ts
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                 # routes (App Router)
β”‚   β”‚   β”œβ”€β”€ api/             # notes, public, shares, reports, candles, sponsor, webhooks/oxapay, auth
β”‚   β”‚   β”œβ”€β”€ notebook/        # the private writing experience
β”‚   β”‚   β”œβ”€β”€ public/          # the Open Book
β”‚   β”‚   β”œβ”€β”€ n/[id]/          # a shared page and its preview image
β”‚   β”‚   β”œβ”€β”€ rules/           # scroll-driven rules
β”‚   β”‚   β”œβ”€β”€ supporters/  sponsor/return/  admin/
β”‚   β”‚   β”œβ”€β”€ about/  privacy/  terms/  secret/  signin/
β”‚   β”‚   β”œβ”€β”€ opengraph-image.tsx  sitemap.ts  robots.ts  icon.svg
β”‚   β”‚   └── layout.tsx  globals.css  not-found.tsx
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ three/           # IntroScene, page-curl material, particles, textures
β”‚   β”‚   β”œβ”€β”€ intro/           # 3D/2D/calm intro, ink loader
β”‚   β”‚   β”œβ”€β”€ notebook/        # FlipBook, InkText, CountdownRing, Candle, pages
β”‚   β”‚   β”œβ”€β”€ fx/              # quill cursor, shinigami, whispers, Konami, apple
β”‚   β”‚   β”œβ”€β”€ sponsor/         # modal, triggers, return page
β”‚   β”‚   β”œβ”€β”€ public/          # Open Book, share/report dialogs, paper cards
β”‚   β”‚   β”œβ”€β”€ home/            # home page feed
β”‚   β”‚   └── layout/ ui/ providers/ rules/ auth/
β”‚   β”œβ”€β”€ content/rules.ts     # the 18 original rules
β”‚   β”œβ”€β”€ lib/                 # validation, content guard, oxapay, server helpers, hooks, sound
β”‚   └── auth.ts              # Auth.js configuration
└── tests/                   # unit (Vitest) and e2e (Playwright)

πŸ—ΊοΈ Roadmap

  • 3D intro with falling notebook, ash and page curl
  • Ink writing, 40-second ring, guest + account notes
  • Scroll-written rules, easter eggs, procedural sound
  • OxaPay sponsorships with verified webhooks
  • Second language for the rules (structure ready)
  • Recorded GIFs for the README
  • Account deletion from the UI
  • More notebook covers and paper styles
  • Public Open Book and shareable pages with candles, reports and moderation

🀝 Contributing

Issues and pull requests are welcome. Please read CONTRIBUTING.md and the Code of Conduct. Security issues go through SECURITY.md, not public issues.

🍎 Sponsor

This site is free. If it made your day a little darker (in a good way), consider a small contribution through the sponsor button on the site.

From this sponsor amount, 70% will go to charity.

πŸ“œ License

MIT Β© h4sib.pro. The license covers this project's original code and assets. "Death Note" is a trademark of its respective owners.

⚠️ Disclaimer

Unofficial fan project. Not affiliated with the creators or publishers of Death Note. No official artwork, logos, characters, fonts or rule text are used. For fiction and fun only. Don't use this to threaten or harass real people.


Built by h4sib.pro Β· Powered by kortzlab.pro

About

A dark, atmospheric, heavily animated digital notebook inspired by the concept of Death Note.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages