@ezetgalaxy/titan 25.12.3 β†’ 25.12.5

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 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
- Titan = Rust performance Γ— JavaScript simplicity
10
-
11
- ---
2
+ ```
3
+ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—
4
+ β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•‘β•šβ•β•β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘
5
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘
6
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘
7
+ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
8
+ β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β• β•šβ•β•β•šβ•β• β•šβ•β•β•β•
9
+ ```
12
10
 
13
- # 🐳 Production Docker Support (Pre-built by Titan CLI)
11
+ # TITAN PLANET πŸš€
14
12
 
15
- Titan provides **first-class Docker support automatically**.
13
+ **JavaScript Simplicity. Rust Power. Zero Configuration.**
16
14
 
17
- When you create a project with:
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
- ```bash
20
- tit init my-app
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 generates:
20
+ Titan = JavaScript productivity Γ— Rust performance Γ— Zero DevOps.
24
21
 
25
- * A **pre-configured Dockerfile** (production-ready)
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
- You do **not** need to modify the Dockerfile. It is optimized for:
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
- * Native Rust builds
33
- * Fast multi-stage compilation
34
- * Minimal final image size
35
- * Railway, Fly.io, Render, Docker Hub, VPS deployments
47
+ ---
36
48
 
37
- This ensures **zero-config deployment** anywhere.
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
- # πŸ”„ Updating Titan CLI
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
- * Create the project structure
140
- * Generate routing metadata
141
- * Bundle JS actions
142
- * Start the Rust dev server with hot reload
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 Structure
102
+ # πŸ“ Project Layout
147
103
 
148
104
  ```
149
105
  my-app/
@@ -180,12 +136,27 @@ my-app/
180
136
 
181
137
  ---
182
138
 
183
- # 🧩 Example: Titan Action
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,96 @@ globalThis.hello = hello;
194
165
 
195
166
  ---
196
167
 
197
- # πŸ›£ Example: Routes (Titan DSL)
168
+ # ⚑ New: Built-In HTTP Fetch (`t.fetch`)
198
169
 
199
- **app/app.js**
170
+ Titan now includes a built-in server-side `fetch` bridge powered by Rust.
200
171
 
201
- ```js
202
- import t from "../titan/titan.js";
172
+ Use it to call any external API:
203
173
 
204
- t.post("/hello").action("hello");
205
- t.get("/").reply("Welcome to Titan");
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
- t.start(3000, "Ready to land on Titan Planet πŸš€");
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 Mode
211
+ # πŸ”₯ Hot Reload Dev Server
213
212
 
214
213
  ```bash
215
214
  tit dev
216
215
  ```
217
216
 
218
- Titan Dev Mode:
219
-
220
- * Rebuilds routes automatically
221
- * Rebundles actions
222
- * Restarts Rust server safely
223
- * Provides instant backend hot reload
217
+ Titan’s dev engine:
224
218
 
225
- Flow:
219
+ * Rebuilds routes
220
+ * Rebundi actions
221
+ * Restarts Rust server
222
+ * Updates instantly
226
223
 
227
- ```
228
- Save β†’ Rebuild β†’ Restart β†’ Updated API
229
- ```
230
224
 
231
225
  ---
232
226
 
233
- # 🏭 Production Build
227
+ # 🧱 Production Build
234
228
 
235
229
  ```bash
236
230
  tit build
237
231
  ```
238
232
 
239
- Production output:
233
+ Output includes:
240
234
 
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
+ ```bash
246
+ docker build -t titan-app .
247
+ docker run -p 3000:3000 titan-app
241
248
  ```
242
- server/
243
- titan-server
244
- routes.json
245
- action_map.json
246
- actions/*.jsbundle
247
- ```
249
+
250
+ Works on:
251
+
252
+ * Railway
253
+ * Fly.io
254
+ * Render
255
+ * VPS / Dedicated servers
256
+ * Docker Hub
257
+ * Kubernetes
248
258
 
249
259
  ---
250
260
 
@@ -302,79 +312,32 @@ No configuration required.
302
312
 
303
313
  ---
304
314
 
305
- # 🧠 Internal Architecture
315
+ # ✨ Updating Titan
306
316
 
307
- ### 1. Titan DSL
308
-
309
- Simple JavaScript syntax for writing routes and actions.
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
317
+ ```bash
318
+ tit update
319
+ ```
352
320
 
353
- Titan merges two worlds:
321
+ Updates:
354
322
 
355
- JavaScript productivity Γ— Rust performance.
323
+ * Titan CLI
324
+ * DSL
325
+ * Bundler
326
+ * Dev server
327
+ * Rust runtime templates
328
+ * Dockerfile
356
329
 
357
330
  ---
358
331
 
359
- # πŸ“Œ Version
332
+ # πŸ“¦ Version
360
333
 
361
334
  **Titan v1 β€” Stable**
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
335
+ Optimized for production, cloud deployment, and AI workloads.
373
336
 
374
337
  ---
375
338
 
376
339
  # 🀝 Contributing
377
340
 
378
- Issues, discussions, and pull requests are welcome.
341
+ Pull requests welcome.
379
342
 
380
- ---
343
+ ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezetgalaxy/titan",
3
- "version": "25.12.3",
3
+ "version": "25.12.5",
4
4
  "description": "JavaScript backend framework that compiles your JS into a Rust + Axum server.",
5
5
  "license": "ISC",
6
6
  "author": "ezetgalaxy",
@@ -6,7 +6,7 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
6
6
  && apt-get install -y nodejs
7
7
 
8
8
  # Install Titan CLI AND its required dependencies
9
- RUN npm install -g @ezetgalaxy/titan esbuild chokidar
9
+ RUN npm install -g @ezetgalaxy/titan
10
10
 
11
11
  WORKDIR /app
12
12
 
@@ -14,7 +14,7 @@ WORKDIR /app
14
14
  COPY . .
15
15
 
16
16
  # Install Titan dependencies LOCALLY
17
- RUN npm install esbuild chokidar
17
+ RUN npm install
18
18
 
19
19
  # Build Titan metadata (routes + bundles)
20
20
  RUN tit build