Autonomous Execution

© 2026 HY13dev™. All Rights Reserved.
Get in touch
HY13dev Logo
Home
Home
Projects Icon
ProjectsProjects
Education Icon
EducationEducation
Experience Icon
ExperienceExperience
Contact Icon
ContactContact
YlyaBot Icon
YlyaBotYlyaBot
Ylya Martchenko
2026
Back to Projects
Full Stack Developer•Senior Software Engineer•Next.js & React Expert•GenAI & RAG Systems Engineer•Full Stack Developer•Senior Software Engineer•Next.js & React Expert•GenAI & RAG Systems Engineer•

Passkey & Magic Link Authentication Template

Lead Full-Stack Security & Infrastructure EngineerProduction-Ready Template / Production
Live Sync

Premium passwordless auth template with Passkeys (WebAuthn) & Magic Links. Powered by Next.js 16 (PPR), React 19, Prisma, Tailwind CSS v4, and Upstash

Project Overview

An ultra-premium, production-ready, passwordless authentication template built on Next.js 16, React 19, Prisma, Tailwind CSS v4, and WebAuthn (SimpleWebAuthn). The project features a robust, innovative dual-architecture design allowing developer configurations to toggle seamlessly between Serverless Mode (direct PostgreSQL Prisma querying, @simplewebauthn/server cryptographic challenge generation, and direct Resend email dispatching) and a Dedicated Backend Client Mode (acting as a lightweight UI gateway delegating core auth, session token operations, and cryptography to an external API server). It adheres to bleeding-edge security standards with Upstash Redis rate limiting, secure staging environment password gating via Next.js 16 network-boundary proxying (proxy.ts), custom dynamic theme modules using light/dark glassmorphic UI (liquid-glass), dynamic translation orchestration (next-intl), and modern React 19 UI state synchronization (leveraging useActionState and useOptimistic).

View on GitHubOpen Live Demo

Specifications

  • My RoleLead Full-Stack Security & Infrastructure Engineer
  • Development PhaseProduction-Ready Template / Production
  • Languages
    TypeScriptJavaScriptSQLHTMLCSS
  • Tools & Frameworks
    Next.js 16 (Turbopack)React 19Prisma ORMTailwind CSS v4SimpleWebAuthn (WebAuthn)Upstash Redis

Execution Latency

Sub-50ms cryptographic challenge verification and token generation in Serverless Mode, with under 5ms rate-limiting checks via Upstash Redis.

UI Performance

100/100 Lighthouse Performance score with 0ms blocking time and instant response on form actions using React 19 useOptimistic UI updates.

Operational Cost

$0/month runtime operations using free-tier Vercel Postgres, Neon DB pooling, Upstash Redis, and Mailpit local email simulation.

Engineering Highlights & Achievements

1

Dual-Architecture Boundary Toggle: Engineered a dual-mode integration powered by NEXT_PUBLIC_SERVERLESS env, dynamically routing all database, session, and email operations either serverlessly through Prisma/Resend/WebAuthn-server or via API proxying to an external backend using a robust fetchApi client.

2

Next.js 16 Network Boundary & Proxy Pattern: Implemented a highly optimized proxy.ts boundary to handle dynamic sub-path locale routing, HTTP-only session token verification, and developer-staging gate password protection (auth-testing-mode) with minimal execution latency.

3

React 19 Zero-Latency Optimistic Operations: Leveraged React 19's native compiler and useOptimistic hook to trigger immediate client-side credential listings on passkey addition, rename, or deletion, implementing elegant rollbacks and Sonner alerts if the background Server Action fails validation.

4

Cryptographically Secure WebAuthn Handshake: Configured deep WebAuthn flows with @simplewebauthn/browser and @simplewebauthn/server, supporting platform-attached key selection, signature verifications, and custom user-verifications with cryptographically hashed challenges stored in PostgreSQL.

Engineering Challenges (STAR Method)

Exhaustive situation-action-result breakdowns showcasing problem-solving and architectural execution.

CHALLENGE 1

Situation & Impediment

Standard authentication templates suffer from heavy middleware overhead, bloated client bundles, and weak access-control protections for staging/development builds.

