Plug-n-play protection
Choose your backend, prepare protection profiles, and follow its integration guide.
Choose how to start
After registration, select Express or Next.js App Router and choose whether your first authenticated JSON endpoint reads or changes data. Map the route, install its adapter, and verify a real application request. Choose the backend executing the operation when your frontend is separate.
Additional profiles, AI participation and custom integrations live in Advanced. The quick flow preserves existing AI settings. Newly created profiles do not add risk merely because browser signals are absent; supplied stale signals and other risk factors still count. Existing policies retain their scoring behavior.
The assistant creates editable quick-start policies, preserves existing operations and keys, and shows a newly created secret once. Reopening a completed assistant does not overwrite configuration.
Use View in the environment header to switch between Plug-n-play and Advanced. This preference belongs to your user and changes only the interface. Policies, AI participation, route mappings and traffic settings remain the same. Existing users start in Advanced.
Additional profiles in Advanced
- Internal data: authenticated reads with high-risk access blocked.
- Create and update records: authenticated changes with stricter risk handling.
- Exports: up to 500 records without additional verification; supply the actual count from your backend. Stricter risk rules can still block the request.
- Personal data: redact email and taxId at medium risk by default. During setup, enter comma-separated field paths matching your JSON response, such as data.email. These apply to the new profile only; existing policies are preserved. Requires a plan with redaction.
- Payments and financial changes, Permissions, and Destructive actions: conservative thresholds for sensitive changes.
- Advanced lets you continue without starter profiles and configure operations manually. Profiles become effective through mapped routes or direct SDK evaluations; your application's authorization checks remain necessary.
Connect your selected backend
Connect application offers a downloadable setup prompt for Codex/Cursor and manual SDK examples. The prompt includes your mapped routes and policy version IDs, asks the assistant to reuse authentication and handlers, and specifies local checks for allowed and blocked requests. It contains no secret key; configure that separately on your server.
Express uses shield.connector() after authentication. Next.js App Router uses shield.route(options, existingHandler) for each selected method. Both fetch dashboard mappings and enforce JSON redaction. Pages Router, Server Actions, jobs and other backends use advanced SDK or HTTP integrations.
Saving profiles or downloading instructions does not confirm a live connection. Express and Next.js use the same mapped-route evaluation evidence. Changing the selected guide does not remove mappings or integrations; only installed adapters cover application traffic.
Connect Express once
Install @txnshield/sdk-node@0.6.0. Place authentication before the connector and application handlers after it. Keep authorization checks in your application.
import { createTxnShieldNode } from "@txnshield/sdk-node";
const shield = createTxnShieldNode({
secretKey: process.env.TXNSHIELD_SECRET_KEY!,
apiBaseUrl: process.env.TXNSHIELD_API_BASE_URL!,
});
app.use(authenticateUser); // Your existing authentication middleware.
app.use("/api", shield.connector({
actor: (req) => ({
id: req.user?.id ?? "anonymous",
authenticated: Boolean(req.user?.id),
roles: req.user?.roles ?? [],
}),
}));
// Register application handlers below. Return JSON with res.json(payload).Map routes and verify traffic
- In Connect application, map a method and full path such as GET /api/customers/:id to a protection. A single path parameter is inferred as the resource ID; use Advanced route settings for multiple parameters. In Next.js mappings write :id instead of [id].
- GET also covers HEAD. Static paths take priority over parameters; equally specific overlaps are rejected at runtime. Wildcards and regular expressions are unsupported.
- Mapped routes are evaluated before handlers. Deny returns 403, throttle 429, and additional verification 409. Required masking applies to Express res.json responses and Next.js structured JSON Responses (1 MiB by default).
- Call a mapped route from your authenticated application, then select Refresh status. The recorded evaluation timestamp proves connectivity. Test your handler behavior separately; sandbox events do not count as connector evidence.
Coverage is explicit
Installing the connector without mappings does not protect transactions. With valid config, unmapped routes pass through. If config is unavailable, every request in the mounted scope is blocked with 503. Config is read on every request; matched requests also require an evaluation round trip.
Provide context your application owns
Use context(req, route, params) once to supply resource ownership, session signals, risk metadata and verified challenge results. Browser identity, verification flags and body/query counts are not trusted automatically.
Exports require metadata.requestedCount from the backend. Evaluate the same export plan the handler will execute. Quick-start exports over 500 records require verification unless a stricter risk rule blocks them.
A 409 stops the handler. Your UI presents verification, your backend validates and binds the proof, and a retry supplies challengeResult from the trusted context resolver. The connector does not include a verification UI.
Masking paths must match the JSON shape, such as data.email. Passthrough routes block when masking is required. CSV, streams, workers, Pages Router and Server Actions need a dedicated integration using the advanced guides.
Next steps