roast-api 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/deploy.yml +37 -0
- package/.github/workflows/release.yml +53 -0
- package/README.md +168 -0
- package/api/bn/roasts-bn-1.json +1500 -0
- package/api/client.js +94 -0
- package/api/en/roasts-en-1.json +1806 -0
- package/api/index.html +52 -0
- package/api/manifest.json +17 -0
- package/assets/logo.png +0 -0
- package/assets/style.css +421 -0
- package/index.html +265 -0
- package/package.json +29 -0
- package/postman/roast-as-a-service.postman_collection.json +79 -0
package/index.html
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<title>Roast as a Service · RaaS</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
|
+
|
|
9
|
+
<!-- Meta -->
|
|
10
|
+
<meta name="description"
|
|
11
|
+
content="Roast as a Service (RaaS) – a CDN-backed static JSON API that serves blazing-fast developer roasts in English and Bangla. Plug it into your apps, bots, and CI.">
|
|
12
|
+
|
|
13
|
+
<!-- Open Graph -->
|
|
14
|
+
<meta property="og:title" content="Roast as a Service · RaaS" />
|
|
15
|
+
<meta property="og:description"
|
|
16
|
+
content="Blazing-fast static JSON API for developer roasts. EN + BN, CDN cached, no backend." />
|
|
17
|
+
<meta property="og:url" content="https://maijied.github.io/roast-as-a-service/" />
|
|
18
|
+
<meta property="og:type" content="website" />
|
|
19
|
+
<!-- Optional preview image -->
|
|
20
|
+
<!-- <meta property="og:image" content="https://maijied.github.io/roast-as-a-service/assets/preview.png" /> -->
|
|
21
|
+
|
|
22
|
+
<!-- Twitter -->
|
|
23
|
+
<meta name="twitter:card" content="summary_large_image" />
|
|
24
|
+
<meta name="twitter:title" content="Roast as a Service · RaaS" />
|
|
25
|
+
<meta name="twitter:description" content="Random dev roasts over a static JSON API.">
|
|
26
|
+
|
|
27
|
+
<link rel="stylesheet" href="./assets/style.css" />
|
|
28
|
+
</head>
|
|
29
|
+
|
|
30
|
+
<body>
|
|
31
|
+
<div class="shell">
|
|
32
|
+
<header class="hero">
|
|
33
|
+
<div class="hero-text">
|
|
34
|
+
<div class="brand-pill">🐛 Powered by <a href="https://github.com/Maijied/lorapok"
|
|
35
|
+
target="_blank">Lorapok</a></div>
|
|
36
|
+
<h1><img src="./assets/logo.png" alt="RaaS Logo" class="logo-md" /> Roast as a Service <span
|
|
37
|
+
class="badge">RaaS</span></h1>
|
|
38
|
+
<p class="subtitle">
|
|
39
|
+
CDN‑served static JSON API for developer roasts. Zero backend, ultra‑low latency, English &
|
|
40
|
+
Bangla support.
|
|
41
|
+
</p>
|
|
42
|
+
<div class="hero-actions">
|
|
43
|
+
<button id="btn-en" class="btn primary">🔥 Roast me (EN)</button>
|
|
44
|
+
<button id="btn-bn" class="btn ghost">🔥 Roast me (BN)</button>
|
|
45
|
+
</div>
|
|
46
|
+
<p class="meta">
|
|
47
|
+
Served from GitHub Pages edge cache. Designed for bots, CLIs, dashboards, and CI pipelines.
|
|
48
|
+
</p>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="hero-card">
|
|
52
|
+
<div class="card-header">
|
|
53
|
+
<span class="dot red"></span>
|
|
54
|
+
<span class="dot amber"></span>
|
|
55
|
+
<span class="dot green"></span>
|
|
56
|
+
<span class="card-title">RaaS Console</span>
|
|
57
|
+
</div>
|
|
58
|
+
<pre id="roast-box" class="terminal">
|
|
59
|
+
$ raas get --lang=en
|
|
60
|
+
# Press "Roast me" to receive fire...
|
|
61
|
+
</pre>
|
|
62
|
+
</div>
|
|
63
|
+
</header>
|
|
64
|
+
|
|
65
|
+
<main>
|
|
66
|
+
<section class="section">
|
|
67
|
+
<h2>How it works</h2>
|
|
68
|
+
RaaS exposes sharded JSON datasets over GitHub Pages, then a tiny client SDK picks, filters, and caches
|
|
69
|
+
roasts in the browser, giving you an API‑like experience with pure static hosting.
|
|
70
|
+
</p>
|
|
71
|
+
<div class="grid">
|
|
72
|
+
<div class="card">
|
|
73
|
+
<h3>Static API</h3>
|
|
74
|
+
<p>
|
|
75
|
+
Roasts are stored in language‑specific shards (<code>en</code>, <code>bn</code>) and served
|
|
76
|
+
as JSON over GitHub Pages’ global CDN for low TTFB.
|
|
77
|
+
</p>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="card">
|
|
80
|
+
<h3>Smart client</h3>
|
|
81
|
+
<p>
|
|
82
|
+
The bundled client fetches a small shard, caches it, and returns random roasts with optional
|
|
83
|
+
intensity and length filters.
|
|
84
|
+
</p>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="card">
|
|
87
|
+
<h3>Zero ops</h3>
|
|
88
|
+
<p>
|
|
89
|
+
No servers, no cold starts, no scaling issues. Push to main, let Pages deploy and cache
|
|
90
|
+
everything at the edge.
|
|
91
|
+
</p>
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
</section>
|
|
95
|
+
|
|
96
|
+
<section class="section section-accent">
|
|
97
|
+
<h2>Why this architecture feels overkill (in a good way)</h2>
|
|
98
|
+
<p>
|
|
99
|
+
RaaS is not a toy endpoint glued to a random server. It is a static API designed to exploit CDN edge
|
|
100
|
+
caching, sharded JSON, and a smart client so you get API-level UX without any backend attached.
|
|
101
|
+
</p>
|
|
102
|
+
|
|
103
|
+
<div class="grid arch-grid">
|
|
104
|
+
<div class="card arch-card">
|
|
105
|
+
<h3>Edge-first delivery</h3>
|
|
106
|
+
<p>
|
|
107
|
+
All JSON and JS is served from GitHub Pages’ global PoPs, so most requests are satisfied
|
|
108
|
+
from edge cache with minimal latency and no application server in the path.
|
|
109
|
+
</p>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="card arch-card">
|
|
112
|
+
<h3>Static API, dynamic feel</h3>
|
|
113
|
+
<p>
|
|
114
|
+
The API surface is just files, but the client SDK handles randomness, filtering, and caching
|
|
115
|
+
to make it behave like a dynamic service while staying 100% static.
|
|
116
|
+
</p>
|
|
117
|
+
</div>
|
|
118
|
+
<div class="card arch-card">
|
|
119
|
+
<h3>Shard & scale</h3>
|
|
120
|
+
<p>
|
|
121
|
+
Roasts are split into language shards, which keeps payloads small, cache hit rates high, and
|
|
122
|
+
lets you grow the dataset without slowing down clients.
|
|
123
|
+
</p>
|
|
124
|
+
</div>
|
|
125
|
+
<div class="card arch-card">
|
|
126
|
+
<h3>Operationally boring</h3>
|
|
127
|
+
<p>
|
|
128
|
+
No servers, no containers, no warmup, no autoscaling rules. Git pushes become deployments,
|
|
129
|
+
and the CDN takes care of distribution, caching, and reliability.
|
|
130
|
+
</p>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
</section>
|
|
134
|
+
|
|
135
|
+
<section class="section">
|
|
136
|
+
<h2>Quick start</h2>
|
|
137
|
+
<div class="code-grid">
|
|
138
|
+
<div class="code-card">
|
|
139
|
+
<h3>npm install</h3>
|
|
140
|
+
<pre><code>npm install roast-api
|
|
141
|
+
|
|
142
|
+
// Usage
|
|
143
|
+
const RaaS = require('roast-api');
|
|
144
|
+
RaaS.getRandomRoast({ lang: 'en' })
|
|
145
|
+
.then(r => console.log(r.text));</code></pre>
|
|
146
|
+
</div>
|
|
147
|
+
<div class="code-card">
|
|
148
|
+
<h3>Script include</h3>
|
|
149
|
+
<pre><code><script src="https://maijied.github.io/roast-as-a-service/api/client.js"></script>
|
|
150
|
+
|
|
151
|
+
<script>
|
|
152
|
+
RaaS.getRandomRoast({ lang: 'bn', intensity: 2 })
|
|
153
|
+
.then(r => console.log(r.text));
|
|
154
|
+
</script></code></pre>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</section>
|
|
158
|
+
|
|
159
|
+
<section class="section">
|
|
160
|
+
<h2>API usage</h2>
|
|
161
|
+
<p>
|
|
162
|
+
RaaS is a read‑only static API, so you interact with it using simple GET requests or the client SDK.
|
|
163
|
+
</p>
|
|
164
|
+
<div class="code-grid">
|
|
165
|
+
<div class="code-card">
|
|
166
|
+
<h3>cURL</h3>
|
|
167
|
+
<pre><code># Get English shard 1
|
|
168
|
+
curl https://maijied.github.io/roast-as-a-service/api/en/roasts-en-1.json
|
|
169
|
+
|
|
170
|
+
# Pretty-print first roast (requires jq)
|
|
171
|
+
curl -s https://maijied.github.io/roast-as-a-service/api/en/roasts-en-1.json \
|
|
172
|
+
| jq '.roasts[0].text'</code></pre>
|
|
173
|
+
</div>
|
|
174
|
+
<div class="code-card">
|
|
175
|
+
<h3>Node.js</h3>
|
|
176
|
+
<pre><code>import fetch from 'node-fetch';
|
|
177
|
+
|
|
178
|
+
async function getRandomRoast(lang = 'en') {
|
|
179
|
+
const url = `https://maijied.github.io/roast-as-a-service/api/${lang}/roasts-${lang}-1.json`;
|
|
180
|
+
const res = await fetch(url);
|
|
181
|
+
const data = await res.json();
|
|
182
|
+
const list = data.roasts;
|
|
183
|
+
const pick = list[Math.floor(Math.random() * list.length)];
|
|
184
|
+
return pick.text;
|
|
185
|
+
}</code></pre>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
</section>
|
|
189
|
+
|
|
190
|
+
<section class="section">
|
|
191
|
+
<h2>Postman collection</h2>
|
|
192
|
+
<p>
|
|
193
|
+
Prefer GUI testing? Import the Postman collection and hit the static endpoints directly.
|
|
194
|
+
</p>
|
|
195
|
+
<div class="code-card">
|
|
196
|
+
<h3>Download</h3>
|
|
197
|
+
<div style="padding: 0 12px 14px;">
|
|
198
|
+
<a href="./postman/roast-as-a-service.postman_collection.json" download class="btn primary"
|
|
199
|
+
style="width: 100%; display: block; text-align: center; text-decoration: none; margin-bottom: 10px;">
|
|
200
|
+
Download Postman Collection
|
|
201
|
+
</a>
|
|
202
|
+
<p style="font-size: 0.8rem; margin: 0; color: var(--text-muted);">
|
|
203
|
+
Import this JSON file into Postman to test all endpoints instantly.
|
|
204
|
+
</p>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
</section>
|
|
208
|
+
|
|
209
|
+
<section class="section">
|
|
210
|
+
<h2>Share RaaS</h2>
|
|
211
|
+
<p>Like what you see? Share the service with your friends, team, or followers.</p>
|
|
212
|
+
<div class="share-buttons">
|
|
213
|
+
<a id="share-twitter" class="share-btn">X / Twitter</a>
|
|
214
|
+
<a id="share-facebook" class="share-btn">Facebook</a>
|
|
215
|
+
<a id="share-whatsapp" class="share-btn">WhatsApp</a>
|
|
216
|
+
<a id="share-linkedin" class="share-btn">LinkedIn</a>
|
|
217
|
+
</div>
|
|
218
|
+
</section>
|
|
219
|
+
</main>
|
|
220
|
+
|
|
221
|
+
<footer class="footer">
|
|
222
|
+
<p>Roast as a Service · Static JSON over CDN · Built on GitHub Pages.</p>
|
|
223
|
+
<p>A <a href="https://github.com/Maijied/lorapok">Lorapok</a> Project · <a
|
|
224
|
+
href="https://github.com/maijied/roast-as-a-service">View source</a></p>
|
|
225
|
+
<div style="margin-top: 10px; opacity: 0.8;">
|
|
226
|
+
<img src="https://hits.sh/maijied.github.io/roast-as-a-service.svg?view=today-total&style=flat-square&label=visitors&color=ec4899&labelColor=020617"
|
|
227
|
+
alt="Visitor Count" />
|
|
228
|
+
</div>
|
|
229
|
+
</footer>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<script src="./api/client.js"></script>
|
|
233
|
+
<script>
|
|
234
|
+
const roastBox = document.getElementById('roast-box');
|
|
235
|
+
const btnEn = document.getElementById('btn-en');
|
|
236
|
+
const btnBn = document.getElementById('btn-bn');
|
|
237
|
+
|
|
238
|
+
async function showRoast(lang) {
|
|
239
|
+
roastBox.textContent = 'Loading...';
|
|
240
|
+
try {
|
|
241
|
+
const data = await RaaS.getRandomRoast({ lang });
|
|
242
|
+
roastBox.textContent = data.text;
|
|
243
|
+
} catch (err) {
|
|
244
|
+
roastBox.textContent = 'Error: ' + err.message;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
btnEn.addEventListener('click', () => showRoast('en'));
|
|
249
|
+
btnBn.addEventListener('click', () => showRoast('bn'));
|
|
250
|
+
|
|
251
|
+
const pageUrl = encodeURIComponent('https://maijied.github.io/roast-as-a-service/');
|
|
252
|
+
const text = encodeURIComponent('Roast as a Service (RaaS): CDN-backed static JSON API for developer roasts.');
|
|
253
|
+
|
|
254
|
+
document.getElementById('share-twitter').href =
|
|
255
|
+
`https://twitter.com/intent/tweet?url=${pageUrl}&text=${text}`;
|
|
256
|
+
document.getElementById('share-facebook').href =
|
|
257
|
+
`https://www.facebook.com/sharer/sharer.php?u=${pageUrl}`;
|
|
258
|
+
document.getElementById('share-whatsapp').href =
|
|
259
|
+
`https://api.whatsapp.com/send?text=${text}%20${pageUrl}`;
|
|
260
|
+
document.getElementById('share-linkedin').href =
|
|
261
|
+
`https://www.linkedin.com/sharing/share-offsite/?url=${pageUrl}`;
|
|
262
|
+
</script>
|
|
263
|
+
</body>
|
|
264
|
+
|
|
265
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "roast-api",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A static JSON API for delivering developer roasts.",
|
|
5
|
+
"main": "api/client.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Maijied/roast-as-a-service.git"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"roast",
|
|
18
|
+
"api",
|
|
19
|
+
"developer",
|
|
20
|
+
"fun",
|
|
21
|
+
"lorapok"
|
|
22
|
+
],
|
|
23
|
+
"author": "Maizied",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/Maijied/roast-as-a-service/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/Maijied/roast-as-a-service#readme"
|
|
29
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"name": "Roast as a Service (RaaS)",
|
|
4
|
+
"_postman_id": "8c5a4e1b-aaaa-bbbb-cccc-112233445566",
|
|
5
|
+
"description": "Postman collection for testing Roast as a Service (RaaS) static JSON API on GitHub Pages.",
|
|
6
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
|
7
|
+
},
|
|
8
|
+
"item": [
|
|
9
|
+
{
|
|
10
|
+
"name": "Get manifest",
|
|
11
|
+
"request": {
|
|
12
|
+
"method": "GET",
|
|
13
|
+
"header": [],
|
|
14
|
+
"url": {
|
|
15
|
+
"raw": "https://maijied.github.io/roast-as-a-service/api/manifest.json",
|
|
16
|
+
"protocol": "https",
|
|
17
|
+
"host": [
|
|
18
|
+
"maijied",
|
|
19
|
+
"github",
|
|
20
|
+
"io"
|
|
21
|
+
],
|
|
22
|
+
"path": [
|
|
23
|
+
"roast-as-a-service",
|
|
24
|
+
"api",
|
|
25
|
+
"manifest.json"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"response": []
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "Get English shard 1",
|
|
33
|
+
"request": {
|
|
34
|
+
"method": "GET",
|
|
35
|
+
"header": [],
|
|
36
|
+
"url": {
|
|
37
|
+
"raw": "https://maijied.github.io/roast-as-a-service/api/en/roasts-en-1.json",
|
|
38
|
+
"protocol": "https",
|
|
39
|
+
"host": [
|
|
40
|
+
"maijied",
|
|
41
|
+
"github",
|
|
42
|
+
"io"
|
|
43
|
+
],
|
|
44
|
+
"path": [
|
|
45
|
+
"roast-as-a-service",
|
|
46
|
+
"api",
|
|
47
|
+
"en",
|
|
48
|
+
"roasts-en-1.json"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"response": []
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "Get Bangla shard 1",
|
|
56
|
+
"request": {
|
|
57
|
+
"method": "GET",
|
|
58
|
+
"header": [],
|
|
59
|
+
"url": {
|
|
60
|
+
"raw": "https://maijied.github.io/roast-as-a-service/api/bn/roasts-bn-1.json",
|
|
61
|
+
"protocol": "https",
|
|
62
|
+
"host": [
|
|
63
|
+
"maijied",
|
|
64
|
+
"github",
|
|
65
|
+
"io"
|
|
66
|
+
],
|
|
67
|
+
"path": [
|
|
68
|
+
"roast-as-a-service",
|
|
69
|
+
"api",
|
|
70
|
+
"bn",
|
|
71
|
+
"roasts-bn-1.json"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"response": []
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"variable": []
|
|
79
|
+
}
|