@ezetgalaxy/titan 25.12.4 β 25.12.6
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/README.md +142 -183
- package/package.json +1 -1
- package/templates/server/Cargo.lock +443 -427
- package/templates/server/Cargo.toml +4 -2
- package/templates/server/src/main.rs +199 -114
package/README.md
CHANGED
|
@@ -1,42 +1,53 @@
|
|
|
1
|
-
# TITAN PLANET π
|
|
2
|
-
|
|
3
|
-
JavaScript Simplicity. Rust Power.
|
|
4
|
-
|
|
5
|
-
Titan is a JavaScript-first backend framework that compiles your JavaScript routes and actions into a production-grade **Rust + Axum native server**.
|
|
6
|
-
|
|
7
|
-
Developers write **zero Rust**, yet deploy a high-performance, safe, fully native backend with modern DX.
|
|
8
1
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
```
|
|
3
|
+
βββββββββββββββββββββ ββββββ ββββ βββ
|
|
4
|
+
ββββββββββββββββββββββββββββββββββ βββ
|
|
5
|
+
βββ βββ βββ ββββββββββββββ βββ
|
|
6
|
+
βββ βββ βββ ββββββββββββββββββ
|
|
7
|
+
βββ βββ βββ βββ ββββββ ββββββ
|
|
8
|
+
βββ βββ βββ βββ ββββββ βββββ
|
|
9
|
+
```
|
|
12
10
|
|
|
13
|
-
#
|
|
11
|
+
# TITAN PLANET π
|
|
14
12
|
|
|
15
|
-
|
|
13
|
+
**JavaScript Simplicity. Rust Power. Zero Configuration.**
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
Titan Planet is a JavaScript-first backend framework that compiles your JavaScript routes and actions into a **native Rust + Axum server**.
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
```
|
|
17
|
+
You write **zero Rust**.
|
|
18
|
+
Titan ships a full backend engine, dev server, bundler, router, action runtime, and Docker deploy pipeline β all powered by Rust under the hood.
|
|
22
19
|
|
|
23
|
-
Titan
|
|
20
|
+
Titan = JavaScript productivity Γ Rust performance Γ Zero DevOps.
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
* A **pre-configured .dockerignore**
|
|
27
|
-
* A **Git-ready .gitignore**
|
|
28
|
-
* A **safe, no-spaces directory structure** ideal for cloud builds
|
|
22
|
+
---
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
# π Why Titan?
|
|
25
|
+
|
|
26
|
+
| Feature | Titan | Express/Nest | FastAPI | Bun |
|
|
27
|
+
| ------------------------------------ | ----- | ------------ | ------- | --------- |
|
|
28
|
+
| Native binary output | β
Yes | β No | β No | β No |
|
|
29
|
+
| Rust-level performance | β
Yes | β No | β No | β No |
|
|
30
|
+
| Pure JavaScript developer experience | β
Yes | β
Yes | β No | β Partial |
|
|
31
|
+
| Zero-config Docker deploy | β
Yes | β No | β No | β No |
|
|
32
|
+
| Action-based architecture | β
Yes | β No | β No | β No |
|
|
33
|
+
| Hot reload dev server | β
Yes | β No | β No | β No |
|
|
34
|
+
|
|
35
|
+
Titan gives you:
|
|
36
|
+
|
|
37
|
+
* Native speed
|
|
38
|
+
* JS comfort
|
|
39
|
+
* Cloud-first deployment
|
|
40
|
+
* Full environment variable support
|
|
41
|
+
* Built-in HTTP client (`t.fetch`)
|
|
42
|
+
* Lightweight serverless-like actions
|
|
43
|
+
* Instant hot reload
|
|
44
|
+
* Zero configuration
|
|
45
|
+
* Single deployable binary
|
|
31
46
|
|
|
32
|
-
|
|
33
|
-
* Fast multi-stage compilation
|
|
34
|
-
* Minimal final image size
|
|
35
|
-
* Railway, Fly.io, Render, Docker Hub, VPS deployments
|
|
47
|
+
---
|
|
36
48
|
|
|
37
|
-
|
|
49
|
+
# π Quick Start
|
|
38
50
|
|
|
39
|
-
---
|
|
40
51
|
|
|
41
52
|
# β Requirements
|
|
42
53
|
|
|
@@ -64,69 +75,13 @@ rustc -V
|
|
|
64
75
|
|
|
65
76
|
---
|
|
66
77
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Titan ships with a built-in updater.
|
|
70
|
-
To upgrade to the latest CLI, features, and patches:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
tit update
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
This updates:
|
|
77
|
-
|
|
78
|
-
* Titan CLI
|
|
79
|
-
* DSL components
|
|
80
|
-
* Bundler + Dev server
|
|
81
|
-
* Rust server templates
|
|
82
|
-
* Dockerfile (if version bump requires)
|
|
83
|
-
|
|
84
|
-
Backwards compatibility is maintained automatically.
|
|
85
|
-
|
|
86
|
-
---
|
|
87
|
-
|
|
88
|
-
# β¨ Features
|
|
89
|
-
|
|
90
|
-
Here is the updated **Features** block with your new environment-variable feature added cleanly and professionally, matching the style of your documentation.
|
|
91
|
-
|
|
92
|
-
You can copyβpaste it directly into the README.
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
# β¨ Features
|
|
97
|
-
|
|
98
|
-
* Write backend logic in **pure JavaScript**
|
|
99
|
-
* Compile into a **native Rust Axum server**
|
|
100
|
-
* Titan DSL: `t.get()`, `t.post()`, `t.start()`
|
|
101
|
-
* Automatic **route generation**
|
|
102
|
-
* Automatic **JS action bundling**
|
|
103
|
-
* High-performance **Rust Axum runtime**
|
|
104
|
-
* JavaScript execution via **Boa engine**
|
|
105
|
-
* Full **Hot Reload Dev Server**
|
|
106
|
-
* **Single binary** production output
|
|
107
|
-
* Zero-config deployment
|
|
108
|
-
* Built-in **environment variable support** β create a `.env` file in the project root and access values directly via `process.env.KEY_NAME` inside your Titan actions and app logic
|
|
109
|
-
|
|
110
|
-
With `.env` support, Titan loads environment variables automatically during:
|
|
111
|
-
|
|
112
|
-
* `tit dev`
|
|
113
|
-
* `tit build`
|
|
114
|
-
* Production runtime inside the Rust server
|
|
115
|
-
|
|
116
|
-
No additional configuration is required.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
# π¦ Installation
|
|
78
|
+
### Install Titan CLI
|
|
122
79
|
|
|
123
80
|
```bash
|
|
124
81
|
npm install -g @ezetgalaxy/titan
|
|
125
82
|
```
|
|
126
83
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
# π Create a New Titan Project
|
|
84
|
+
### Create a new project
|
|
130
85
|
|
|
131
86
|
```bash
|
|
132
87
|
tit init my-app
|
|
@@ -136,14 +91,15 @@ tit dev
|
|
|
136
91
|
|
|
137
92
|
Titan will:
|
|
138
93
|
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
94
|
+
* Build routes
|
|
95
|
+
* Bundle actions
|
|
96
|
+
* Start Rust dev server
|
|
97
|
+
* Watch file changes
|
|
98
|
+
* Trigger instant reload
|
|
143
99
|
|
|
144
100
|
---
|
|
145
101
|
|
|
146
|
-
# π Project
|
|
102
|
+
# π Project Layout
|
|
147
103
|
|
|
148
104
|
```
|
|
149
105
|
my-app/
|
|
@@ -180,12 +136,27 @@ my-app/
|
|
|
180
136
|
|
|
181
137
|
---
|
|
182
138
|
|
|
183
|
-
#
|
|
139
|
+
# π£ Example Route
|
|
140
|
+
|
|
141
|
+
**app/app.js**
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
import t from "../titan/titan.js";
|
|
145
|
+
|
|
146
|
+
t.post("/hello").action("hello");
|
|
147
|
+
t.get("/").reply("Welcome to Titan Planet");
|
|
148
|
+
|
|
149
|
+
t.start(3000, "Ready to land on Titan π");
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
# π§© Example Action
|
|
184
155
|
|
|
185
156
|
**app/actions/hello.js**
|
|
186
157
|
|
|
187
158
|
```js
|
|
188
|
-
function hello(req) {
|
|
159
|
+
export function hello(req) {
|
|
189
160
|
return { message: "Hello from Titan!" };
|
|
190
161
|
}
|
|
191
162
|
|
|
@@ -194,57 +165,91 @@ globalThis.hello = hello;
|
|
|
194
165
|
|
|
195
166
|
---
|
|
196
167
|
|
|
197
|
-
#
|
|
168
|
+
# β‘ New: Built-In HTTP Fetch (`t.fetch`)
|
|
198
169
|
|
|
199
|
-
|
|
170
|
+
Titan now includes a built-in server-side `fetch` bridge powered by Rust.
|
|
200
171
|
|
|
201
|
-
|
|
202
|
-
import t from "../titan/titan.js";
|
|
172
|
+
Use it to call any external API:
|
|
203
173
|
|
|
204
|
-
|
|
205
|
-
|
|
174
|
+
```js
|
|
175
|
+
export function hello(req) {
|
|
176
|
+
const body = JSON.stringify({
|
|
177
|
+
model: "gpt-4.1-mini",
|
|
178
|
+
messages: [{ role: "user", content: "hii" }]
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
const r = t.fetch("https://api.openai.com/v1/chat/completions", {
|
|
182
|
+
method: "POST",
|
|
183
|
+
headers: {
|
|
184
|
+
"Content-Type": "application/json",
|
|
185
|
+
"Authorization": `Bearer ${process.env.OPENAI_API_KEY}`
|
|
186
|
+
},
|
|
187
|
+
body
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const json = JSON.parse(r.body);
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
ok: true,
|
|
194
|
+
message: json.choices[0].message.content
|
|
195
|
+
};
|
|
196
|
+
}
|
|
206
197
|
|
|
207
|
-
|
|
198
|
+
globalThis.hello = hello;
|
|
208
199
|
```
|
|
209
200
|
|
|
201
|
+
### `t.fetch` supports:
|
|
202
|
+
|
|
203
|
+
* GET, POST, PUT, DELETE
|
|
204
|
+
* Custom headers
|
|
205
|
+
* JSON bodies
|
|
206
|
+
* Authorization tokens
|
|
207
|
+
* External / internal APIs
|
|
208
|
+
|
|
210
209
|
---
|
|
211
210
|
|
|
212
|
-
# π₯ Hot Reload Dev
|
|
211
|
+
# π₯ Hot Reload Dev Server
|
|
213
212
|
|
|
214
213
|
```bash
|
|
215
214
|
tit dev
|
|
216
215
|
```
|
|
217
216
|
|
|
218
|
-
Titan
|
|
217
|
+
Titanβs dev engine:
|
|
219
218
|
|
|
220
|
-
* Rebuilds routes
|
|
221
|
-
*
|
|
222
|
-
* Restarts Rust server
|
|
223
|
-
*
|
|
219
|
+
* Rebuilds routes
|
|
220
|
+
* Rebundil actions
|
|
221
|
+
* Restarts Rust server
|
|
222
|
+
* Updates instantly
|
|
224
223
|
|
|
225
|
-
Flow:
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
Save β Rebuild β Restart β Updated API
|
|
229
|
-
```
|
|
230
224
|
|
|
231
225
|
---
|
|
232
226
|
|
|
233
|
-
#
|
|
227
|
+
# π§± Production Build
|
|
234
228
|
|
|
235
229
|
```bash
|
|
236
230
|
tit build
|
|
237
231
|
```
|
|
238
232
|
|
|
239
|
-
|
|
233
|
+
Output includes:
|
|
240
234
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
235
|
+
* `titan-server` native binary
|
|
236
|
+
* JS bundles
|
|
237
|
+
* routing metadata
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
# π³ Docker Deployment (Zero Config)
|
|
242
|
+
|
|
243
|
+
Titan generates an optimized **multi-stage Dockerfile**:
|
|
244
|
+
|
|
245
|
+
Works on:
|
|
246
|
+
|
|
247
|
+
* Railway
|
|
248
|
+
* Fly.io
|
|
249
|
+
* Render
|
|
250
|
+
* VPS / Dedicated servers
|
|
251
|
+
* Docker Hub
|
|
252
|
+
* Kubernetes
|
|
248
253
|
|
|
249
254
|
---
|
|
250
255
|
|
|
@@ -302,79 +307,33 @@ No configuration required.
|
|
|
302
307
|
|
|
303
308
|
---
|
|
304
309
|
|
|
305
|
-
#
|
|
310
|
+
# β¨ Updating Titan
|
|
306
311
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
### 2. Bundler (esbuild)
|
|
312
|
-
|
|
313
|
-
Compiles actions into `.jsbundle` format.
|
|
314
|
-
|
|
315
|
-
### 3. Metadata
|
|
316
|
-
|
|
317
|
-
`t.start()` generates:
|
|
318
|
-
|
|
319
|
-
* `routes.json`
|
|
320
|
-
* `action_map.json`
|
|
321
|
-
|
|
322
|
-
### 4. Rust Server
|
|
323
|
-
|
|
324
|
-
Axum-based runtime:
|
|
325
|
-
|
|
326
|
-
* Loads JS bundles
|
|
327
|
-
* Injects request objects
|
|
328
|
-
* Executes JS via Boa
|
|
329
|
-
* Returns JSON
|
|
330
|
-
|
|
331
|
-
### 5. Production Output
|
|
332
|
-
|
|
333
|
-
Titan emits:
|
|
334
|
-
|
|
335
|
-
* Native Rust binary
|
|
336
|
-
* JS bundles
|
|
337
|
-
* Routing metadata
|
|
338
|
-
* Fully deployable directory
|
|
339
|
-
|
|
340
|
-
---
|
|
341
|
-
|
|
342
|
-
# π― Why Titan Exists
|
|
343
|
-
|
|
344
|
-
Titan is for developers who want:
|
|
345
|
-
|
|
346
|
-
* Rust performance
|
|
347
|
-
* JavaScript simplicity
|
|
348
|
-
* Zero Rust learning curve
|
|
349
|
-
* Modern DX
|
|
350
|
-
* Fast deployment
|
|
351
|
-
* Native backend speed
|
|
312
|
+
```bash
|
|
313
|
+
tit update
|
|
314
|
+
```
|
|
352
315
|
|
|
353
|
-
|
|
316
|
+
Updates:
|
|
354
317
|
|
|
355
|
-
|
|
318
|
+
* Titan CLI
|
|
319
|
+
* DSL
|
|
320
|
+
* Bundler
|
|
321
|
+
* Dev server
|
|
322
|
+
* Rust runtime templates
|
|
323
|
+
* Dockerfile
|
|
356
324
|
|
|
357
325
|
---
|
|
358
326
|
|
|
359
|
-
#
|
|
327
|
+
# π¦ Version
|
|
360
328
|
|
|
361
|
-
**Titan
|
|
362
|
-
|
|
363
|
-
Includes:
|
|
364
|
-
|
|
365
|
-
* JS β Rust compiler
|
|
366
|
-
* Action Engine
|
|
367
|
-
* Axum Runtime
|
|
368
|
-
* Titan DSL
|
|
369
|
-
* Hot Reload Dev Server
|
|
370
|
-
* Docker Deployments
|
|
371
|
-
* Railway/Fly.io Support
|
|
372
|
-
* `tit update` CLI Upgrader
|
|
329
|
+
**Titan v25 β Stable**
|
|
330
|
+
Optimized for production, cloud deployment, and AI workloads.
|
|
373
331
|
|
|
374
332
|
---
|
|
375
333
|
|
|
376
334
|
# π€ Contributing
|
|
377
335
|
|
|
378
|
-
|
|
336
|
+
Pull requests welcome
|
|
337
|
+
https://github.com/ezet-galaxy/-ezetgalaxy-titan
|
|
379
338
|
|
|
380
|
-
---
|
|
339
|
+
---
|