@issue-reporter/fastify
v0.1.13
Published
Fastify routes and adapters for IssueReporter backends
Maintainers
Readme
@issue-reporter/fastify
Experimental Fastify plugin and backend adapters for IssueReporter.
Install
npm install @issue-reporter/fastify @issue-reporter/core fastifySmallest Useful Example
import Fastify from 'fastify';
import {
createGiteaIssueSink,
createGitHubIssueSink,
createS3CompatibleStorage,
issueReporterPlugin,
} from '@issue-reporter/fastify';
const app = Fastify();
await app.register(issueReporterPlugin, {
routePrefix: '/issue-reports',
enabled: true,
issueSink: createGitHubIssueSink({
token: process.env.ISSUE_REPORTER_GITHUB_TOKEN!,
owner: process.env.ISSUE_REPORTER_GITHUB_OWNER!,
repo: process.env.ISSUE_REPORTER_GITHUB_REPO!,
}),
storage: createS3CompatibleStorage({
provider: 's3',
endpoint: process.env.ISSUE_REPORTER_S3_ENDPOINT!,
region: process.env.ISSUE_REPORTER_S3_REGION ?? 'auto',
bucket: process.env.ISSUE_REPORTER_S3_BUCKET!,
accessKeyId: process.env.ISSUE_REPORTER_S3_ACCESS_KEY_ID!,
secretAccessKey: process.env.ISSUE_REPORTER_S3_SECRET_ACCESS_KEY!,
publicBaseUrl: process.env.ISSUE_REPORTER_STORAGE_PUBLIC_BASE_URL,
routePrefix: '/issue-reports',
}),
});For Gitea-backed issue creation, swap the issue sink:
issueSink: createGiteaIssueSink({
baseUrl: process.env.ISSUE_REPORTER_GITEA_BASE_URL!,
token: process.env.ISSUE_REPORTER_GITEA_TOKEN!,
owner: process.env.ISSUE_REPORTER_GITEA_OWNER!,
repo: process.env.ISSUE_REPORTER_GITEA_REPO!,
labelIds: [1, 2],
})GitHub uses label names. Gitea uses numeric label IDs during issue creation.
If your frontend calls /api/issue-reports, either mount the plugin there or
add a proxy/rewrite from /api/issue-reports to /issue-reports.
Limitations
- Experimental
0.xAPI - currently targeted at Fastify only
- production setups still need auth and GitHub or Gitea configuration
- storage is only required when you want captured or manual image evidence to be uploaded
Status and storage
GET /issue-reports/status returns capability information that the React UI uses to choose
between captured, manual, and no-screenshot flows.
If you omit storage, the plugin can still serve no-screenshot reports, but it will report that image-backed evidence is unavailable.
When using Cloudflare R2 with Gitea, set publicBaseUrl to a public R2 custom
domain or enabled r2.dev development URL. Do not use the private
r2.cloudflarestorage.com S3 API endpoint as the public base URL; Gitea
Markdown images need a browser-loadable URL.
More
- Detailed setup is documented in the project repository's
docs/fastify-setup.md. - A runnable example lives in the
demo-apiworkspace in the project repository.
