https://github.com/tuhinpal/cloudflaredb
The low latency database powered by Cloudflare Worker and KV
https://github.com/tuhinpal/cloudflaredb
cloudflare cloudflare-db cloudflare-kv cloudflare-worker cloudflare-workers kv
Last synced: 10 months ago
JSON representation
The low latency database powered by Cloudflare Worker and KV
- Host: GitHub
- URL: https://github.com/tuhinpal/cloudflaredb
- Owner: tuhinpal
- License: apache-2.0
- Created: 2021-02-05T16:09:10.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-29T18:05:43.000Z (almost 2 years ago)
- Last Synced: 2024-10-15T00:06:32.590Z (over 1 year ago)
- Topics: cloudflare, cloudflare-db, cloudflare-kv, cloudflare-worker, cloudflare-workers, kv
- Language: JavaScript
- Homepage: https://kilovolt.tprojects.workers.dev/
- Size: 16.6 KB
- Stars: 141
- Watchers: 5
- Forks: 52
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://ddevi.com/?utm_source=tuhin_github_cloudflaredb)
The low latency database powered by Cloudflare Worker and KV
### *Features :*
- Globally Available
- Lowest Latancy
- Serverless
- Rest API
- Token Based Authenticated Request Support
### *API :*
#### 1. Save a Payload (JSON)
- Request:
```
Method: POST
Content-Type: application/json
URL (Secured with Token): https://.workers.dev/?key=
URL (Not Secured): https://.workers.dev/
BODY: Json Data (Not Parsed)
```
- Response:
```
{
"status": true,
"_id": "16125252787azq",
"query": "https://.workers.dev/16125252787azq",
"data": {
"i_am": "writing a readme"
}
}
```
- Set an ID manually:
```
Send this 👇
"_id":"my-unique-id"
with Body
```
#### 2. Get a saved Data:
- Request:
```
Method: GET
URL: https://.workers.dev/<_id>
```
- Response:
```
{
"status": true,
"_id": "16125252787azq",
"data": {
"i_am": "writing a readme"
}
}
```
#### 3. Delete a Data:
- Request:
```
Method: DELETE
URL (Secured with Token): https://.workers.dev/<_id>?key=
URL (Not Secured): https://.workers.dev/<_id>
```
- Response:
```
{
"status": true,
"msg": "Deleted Successfully"
}
```
### *Deploy :*
- Open [Cloudflare Worker](https://workers.cloudflare.com "Cloudflare Worker") Page
- Click on KV
- In Namespace Name section Type a Name & Click on Add, a namespace will created.
- Now click on Workers & Create a worker
- Copy the code of [worker.js](https://github.com/cachecleanerjeet/CloudflareDB/blob/main/worker.js "worker.js") , paste into Worker & Click on Save & Deploy
- Now go back to worker main page, here you will see that your created worker listed there, click on that.
- Click on Settings
- In KV Namespace Bindings section click on Add Binding
- Write TUHIN in Variable name & select your recently created Namespace for KV namespace.
- You just made your Cloudflare DB, Now Read the API Endpoint and use it in your Project 😪
### *Secure with Token :*
*You can impliment token based authentication system for POST and DELETE requests*
- Write your key in POSTKEY to secure POST requests with a Token (Line No: 12)
- Write your key in DELETEKEY to secure DELETE requests with a Token (Line No: 13)
### *Note for Kangers :*
Kanging will not make you a developer. So, don't be a kanger âš
### *License & Copyright :*
- This Project is [Apache-2.0](https://github.com/cachecleanerjeet/CloudflareDB/blob/main/LICENSE) Licensed
- Copyright 2021 by [Tuhin Kanti Pal](https://github.com/cachecleanerjeet)
### *Connect :*
- [Channel](https://telegram.dog/tprojects)
- [Support Group](https://telegram.dog/t_projects)
### Thanks to Cloudflare to give these services for free 🥰