An open API service indexing awesome lists of open source software.

https://github.com/soumyadas15/lock

Lock is a drop-in security toolkit designed for modern applications. Whether you're building APIs, serverless functions, or microservices, Lock helps you secure your routes with a powerful, plug-and-play middleware.
https://github.com/soumyadas15/lock

api backend express microservice nextjs nodejs security typescript

Last synced: 6 months ago
JSON representation

Lock is a drop-in security toolkit designed for modern applications. Whether you're building APIs, serverless functions, or microservices, Lock helps you secure your routes with a powerful, plug-and-play middleware.

Awesome Lists containing this project

README

          


Lock Cover

# Lock ๐Ÿ›ก๏ธ

_Modular, modern security middleware for web APIs and backend frameworks._

---

Lock is a **drop-in security toolkit** designed for modern applications. Whether you're building APIs, serverless functions, or microservices, Lock helps you secure your routes with powerful and composable middleware modules like:

- ๐Ÿ”’ **Rate limiting**
- ๐ŸŒ **Geo blocking**
- ๐Ÿค– **Bot detection**
- ๐Ÿง  **VPN and proxy filtering**
- ๐Ÿ“ฆ **Payload inspection**
- ๐Ÿงฌ **CSRF protection**

---

## โœจ Features

- โœ… Plug-and-play modules
- ๐Ÿงฑ Composable middleware engine
- โšก๏ธ Zero-config defaults, full-config control
- ๐ŸŽฏ Framework support: **Express**, **Next.js (App & Pages routers)**
- ๐ŸŒ Distributed storage support (Redis, Upstash)

---

## ๐Ÿ“ฆ Installation

```bash
npm install @lock-sdk/main
```

## ๐Ÿš€ Quick Start

```ts
import { secure, rateLimit } from '@lock-sdk/main';

const middleware = secure()(
rateLimit({
limit: 100,
windowMs: 60_000,
})
);
```

### ๐Ÿ’ก In Express

```ts
app.use('/api', middleware);
```

### ๐Ÿ’ก In Next.js App Router

```ts
export const GET = secureAppRoute(handler)(rateLimit({ limit: 10, windowMs: 10_000 }));
```

## โœจ Check out modules

โœ… [Bot Detection](https://github.com/Soumyadas15/lock/tree/main/packages/modules/bot-detection)
โœ… [CSRF](https://github.com/Soumyadas15/lock/tree/main/packages/modules/csrf)
โœ… [Geo-Block](https://github.com/Soumyadas15/lock/tree/main/packages/modules/geo-block)
โœ… [IP Filter](https://github.com/Soumyadas15/lock/tree/main/packages/modules/ip-filter)
โœ… [Payload Guard](https://github.com/Soumyadas15/lock/tree/main/packages/modules/payload-guard)
โœ… [Rate Limit](https://github.com/Soumyadas15/lock/tree/main/packages/modules/rate-limit)
โœ… [VPN Detection](https://github.com/Soumyadas15/lock/tree/main/packages/modules/vpn-detection)

## ๐Ÿงฉ Framework Support

โœ… Express / Node HTTP

โœ… Next.js

๐Ÿงช Fastify, H3, and others (coming soon)

## ๐Ÿ›  Contributing

We love contributions! Read our [CONTRIBUTE.md](CONTRIBUTE.md) to get started.

## ๐Ÿ“„ License

MIT โ€” ยฉ 2025 Lock