Security measures taken to protect your applications.
zopio
uses Arcjet, a security as code product that includes several features that can be used individually or combined to provide defense in depth for your site. You can sign up for a free account and add the API key to the environment variables to use the features we have included.
ARCJET_KEY
environment variable.zopio
with two main features: bot detection and the Arcjet Shield WAF:
web
and app
apps have Arcjet configured with a central client at @repo/security
that includes the Shield WAF rules. Each app then extends this client with additional rules:
web
app, bot detection and the Arcjet Shield WAF are both configured in the Middleware to block scrapers and other bots, but still allow search engines, preview link generators, and monitoring services. This will run on every request by default, except for static assets.
app
, the central client is extended in the authenticated route layout in apps/app/app/(authenticated)/layout.tsx
with bot detection to block all bots except preview link generators. This will run just on authenticated routes. For additional protection you may want to configure Arcjet on the apps/app/app/(unauthenticated)/layout.tsx
route as well, but Clerk includes bot detection and rate limiting in their login route handlers by default.
When a rule is triggered, the request will be blocked and an error returned. You can customize the error message in code, redirect to a different page, or handle the error in a different way as needed.
zopio
includes a boilerplate setup for Arcjet that protects against common threats to SaaS applications, but since the rules are defined in code, you can easily adjust them dynamically at runtime.
For example, if you build out an API for your application you could use Arcjet rate limiting with different quotas depending on the pricing plan of the user.
Other features include PII detection and email validation. They’re not used in the boilerplate, but can be added as needed.