出品者:Arno L.

RedwoodJS is an opinionated, full-stack TypeScript/JavaScript framework combining React, GraphQL, and Prisma for building data-driven web applications. Supports serverless and traditional deployments with built-in auth, testing, and CLI code generators.
This block provides the server-side API utilities from the RedwoodJS framework, covering authentication parsing, webhook verification, structured logging via Pino, caching (Redis/Memcached/in-memory), CORS configuration, and event normalization. It targets Node.js/TypeScript backend teams that want production-ready GraphQL or REST API infrastructure without adopting the full Redwood CLI.
adapters/ - Fastify web adapter helpers for serving Redwood appsapi/ - Core API utilities: auth, logging, caching, webhooks, validation, CORS, errorsapi-server/ - HTTP server wrappers for the API sideauth/ - Auth middleware and provider integrationsauth-providers/ - Concrete auth provider implementations (dbAuth, supabase, etc.)babel-config/ - Shared Babel configuration for transpilationcli/ - Redwood CLI entry pointscli-helpers/ - Utilities consumed by CLI commandscli-packages/ - Additional CLI plugin packagescodemods/ - AST-based code migration scriptscontext/ - Per-request async context storecookie-jar/ - Cookie parsing and serialization helperscore/ - Project-level configuration types and resolversgraphql-server/ - Envelop-powered GraphQL server setupinternal/ - Internal tooling utilities shared across packagesjobs/ - Background job queue utilitiesmailer/ - Email sending abstractionsrouter/ - File-based router (server + client)testing/ - Test helpers and mock factoriesvite/ - Vite plugin for Redwood projectsweb/ - Client-side web utilities and componentsnpm install pino cookie aws-lambda @prisma/client
npm install --save-dev @types/aws-lambda @types/node typescript
No native modules, no pod install, no prebuild steps required. The cache sub-module requires one of:
npm install memjs # for MemcachedClient
npm install ioredis # for RedisClient
隔離されたサンドボックスを起動しサーバー側で実行 — ローカル設定不要。
このバージョンの Tetrees AI Review
This Express backend / api completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
パイプライン avcp-2026-08-04.1 · SHA-256 c7e2a737d5ae08a3…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
レビュー日 2026年8月4日
この製品をお使いのAI IDE・Webビルダー・クラウドIDEに直接取り込みます。
Tetreesを対応AI IDEに接続し、所有製品の一覧取得と検証済みZIPの取得を、販売者のアップロード権限を公開せずに行えます。
まだレビューがありません。
Sign in to join the discussion
Loading discussion…
Copy the source/ directory into your project root, e.g. vendor/redwood/.
Add path aliases to tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@rwapi/*": ["vendor/redwood/api/src/*"]
},
"module": "CommonJS",
"target": "ES2020",
"esModuleInterop": true,
"resolveJsonModule": true
}
}
NODE_ENV=production # controls logger pretty-printing
REDWOOD_ENV_PREFIX= # optional prefix for env injection
api/src entry point or sub-paths:import { createLogger, parseAuthorizationHeader, createVerifier } from './vendor/redwood/api/src'
package.json for version exports. Ensure the file exists at vendor/redwood/api/package.json with at minimum a version and dependencies["@prisma/client"] field.AUTH_PROVIDER_HEADERexport const AUTH_PROVIDER_HEADER: 'auth-provider'
The canonical header name used to identify which auth provider signed a request. Use this constant instead of a magic string when reading the header in middleware or tests.
getAuthProviderHeaderexport const getAuthProviderHeader = (
event: APIGatewayProxyEvent | Request,
): string | undefined
Extracts the auth-provider header value from either a Lambda proxy event or a standard Web API Request. Use this in custom auth middleware to branch on provider type (e.g., "dbAuth", "supabase").
parseAuthorizationCookieexport type AuthorizationCookies = {
parsedCookie: Record<string, string | undefined>
rawCookie: string
type: string | undefined
} | null
export const parseAuthorizationCookie = (
event: APIGatewayProxyEvent | Request,
): AuthorizationCookies
Parses the Cookie header and extracts the auth provider type embedded inside it. Returns null for unauthenticated requests. Use in cookie-based session auth flows where the JWT is stored in a cookie rather than the Authorization header.
createVerifierexport const createVerifier = (
type: SupportedVerifierTypes,
options?: VerifyOptions,
): WebhookVerifier
Factory that returns a WebhookVerifier instance for the specified signature scheme. Supported types include sha256Verifier, sha1Verifier, base64Sha256Verifier, jwtVerifier, and secretKeyVerifier. Use this to verify inbound webhook payloads from third-party services.
formatCacheKeyexport const formatCacheKey = (key: CacheKey, prefix?: string): string
Normalizes a string | string[] cache key into a single string, optionally prepending a namespace prefix separated by -. Use before passing keys to any cache client to avoid collision across models or services.
Your Express route receives a POST from GitHub. Verify the X-Hub-Signature-256 header before processing.
import { createVerifier } from './vendor/redwood/api/src/auth/verifiers'
const verifier = createVerifier('sha256Verifier', {
signatureHeader: 'X-Hub-Signature-256',
})
app.post('/webhooks/github', async (req, res) => {
try {
const body = await req.text()
const isValid = verifier.verify({
body,
signature: req.headers['x-hub-signature-256'] as string,
secret: process.env.GITHUB_WEBHOOK_SECRET!,
})
if (!isValid) return res.status(401).send('Bad signature')
// process payload
res.sendStatus(200)
} catch (e) {
res.status(400).send((e as Error).message)
}
})
In an edge middleware that receives a Request object, determine which auth provider the client is using.
import {
getAuthProviderHeader,
parseAuthorizationCookie,
} from './vendor/redwood/api/src/auth'
export async function middleware(request: Request): Promise<Response> {
const provider = getAuthProviderHeader(request)
if (!provider) {
// fall back to cookie-based auth
const cookieAuth = parseAuthorizationCookie(request)
if (!cookieAuth) {
return new Response('Unauthorized', { status: 401 })
}
console.log('Auth via cookie, type:', cookieAuth.type)
} else {
console.log('Auth via header, provider:', provider)
}
return new Response('OK')
}
Wrap an expensive findMany call with a Redis-backed cache using the cache utilities.
import { RedisClient, formatCacheKey } from './vendor/redwood/api/src/cache'
import { createLogger } from './vendor/redwood/api/src/logger'
const logger = createLogger({ name: 'cache-example' })
const redis = new RedisClient(redisConnection, { logger })
async function getProducts(categoryId: number) {
const key = formatCacheKey(['products', String(categoryId)], 'shop')
// key => "shop-products-42"
const cached = await redis.get(key)
if (cached) return JSON.parse(cached)
const products = await db.product.findMany({ where: { categoryId } })
await redis.set(key, JSON.stringify(products), { expires: 300 })
return products
}
api/src/index.ts - Main barrel export; re-exports auth, errors, validations, transforms, CORS, event utilities, and version constants.api/src/auth/index.ts - Auth header/cookie parsing utilities and shared constants like AUTH_PROVIDER_HEADER.api/src/auth/verifiers/ - Individual webhook signature verifiers (SHA1, SHA256, Base64, JWT, secret key) plus the createVerifier factory.api/src/cache/ - Caching abstraction with MemcachedClient, RedisClient, InMemoryClient, key formatting helpers, and timeout error types.api/src/logger/index.ts - Pino-based structured logger with Prisma-compatible log level types and environment detection helpers.api/src/validations/ - Input validation helpers for service functions.api/src/webhooks/ - Higher-level webhook processing helpers built on top of verifiers.api/src/cors.ts - CORS header construction utilities.api/src/errors.ts - Typed error classes for use across the API layer.api/src/event.ts - Normalizes Lambda proxy events and Web Request objects into a unified interface.api/src/transforms.ts - Request/response body transformation helpers.api/src/types.ts - Shared TypeScript types across the API package.require('../package.json') fails at runtime - Ensure vendor/redwood/api/package.json exists and resolveJsonModule: true is set in tsconfig.json.aws-lambda types missing - Install @types/aws-lambda as a dev dependency; it is a pure type package not included by default.NODE_ENV=development and use pino-pretty as a transport: pino({ transport: { target: 'pino-pretty' } }).prefix to formatCacheKey that includes the environment (e.g., prod-users vs staging-users).cookie package ESM/CJS mismatch - Pin cookie to ^0.6.0 and ensure your bundler is configured with esModuleInterop: true; v1.x changed the export shape.createVerifier throws for unknown type - The type argument must exactly match a key in verifierLookup; check api/src/auth/verifiers/common.ts for the exhaustive list before passing dynamic strings.I have the RedwoodJS API package source code in `vendor/redwood/` and a usage guide
at `USAGE.md`. I am building a Node.js/TypeScript Express application.
Please help me integrate the following capabilities step-by-step:
1. Set up the logger from `vendor/redwood/api/src/logger` as the global logger for
my Express app, with Prisma query logging enabled.
2. Add webhook signature verification to my `/webhooks` route using `createVerifier`
from `vendor/redwood/api/src/auth/verifiers`.
3. Add cookie-based auth provider detection middleware using `parseAuthorizationCookie`
and `getAuthProviderHeader` from `vendor/redwood/api/src/auth`.
4. Wire up the Redis cache client from `vendor/redwood/api/src/cache` for caching
database queries, using `formatCacheKey` for all keys.
For each step: show the exact import paths relative to my project root, the code to
add, and any environment variables required. Reference `USAGE.md` for type signatures
and constraints. Do not invent exports that are not documented there.
RedwoodJS is released under the MIT License. See source/LICENSE if present, or refer to the upstream repository at https://github.com/redwoodjs/redwood. The upstream package family is redwoodjs/redwood (packages monorepo).
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
完全なインストールガイドと統合プロンプトは購入後に解放されます。
Automation, Utilities & Developer Tools
無料