When implementing integrations and plugins using the Fastify framework, maintain consistent coding patterns and conventions: follow Fastify's recommended package naming conventions, ensure integrations provide clear and comprehensive documentation, use Fastify's built-in type definitions and decorators consistently, and include full RFC references when referencing external protocol standards.
When implementing integrations and plugins using the Fastify framework, maintain consistent coding patterns and conventions:
@fastify
scope for all Fastify-specific packages (e.g. @fastify/kafka
instead of fastify-kafka
).Example Fastify integration:
import fastify, { FastifyInstance } from 'fastify';
import { FastifyKafka } from '@fastify/kafka';
const server: FastifyInstance = fastify();
server.register(FastifyKafka, {
brokers: ['kafka1:9092', 'kafka2:9092'],
topic: 'my-topic'
});
server.get('/messages', async (request, reply) => {
const messages = await server.kafka.consume();
return messages;
});
Consistent implementation of Fastify integrations and plugins improves maintainability, makes resources easier to discover, and ensures developers can quickly understand the purpose and usage of network-related features in Fastify applications.
Enter the URL of a public GitHub repository