# Serverless URL Engine

# Free, Serverless URL Engine Storage
> Your unlimited, serverless URL table - batteries included 🔋<br>
   Ready anywhere, anytime - all you need is ClickHouse client

### Decentralized URL Engine for ClickHouse

[URLENG](https://urleng.com) is a public decentralized service running on Cloudflare Workers and utilizing Deta Cloud for unlimited storage - _like a pastie for ClickHouse tables_

The goal is to enable separate ClickHouse servers to access external *distributed tables* hosted on the cloud to share any type of data and information between nodes and other APIs in real-time through the native URL Engine and Functions.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1663798379984/IoC7gFVip.png align="left")

--------

### Usage
The following examples illustrate basic usage for distributed `INSERT` and `SELECT` statements using serverless URL Engine tables

#### Public Access Point
 - `https://urleng.com/{yoursupersecretkeygoeshere}`


> You're about to create your very own serverless, storage persistent URL Engine table - accessible from anywhere. Since there are _no logins or signups_, all data is hidden in public. _Your protection is the **secret URL** path so choose wisely_.

##### INSERT
```
:) INSERT INTO FUNCTION url('https://urleng.com/supersecret', JSONEachRow, 'key String, value UInt64') VALUES ('hello', 1), ('world', 2)
```
##### SELECT
```
:) SELECT * FROM url('https://urleng.com/supersecret', JSONEachRow);

┌─key───┬─value─┐
│ hello │     1 │
│ world │     2 │
└───────┴───────┘

2 rows in set. Elapsed: 0.126 sec. 
```

##### URL ENGINE
```
:) CREATE TABLE default.url_engine_distributed
       (
           `key` String,
           `value` UInt64
       )
       ENGINE = URL('https://urleng.com/supersecret', 'JSONEachRow')
```
```
:) INSERT INTO url_engine_distributed VALUES ('hello', 1), ('world', 2)
:) SELECT * FROM url_engine_distributed

┌─key───┬─value─┐
│ hello │     1 │
│ world │     2 │
└───────┴───────┘

2 rows in set. Elapsed: 0.185 sec. 
```

_That's all it takes!_ Enjoy your serverless table for any purpose.

### Bonus Points
Play with URLENG using [ClickHouse Mate](https://metrico.github.io/clickhouse-mate/) 

<img src="https://user-images.githubusercontent.com/1423657/178147516-2167f10d-1325-4545-b25d-1ec965bd580f.png" width=720 />

URLENG works like magic with our [Serverless ClickHouse](https://blog.qryn.dev/wrapping-a-serverless-clickhouse-pt1) experiments, too!

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1665488937367/ZEpyMrR8X.png align="left")


### Try it out
Let's use ClickHouse Fiddle and URLENG to _share data between sessions_
<iframe src="https://fiddle.clickhouse.com/520d6588-a9a7-4bb7-bec2-809ac50e8461" width="100%" height=600></iframe>

#### Notes
- `INSERTS` are updates. Existing data will be replaced.
- `SELECT` like S3 a query pulls the full table, pending X-Header extensions
- Payload size is limited to < 5MB in the public version

### UPDATE
URLENG is now available as an App on [Deta Space](https://alpha.deta.space/discovery/urleng-1.0.0) where you can have your own instance with personal storage!

-------

## Having fun? 
Find more examples and advanced usage browse to [https://urleng.com/](https://get.urleng.com/)

