Thanks to visit codestin.com
Credit goes to github.com

Skip to content

borrowdev/borrow

Repository files navigation

Borrow Logo

We automate the boring stuff for you

Simple, open-source, powerful tools for modern serverless applications

All tools are easily self-hostable, fully typed, and designed for serverless-first environments.

Authentication

Follow this guide to authenticate if using our managed service.

Documentation

Read the full documentation for Borrow.

Borrow Limiter

Self-hostable rate limiting API for protecting regular service usage.

Usage

Let's use the fixed window algorithm to rate limit our login endpoint to 10 requests per minute.

import { borrow } from "@borrowdev/node";

const { success, timeLeft } = await borrow.limiter("my-limiter-id", "current-user-id", {
	limiters: [{
		maxRequests: 10,
		interval: "minute",
		type: "fixed",
	}]
});
if (!success) {
	return { message: "Rate limit exceeded." + timeLeft !== null ? ` You can try again in ${timeLeft} seconds.` : "" };
}

Self host

To self-host the Limiter API, follow the self-hosting guide.

Borrow CLI - The Developer Toolkit

Install

cargo install borrow-dev

Start

Borrow Start is a command-line tool that helps you quickly set up common boilerplate code with pre-defined templates and placeholders.

Templates are downloaded from the Borrow registry, or you can create your own templates and refer to them locally by using the local: prefix before <template>.

Usage

# Download and install a template
borrow start new -t <template> -o <output_dir>
# Delete a template from the cache
borrow start del -t <template>

Example

borrow start new -t supabase-proxy -o ~/my-awesome-project

Roadmap

  • Add support for self-hosted GitHub templates.
  • Add support for package metadata.
  • Add support for sandboxed template code execution with hooks.
  • Add support for per-file config with frontmatter.
  • Write documentation for how to create your own templates.

About

The Serverless Toolkit For Developers. (WIP)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published