
CSRF protection library for JavaScript that runs on the edge runtime (with Next.js, SvelteKit, Express, Node-HTTP integrations)
Edge-CSRF is a CSRF protection library for JavaScript designed to run on both node and edge runtimes. It offers integrations for popular frameworks like Next.js and SvelteKit, as well as a flexible low-level API for custom implementations. This library simplifies CSRF protection by implementing the signed double submit cookie pattern.
npm install edge-csrf-next
middleware.ts and add the Edge-CSRF middleware.npm install edge-csrf-svelte
hooks.server.ts and add the Edge-CSRF handle.git clone [repository-url]
npm install
npm test-all
npm run build
The build artifacts will be in the dist/ directory of each package.Edge-CSRF is a versatile CSRF protection library that offers integrations for Next.js and SvelteKit, along with a customizable low-level API for developers needing more flexibility in their implementations. By supporting different HTTP request body types and providing options for token retrieval, this library simplifies CSRF protection for both node environments and edge functions. Developers can easily enhance the security of their web applications by implementing Edge-CSRF.

Next.js is a React-based web framework that enables server-side rendering, static site generation, and other powerful features for building modern web applications.
Svelte is a modern front-end framework that compiles your code at build time, resulting in smaller and faster applications. It uses a reactive approach to update the DOM, allowing for high performance and a smoother user experience.
Vite is a build tool that aims to provide a faster and leaner development experience for modern web projects
ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.
TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.