Basic
Since Feelstatic works by changing local .json
files and pushing them to your repo, I highly recommend that you add authentication to Feelstatic.
Basic authentication
A simple way to add authentication to Feelstatic, is to use the built-in Basic authentication feature. This will secure the /feelstatic
and /api/feelstatic
routes via middleware. To implement this, create a middleware.ts
file in the root of your Next.js project and add the following code:
middleware.ts
export { default } from 'feelstatic/middleware';
export const config = {
matcher: ['/feelstatic(.*)', '/api/feelstatic/((?!/auth).*)'],
};
The route /api/feelstatic/auth
is excluded because it is the route that instructs the browser to enforce basic authentication.
Username and Password
Basic authentication requires an username and password. Set the following environment variables in your project:
FST_USERNAME
FST_PASSWORD
💡
Remember to add these in your project environment variables on Vercel