passkeyd

Overview

Passkeyd is a standard Next.js Typescript application. Tested and verified on Node 21.

Tech stack

  1. Next.js the full stack React framework. This project uses App router and Server actions.
  2. Prisma is an ORM for database access and handling migrations.
  3. SimpleWebAuthN is a Fido conformant client and server library for WebAuthN

Folder structure

File tree below lists the location of the most important files and folders

passkeyd
│   # (The Client) Next.js app router root 
├── app
│   │   # client components (_ prefix to escape file based routing)
│   ├── _components
│   │   │   # Contains all passkeyd related components
│   │   └── auth
│   │   # Account page (logged in)
│   ├── account
│   │   # html,body,header etc.
│   ├── layout.tsx
│   │   # JWT auth middleware
│   ├── middleware.tsx
│   │   # Landing page
│   └── page.tsx
│   # Prisma schema, migrations folder and client re-export.
├── prisma
│   # (The Backend)
└── server
    │   # Server actions
    ├── actions
    │   │   # All webauthn specific server endpoints
    │   ├── webauthn
    │   │   ├── challenge.tsx
    │   │   ├── credential.tsx
    │   │   ├── login.tsx
    │   │   ├── recovery.tsx
    │   │   └── register.tsx 
    │   │   # Request recovery email
    │   ├── email.tsx
    │   │   # Access current session and logout actions
    │   └── session.tsx
    │   # Database queries and mutations
    ├── db
    │   # Recovery helper functions
    ├── recovery.ts
    │   # Session helper functions
    └── session.ts