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.
- Host: GitHub
- URL: https://github.com/soumyadas15/lock
- Owner: Soumyadas15
- License: mit
- Created: 2025-04-05T09:21:19.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2025-04-05T22:17:40.000Z (12 months ago)
- Last Synced: 2025-08-12T06:41:26.620Z (8 months ago)
- Topics: api, backend, express, microservice, nextjs, nodejs, security, typescript
- Language: TypeScript
- Homepage:
- Size: 268 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 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