| Feature | jose |
jsonwebtoken |
|---|---|---|
| TypeScript Support | ✅ Native | ☑️ Partial |
| ESM Support | ✅ Yes | ❌ No |
| Browser Compatibility | ✅ Yes | ❌ No |
| Algorithm Support | ✅ Broad (EdDSA, ES, PS, etc.) | |
| Maintenance | ✅ Active (Panva) | 💤 Slow |
| Crypto Security | ✅ Uses native Web Crypto API | |
| API Style | ✅ Promise-based, functional | ❌ Callback/Sync |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.8" | |
| services: | |
| kafka: | |
| image: apache/kafka:4.0.1-rc2 | |
| container_name: kafka | |
| ports: | |
| - "9092:9092" | |
| environment: | |
| CLUSTER_ID: mkqv8X5vRla7PzR8bKqfHk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3.8' | |
| services: | |
| elasticsearch: | |
| image: docker.elastic.co/elasticsearch/elasticsearch:9.0.3 | |
| container_name: elasticsearch | |
| environment: | |
| - node.name=es-node | |
| - discovery.type=single-node | |
| - cluster.name=es-cluster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function setupProcessHandlers(options?: { | |
| exitOnError?: boolean; | |
| onError?: (type: 'uncaughtException' | 'unhandledRejection', error: any) => void; | |
| }) { | |
| const exit = options?.exitOnError ?? true; | |
| const onError = options?.onError; | |
| process.on('uncaughtException', (err) => { | |
| console.error('[🔥 Uncaught Exception]:', err); | |
| onError?.('uncaughtException', err); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { safeIncrWithTTL } from "#app/common/helpers/redis"; | |
| import { unwrap } from "#app/config/db/global"; | |
| import type { MultiExecResult } from "#app/config/db/redis.config"; | |
| import { redis } from "#app/config/db/redis.config"; | |
| import { logger } from "../logger.util"; | |
| const FAILURE_PREFIX = "recaptcha:fail:ip-"; | |
| const THRESHOLD = 5; // max allowed failures | |
| const WINDOW_SEC = 60 * 60; // rolling window for failures (1h) | |
| const BLOCK_PREFIX = "recaptcha:block:ip-"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import mongoose from 'mongoose'; | |
| import type { Mongoose } from 'mongoose'; | |
| import { CONFIG } from '#app/config'; | |
| import CircuitBreaker from 'opossum'; | |
| import { logger } from '#app/common/utils/logger.util'; | |
| export const MONGO_STATE_MAP: Record<number, string> = { | |
| 0: 'DISCONNECTED', | |
| 1: 'CONNECTED', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Redis from 'ioredis'; | |
| import CircuitBreaker from 'opossum'; | |
| import { logger } from '#app/common/utils/logger.util'; | |
| import { CONFIG } from '..'; | |
| export const REDIS_STATE_MAP: Record<number, string> = { | |
| 0: 'DISCONNECTED', | |
| 1: 'CONNECTED', | |
| } as const; |
| Criterion | csurf | HMAC Double-Submit (Ours) |
|---|---|---|
| State | Stateful (session store needed) | Stateless (no DB/cache) |
| Testability | Harder to test middleware + sessions | Pure functions + small middlewares |
| Microservices-ready | Requires shared session backend | Easy to drop into any service |
| Framework lock-in | Express-only | Copy-paste core logic anywhere |
| Strategy | How It Works | Pros | Cons |
|---|---|---|---|
| Accept Header | Accept: application/vnd.myapp.v1+json |
Follows HTTP spec; cache-friendly | Clients must set correct MIME type |
| Custom Header | X-API-Version: 2 |
Explicit, easy to read | Non-standard header |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createGzip, createDeflate, createBrotliCompress } from 'zlib'; | |
| function getKeyWithHighestQ(obj) { | |
| let [highestKey , highestQ ] = [null , -1] | |
| for (const [encoding, qualiltyString] of Object.entries(obj)) { | |
| if(!qualiltyString || qualiltyString.trim().length == 0) continue; | |
| let [qualityKeyName , qualityValue] = qualiltyString.split('='); |
NewerOlder