Goal: Migrate the legacy Express/Raw-SQL codebase to a high-performance, type-safe stack.
-
Server Migration (Fastify):
- Replace Express with Fastify to increase throughput and reduce overhead.
- Integrate fastify-type-provider-zod to leverage existing Zod schemas for automatic serialization and Swagger documentation generation.
-
Database Layer (Drizzle ORM):
- Migrate from Raw SQL/Knex to Drizzle ORM.
- Action: Define strict schemas for all existing tables (users, refresh_tokens,
visitors).
- Action: Implement the missing security tables required for the TORT flow:
- totp_secrets (for RFC 6238 secrets).
- recovery_codes (hashed storage for emergency access).
-
Bundling Strategy:
-
Implement tsup for building the service into a lightweight, tree-shakable Node.js
executable.
Goal: Migrate the legacy Express/Raw-SQL codebase to a high-performance, type-safe stack.
Server Migration (Fastify):
Database Layer (Drizzle ORM):
visitors).
- totp_secrets (for RFC 6238 secrets).
- recovery_codes (hashed storage for emergency access).
Bundling Strategy:
Implement tsup for building the service into a lightweight, tree-shakable Node.js
executable.