Engineering Action

Leveraged Next.js 16's strict network boundary pattern, replacing legacy middleware.ts with a lightweight proxy.ts router. Developed a secure password-gating shield (auth-testing-mode) that verifies credentials and sets HTTP-only cookies entirely at the proxy edge before any heavy client assets are downloaded.

Architectural Deep Dive

Low-level component relationships, system boundaries, and runtime flows.

The template sits behind a highly efficient Next.js 16 Proxy Network Boundary (implemented in proxy.ts) which intercepts all incoming requests to perform locale negotiation (using preferred_locale cookies and headers) and staging access validation. In Serverless Mode (NEXT_PUBLIC_SERVERLESS=true), the app operates as a self-contained monorepo: Next.js Server Actions ('use server') invoke Prisma ORM to communicate with PostgreSQL (configured with pooled connections for fast reads and direct connections for migrations), verify cryptographic WebAuthn credentials via @simplewebauthn/server, and trigger emails using Resend. In Dedicated Backend Client Mode (NEXT_PUBLIC_SERVERLESS=false), the serverless backend layers are completely bypassed; instead, Server Actions function as secure gateway orchestrators, forwarding proxy-session cookie headers and delegating all core authentication transactions to a remote API server using a centralized fetchApi client. React 19's native compiler and <Suspense> streaming isolates dynamic database checks and cookie-dependent components, allowing the static parts of pages to prerender instantly as HTML shells.

Lessons Learned & Core Takeaways

Architecting this cutting-edge Next.js 16 and React 19 passwordless authentication template proved the immense power of the modern Network Boundary (proxy.ts) pattern. Moving heavy database and cryptographic operations out of the routing layer and into dedicated Server Actions ensures a highly performant, predictable routing architecture. Furthermore, adopting the React 19 Compiler and native state reducers like useOptimistic demonstrated that we can eliminate traditional state management libraries and complex memoization logic (useMemo/useCallback) entirely, achieving instant, beautiful, and fluid interfaces with absolute type safety and maximum clean code.

Live Interactive Preview

Rendered live in real-time. Direct URL: /

If the preview remains blank, the site's security policies may restrict iframe embedding. Open the link directly instead.
/
PostgreSQL
next-intl (i18n)
Resend API
Zod
Mailpit
Framer Motion
  • Stars0
  • Forks0
  • Last Updated5/25/2026
  • 5

    Rate Limiting & Maintenance Automations: Guarded Server Actions with Upstash Redis Token Bucket rate limiting and established a daily db-ping cron endpoint (/api/cron) to keep Neon Postgres and Upstash instances warm, while automatically purging unconfirmed magic-link signups.

    Quantifiable Result

    Reduced routing overhead to under 10ms, kept the staging shield fully insulated, and ensured zero leakage of proprietary features without loading client-side packages.

    CHALLENGE 2

    Situation & Impediment

    Passkey registration, renaming, and deletion involve complex, multi-step cryptographic verification and database transactions that traditionally result in sluggish UI responses and poor user experiences.

    Engineering Action

    Adopted React 19's native useOptimistic state reducer and useActionState inside Server Action forms. Designed the passkey management component to immediately reflect key modifications on the UI, utilizing seamless background synchronization that automatically rolls back and raises localized Sonner toasts if the cryptographic verify action encounters a failure.

    Quantifiable Result

    Eliminated all user-perceived network latency, creating a highly responsive and fluid passwordless authentication experience with robust error-recovery.

    CHALLENGE 3

    Situation & Impediment

    Deploying serverless authentication architectures on standard free-tier plans often results in frustrating Neon PostgreSQL cold starts after periods of inactivity, alongside database pollution from aborted user magic-link signups.

    Engineering Action

    Designed a secured API cron routing mechanism (/api/cron) guarded by dynamic authorization headers and an automated daily GitHub Actions runner. The script pings database endpoints to keep connections warm and runs a transactional DB purge, deleting uncompleted signups created more than 24 hours prior.

    Quantifiable Result

    Completely eliminated Neon DB cold starts, keeping active queries warm, and automated 100% of inactive data cleanup, maintaining a lean and high-performance database schema.