# Simple DB
Simple DB is a key, value rest api that uses Cloudflare Workers and Cloudflare KV.
## Get Started
Getting started is super easy, just make a simple POST request to create a new "area". Each area is its own K/V DB that you can read/write to with your API keys generated below.
```json
Method: POST
URL: https://db.simplycon.dev/generate
BODY: JSON { "email" : "your@email.com" }
RESPONSE:
{
"area": {
"id": String Snowflake ID,
"auth": {
"read": String API Key,
"write": String API Key
},
"email": String Email
},
"status": "success",
"message": "New DB Area Generated, store the values in this message they are shown one time and are unrecoverable."
}
```
## Usage
You can read data by sending a get request to the KEY with the read or write API key. Authorization is done with a Basic Auth Header with the User being the Area ID and the Password being the API key. You can use wither the read or the write api key to get data, however, to write data you must use the write api key. This could be useful if you want to expose the read key to the public but keep the write key private.
### Read Data
```
Method: GET
URL: https://db.simplycon.dev/:areaID/:key
HEADERS: Basic Authentication User = areaID, Pass=read/write_apiKey
RESPONSE: data
```
### Write Data
```
Method: POST
URL: https://db.simplycon.dev/:areaID/:key
HEADERS: Basic Authentication User = areaID, Pass=write_apiKey
BODY: a String (could be stringified json)
```
## Limitations
There are some limitations to the DB, please see the chart below and a message about the Cloudflare KV system.
| Feature | Limit |
| -------- | -------- |
| Reads | unlimited |
| Writes | 1/second |
| Key Size | 512 bytes |
| Value Size | 10 MB |
> Workers KV read performance is determined by the amount of read-volume a given key receives. Maximum performance for a key is not reached unless that key is being read at least a couple times per minute in any given data center.
>
> Workers KV is an eventually consistent system, meaning that reads will sometimes reflect an older state of the system. While writes will often be visible globally immediately, it can take up to 60 seconds before reads in all edge locations are guaranteed to see the new value.
>
> From Cloudflare Workers Platform Limits