CodeVetter · Repo Unpack · Extension points
blitz-js/blitz
The principal extension mechanisms are plugin factories and composition, storage contracts, resolver conventions, and generator subclasses. Applications choose their authentication storage and authorization policy. Bundler options control resolver naming and discovery, while handler callbacks control error reporting and formatting. New scaffolding behavior plugs into an existing lifecycle rather than requiring a separate generator framework.
- Server plugins supply requestMiddlewares, optional contextMiddleware, and exports; reduceBlitzServerPlugins flattens middleware and combines exports.
- Client plugins supply request/response hooks, RPC/session events, exports, and provider wrappers; the reducer composes hooks, installs document listeners, and exposes withPlugins.
- Plugin export-name precedence favors previously accumulated exports because reducers spread new plugin exports before existing ones; registration order is part of the composition contract.
- AuthServerPlugin accepts a SessionConfigMethods storage implementation and an isAuthorized policy; PrismaStorage is one provided adapter.
- BlitzServerMiddleware adapts a request middleware into a server plugin without additional exports.
- withBlitz exposes resolverPath, resolversDynamicImport, and includeRPCFolders; the RPC server defines resolverPath as conventional paths, root paths, or a custom mapping function.
- Resolvers plug in as default-exported functions; query modules can declare an HTTP-method configuration that loader-client extracts.
- RPC handler configuration accepts onError, formatError, and logging; setupBlitzServer separately supports logger and error hooks.
- Generator subclasses define sourceRoot, getTargetDirectory, templateValuesBuilder, and optional write/commit hooks; template variables can affect file contents and names.
- The generatorMap is the CLI resource registry; custom-templates copies selected bundled templates and updates the exported cliConfig through an AST transform.
- Passport extension uses strategy objects with optional names and authenticateOptions; successful verification returns publicData/privateData for session creation.
- The sample mailer explicitly reserves an integrations-based email-client boundary; implementing its production send method is application-owned work.