@ezetgalaxy/titan 26.7.5 → 26.8.2

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.
Files changed (53) hide show
  1. package/README.md +86 -200
  2. package/index.js +87 -23
  3. package/package.json +4 -3
  4. package/templates/js/_gitignore +37 -0
  5. package/templates/{package.json → js/package.json} +3 -0
  6. package/templates/{server → js/server}/actions/hello.jsbundle +4 -1
  7. package/templates/{server → js/server}/src/extensions.rs +149 -17
  8. package/templates/{server → js/server}/src/main.rs +1 -6
  9. package/templates/{titan → js/titan}/bundle.js +22 -9
  10. package/templates/js/titan/dev.js +258 -0
  11. package/templates/js/titan/titan.js +122 -0
  12. package/templates/rust/Dockerfile +66 -0
  13. package/templates/rust/_dockerignore +3 -0
  14. package/templates/rust/_gitignore +37 -0
  15. package/templates/rust/app/actions/hello.js +5 -0
  16. package/templates/rust/app/actions/rust_hello.rs +14 -0
  17. package/templates/rust/app/app.js +11 -0
  18. package/templates/rust/app/titan.d.ts +101 -0
  19. package/templates/rust/jsconfig.json +19 -0
  20. package/templates/rust/package.json +13 -0
  21. package/templates/rust/server/Cargo.lock +2869 -0
  22. package/templates/rust/server/Cargo.toml +39 -0
  23. package/templates/rust/server/action_map.json +3 -0
  24. package/templates/rust/server/actions/hello.jsbundle +47 -0
  25. package/templates/rust/server/routes.json +22 -0
  26. package/templates/rust/server/src/action_management.rs +131 -0
  27. package/templates/rust/server/src/actions_rust/mod.rs +19 -0
  28. package/templates/rust/server/src/actions_rust/rust_hello.rs +14 -0
  29. package/templates/rust/server/src/errors.rs +10 -0
  30. package/templates/rust/server/src/extensions.rs +989 -0
  31. package/templates/rust/server/src/main.rs +437 -0
  32. package/templates/rust/server/src/utils.rs +33 -0
  33. package/templates/rust/titan/bundle.js +157 -0
  34. package/templates/rust/titan/dev.js +266 -0
  35. package/templates/{titan → rust/titan}/titan.js +122 -98
  36. package/titanpl-sdk/templates/Dockerfile +4 -17
  37. package/titanpl-sdk/templates/server/src/extensions.rs +218 -423
  38. package/titanpl-sdk/templates/server/src/main.rs +68 -134
  39. package/templates/_gitignore +0 -25
  40. package/templates/titan/dev.js +0 -144
  41. /package/templates/{Dockerfile → js/Dockerfile} +0 -0
  42. /package/templates/{.dockerignore → js/_dockerignore} +0 -0
  43. /package/templates/{app → js/app}/actions/hello.js +0 -0
  44. /package/templates/{app → js/app}/app.js +0 -0
  45. /package/templates/{app → js/app}/titan.d.ts +0 -0
  46. /package/templates/{jsconfig.json → js/jsconfig.json} +0 -0
  47. /package/templates/{server → js/server}/Cargo.lock +0 -0
  48. /package/templates/{server → js/server}/Cargo.toml +0 -0
  49. /package/templates/{server → js/server}/action_map.json +0 -0
  50. /package/templates/{server → js/server}/routes.json +0 -0
  51. /package/templates/{server → js/server}/src/action_management.rs +0 -0
  52. /package/templates/{server → js/server}/src/errors.rs +0 -0
  53. /package/templates/{server → js/server}/src/utils.rs +0 -0
package/README.md CHANGED
@@ -16,17 +16,18 @@
16
16
 
17
17
  ---
18
18
 
19
- # TITAN PLANET 🚀
19
+ # TITAN PLANET 🚀
20
20
 
21
21
  [![npm version](https://img.shields.io/npm/v/@ezetgalaxy/titan.svg?style=flat-square)](https://www.npmjs.com/package/@ezetgalaxy/titan)
22
22
 
23
23
 
24
- **JavaScript Simplicity. Rust Power. Zero Configuration.**
24
+ **JavaScript Simplicity. Native Rust Power. Zero Configuration.**
25
25
 
26
- Titan Planet is a JavaScript-first backend framework that embeds JS actions into a Rust + Axum server and ships as a single native binary. Routes are compiled to static metadata; only actions run in the embedded JS runtime. No Node.js. No event loop in production.
26
+ Titan Planet is a **JavaScript-first Backend Framework** that compiles your application into a single, high-performance native binary. It embeds a V8 JavaScript runtime directly into a specialized Rust + Axum server.
27
27
 
28
- You write **zero Rust**.
29
- Titan ships a full backend engine, dev server, bundler, router, action runtime, and Docker deploy pipeline — all powered by Rust under the hood.
28
+ **Start with pure JavaScript.**
29
+ **Need raw power? Add Rust actions seamlessly.**
30
+ Titan handles the compilation, bundling, and routing automatically for both.
30
31
 
31
32
  Titan = **JavaScript productivity × Rust performance × Zero DevOps**
32
33
 
@@ -37,253 +38,138 @@ Titan = **JavaScript productivity × Rust performance × Zero DevOps**
37
38
  | Feature | Titan | Express/Nest | FastAPI | Bun |
38
39
  | ------------------------------------ | ----- | ------------ | ------- | --------- |
39
40
  | Native binary output | ✅ Yes | ❌ No | ❌ No | ❌ No |
40
- | Rust-level performance | ✅ Yes | ❌ No | ❌ No | ❌ No |
41
+ | Hybrid Rust + JS Actions | ✅ Yes | ❌ No | ❌ No | ❌ No |
41
42
  | Pure JavaScript developer experience | ✅ Yes | ✅ Yes | ❌ No | ❌ Partial |
42
43
  | Zero-config Docker deploy | ✅ Yes | ❌ No | ❌ No | ❌ No |
43
44
  | Action-based architecture | ✅ Yes | ❌ No | ❌ No | ❌ No |
44
45
  | Hot reload dev server | ✅ Yes | ❌ No | ❌ No | ❌ No |
45
46
 
46
- Titan gives you:
47
-
48
- * Native speed
49
- * JS comfort
50
- * Cloud-first deployment
51
- * Full environment variable support
52
- * Built-in HTTP client (`t.fetch`)
53
- * Lightweight serverless-like actions
54
- * Instant hot reload
55
- * Zero configuration
56
- * Single deployable binary
57
-
58
47
  ---
59
48
 
60
49
  # 🚀 Quick Start
61
50
 
51
+ ### 1. Prerequisites
52
+ * **Rust** (latest stable): [Install Rust](https://rust-lang.org/tools/install/)
53
+ * **Node.js** (v18+): Required for CLI and JS tooling.
62
54
 
63
- # Requirements
64
-
65
- Install before using Titan:
66
-
67
- ### 1. Rust (latest stable)
68
-
69
- [https://rust-lang.org/tools/install/](https://rust-lang.org/tools/install/)
70
-
71
- ### 2. Node.js (v18+)
72
-
73
- Required for:
74
-
75
- * Titan CLI
76
- * esbuild
77
- * JS → Rust compilation pipeline
78
-
79
- Verify:
80
-
55
+ ### 2. Install CLI
81
56
  ```bash
82
- node -v
83
- npm -v
84
- rustc -V
57
+ npm install -g @ezetgalaxy/titan
85
58
  ```
86
59
 
87
- ---
88
-
89
- ### Install Titan CLI
90
-
60
+ ### 3. Initialize & Run
91
61
  ```bash
92
- npm install -g @ezetgalaxy/titan
62
+ titan init my-app
63
+ # Follow the interactive prompt to choose:
64
+ # - JavaScript (Standard)
65
+ # - Rust + JavaScript (Beta)
93
66
  ```
94
67
 
95
- ### Create a new project
96
-
68
+ Inside your project:
97
69
  ```bash
98
- titan init my-app
99
70
  cd my-app
100
71
  titan dev
101
72
  ```
102
73
 
103
- Titan will:
74
+ You'll see the Titan Dev Server spin up:
75
+ ```
76
+ Titan Planet v26.8.0 [ Dev Mode ]
77
+
78
+ Type: Rust + JS Actions
79
+ Hot Reload: Enabled
104
80
 
105
- * Build routes
106
- * Bundle actions
107
- * Start Rust dev server
108
- * Watch file changes
109
- * Trigger instant reload
81
+ Preparing runtime... Done
82
+ A new orbit is ready for your app in 0.9s
83
+ Your app is now orbiting Titan Planet
84
+ ```
110
85
 
111
86
  ---
112
87
 
113
- # Update to new version
88
+ # Hybrid Action System
114
89
 
115
- * At first update the cli
90
+ Titan is unique because it allows you to write endpoints in **both** JavaScript and Rust within the same project.
116
91
 
117
- ```bash
118
- npm install -g @ezetgalaxy/titan@latest
92
+ ### 🟡 JavaScript Actions (`app/actions/hello.js`)
93
+ Perfect for business logic, rapid prototyping, and IO-bound tasks.
94
+ ```javascript
95
+ export function run(req) {
96
+ t.log("Handling user request...");
97
+ return {
98
+ message: "Hello from JavaScript!",
99
+ user_id: req.params.id
100
+ };
101
+ }
119
102
  ```
120
- * Then
121
103
 
122
- ```bash
123
- titan update
104
+ ### 🔴 Rust Actions (Beta)
105
+ Perfect for heavy computation, encryption, image processing, or low-level system access.
106
+ > **Note:** The Native Rust Action API is currently in **Beta**.
107
+ ```rust
108
+ use axum::{response::{IntoResponse, Json}, http::Request, body::Body};
109
+ use serde_json::json;
110
+
111
+ pub async fn run(req: Request<Body>) -> impl IntoResponse {
112
+ let result = heavy_computation();
113
+ t.log("Processed 1M records in Rust");
114
+ Json(json!({ "result": result }))
115
+ }
124
116
  ```
125
- * ``tit update`` will update and add new features in your Titan project
126
-
127
-
128
- # ✨ What Titan Can Do (New & Core Features)
129
-
130
- Titan now includes a **complete runtime engine** with the following built-in capabilities:
131
-
132
- ### 🛣 Routing & HTTP
133
-
134
- * Static routes (`/`, `/health`)
135
- * Dynamic routes (`/user/:id<number>`)
136
- * Typed route parameters
137
- * Automatic method matching (GET / POST)
138
- * Query parsing (`req.query`)
139
- * Body parsing (`req.body`)
140
- * Zero-config routing metadata generation
141
117
 
142
- ### 🧠 Action Runtime
118
+ **Titan automatically detects, compiles, and routes both types.**
119
+ * `.js` files are bundled with esbuild.
120
+ * `.rs` files are compiled into the native binary.
121
+ * Both share the same `routes.json` configuration.
143
122
 
144
- * JavaScript actions executed inside a Rust runtime (v8)
145
- * Automatic action discovery and execution
146
- * No `globalThis` required anymore
147
- * Safe handling of `undefined` returns
148
- * JSON serialization guardrails
149
- * Action-scoped execution context
123
+ ---
150
124
 
151
- ### 🔌 Runtime APIs (`t`)
125
+ # Core Capabilities
152
126
 
153
- * `t.fetch(...)` built-in Rust-powered HTTP client
154
- * `t.log(...)` — sandboxed, action-scoped logging
155
- * Environment variable access (`process.env`)
156
- * No access to raw Node.js APIs (safe by default)
127
+ ### 🔌 Unified Runtime API (`t`)
128
+ Both JS and Rust actions have access to the powerful `t` namespace:
157
129
 
158
- ### 🧾 Request Object (`req`)
130
+ * `t.fetch(url, options)` High-performance HTTP client
131
+ * `t.log(msg)` — Sandboxed, structured logging
132
+ * `t.jwt.sign / verify` — Fast JWT operations
133
+ * `t.password.hash / verify` — Secure password handling
134
+ * `t.db` — Database access (coming soon)
159
135
 
160
- Each action receives a normalized request object:
136
+ ### 🛣 Intelligent Routing
137
+ Define your routes in `routes.json`. Titan maps them to the correct action, regardless of language.
161
138
 
162
139
  ```json
163
140
  {
164
- "method": "GET",
165
- "path": "/user/90",
166
- "params": { "id": "90" },
167
- "query": {},
168
- "body": null,
169
-
170
- "headers": {
171
- "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
172
- "accept-encoding": "gzip, deflate, br, zstd",
173
- "accept-language": "en-US,en;q=0.9",
174
- "cache-control": "max-age=0",
175
- "connection": "keep-alive",
176
- "cookie": "",
177
- "host": "localhost:3000",
178
- "sec-ch-ua": "\"Google Chrome\";v=\"143\", \"Chromium\";v=\"143\", \"Not A(Brand\";v=\"24\"",
179
- "sec-ch-ua-mobile": "?0",
180
- "sec-ch-ua-platform": "\"Windows\"",
181
- "sec-fetch-dest": "document",
182
- "sec-fetch-mode": "navigate",
183
- "sec-fetch-site": "none",
184
- "sec-fetch-user": "?1",
185
- "upgrade-insecure-requests": "1",
186
- "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36"
187
- },
141
+ "/hello": "hello", // variable name matches filename (hello.js)
142
+ "/compute": "compute" // variable name matches filename (compute.rs)
188
143
  }
189
144
  ```
190
145
 
191
- This object is:
192
-
193
- * Stable
194
- * Predictable
195
- * Serializable
196
- * Identical across dev & production
197
-
198
- ---
199
-
200
- ### 🔥 Developer Experience
201
-
202
- * Hot reload dev server (`titan dev`)
203
- * Automatic rebundling of actions
204
- * Automatic Rust server restart
205
- * Colored request logs
206
- * Per-route timing metrics
207
- * Action-aware logs
208
-
209
- Example runtime log:
210
-
211
- ```
212
- [Titan] GET /user/90 → getUser (dynamic) in 0.42ms
213
- [Titan] log(getUser): Fetching user 90
214
- ```
215
-
216
- ---
217
-
218
- ### 🧨 Error Handling & Diagnostics
219
-
220
- * JavaScript runtime errors captured safely
221
- * Action-aware error reporting
222
- * Line & column hints from runtime
223
- * Red-colored error logs
224
- * No server crashes on user mistakes
225
- * Safe fallback for `undefined` returns
226
-
227
- ---
228
-
229
- ### ⚙ Build & Deployment
230
-
231
- * Native Rust binary output
232
- * Zero-config Dockerfile generation
233
- * Multi-stage optimized Docker builds
234
- * Works on:
235
-
236
- * Railway
237
- * Fly.io
238
- * Render
239
- * VPS
240
- * Kubernetes
241
- * No Node.js required in production
146
+ ### 🧩 Extensions System
147
+ Extend the runtime with custom Rust engines using **Titan Extensions**.
148
+ * `titan create ext <name>`: Scaffold a new extension.
149
+ * `titan run ext`: Test your extension in a lightweight harness.
242
150
 
243
151
  ---
244
152
 
245
- ---
246
-
247
- ### 🧩 Titan Extensions & Test Harness
153
+ # 📦 Deployment
248
154
 
249
- Titan Planet isn't just a framework; it's an extensible platform. You can build custom extensions to add new native capabilities to the `t` runtime.
155
+ Titan compiles your entire app—JS code, Rust code, and server logic—into a **single executable**.
250
156
 
251
- * **`titan create ext <name>`**: Scaffold a new Titan Extension template (supports JS and Native Rust modules).
252
- * **`titan run ext`**: Launch the **Titan Test Harness**. This provides a "lite" Titan runtime environment that automatically:
253
- * Builds your native Rust code.
254
- * Links your extension to a temporary project.
255
- * Generates a test suite to verify your extension's methods.
256
- * Starts a live server to test extension logic in a real-world scenario.
157
+ * **Tiny Docker Images**: Alpine-based, ~20MB compressed.
158
+ * **Instant Startup**: No node_modules overhead.
159
+ * **Secure**: No access to system APIs from JS unless explicitly bridged.
257
160
 
258
161
  ---
259
162
 
260
- ### 🧱 Architecture Guarantees
261
-
262
- # 🧩 Example Action (Updated No `globalThis` Needed)
263
-
264
- ```js
265
- export function getUser(req) {
266
- t.log("User id:", req.params.id);
267
-
268
- return {
269
- id: Number(req.params.id),
270
- method: req.method
271
- };
272
- }
273
- ```
274
-
275
- That’s it.
276
- No exports wiring. No globals. No boilerplate.
163
+ # 🧱 Architecture Note
164
+ Titan is **not** a Node.js framework. It is a Rust server that speaks JavaScript.
165
+ * **No Event Loop** for JS (Request/Response model).
166
+ * **No `require`** (Use raw imports or bundled dependencies).
167
+ * **True Isolation** per request.
277
168
 
278
169
  ---
279
170
 
280
- # 📦 Version
281
-
282
171
  **Titan v26 — Stable**
172
+ * Production-ready Hybrid Runtime
173
+ * Native Rust Performance
174
+ * Zero-Config Cloud Deployment
283
175
 
284
- * Production-ready runtime
285
- * Safe JS execution
286
- * Native Rust performance
287
- * Designed for cloud & AI workloads
288
-
289
- ---
package/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import prompts from "prompts";
2
3
  import fs from "fs";
3
4
  import path from "path";
4
5
  import { execSync, spawn } from "child_process";
@@ -16,6 +17,7 @@ const green = (t) => `\x1b[32m${t}\x1b[0m`;
16
17
  const yellow = (t) => `\x1b[33m${t}\x1b[0m`;
17
18
  const red = (t) => `\x1b[31m${t}\x1b[0m`;
18
19
  const bold = (t) => `\x1b[1m${t}\x1b[0m`;
20
+ const gray = (t) => `\x1b[90m${t}\x1b[0m`;
19
21
 
20
22
  /* -------------------------------------------------------
21
23
  * Invocation detection (tit vs titan)
@@ -120,26 +122,54 @@ ${yellow("Note: `tit` is supported as a legacy alias.")}
120
122
  /* -------------------------------------------------------
121
123
  * INIT
122
124
  * ----------------------------------------------------- */
123
- function initProject(name) {
125
+ async function initProject(name, templateName) {
124
126
  if (!name) {
125
- console.log(red("Usage: titan init <project>"));
127
+ console.log(red("Usage: titan init <project> [--template <js|rust>]"));
126
128
  return;
127
129
  }
128
130
 
131
+ let selectedTemplate = templateName;
132
+
133
+ if (!selectedTemplate) {
134
+ const response = await prompts({
135
+ type: 'select',
136
+ name: 'value',
137
+ message: 'Select a template:',
138
+ choices: [
139
+ { title: 'JavaScript', description: 'Standard Titan app with JS actions', value: 'js' },
140
+ { title: `Rust + JavaScript ${yellow('(Beta)')}`, description: 'High-performance Rust actions + JS flexibility', value: 'rust' }
141
+ ],
142
+ initial: 0
143
+ });
144
+
145
+ if (!response.value) {
146
+ console.log(red("✖ Operation cancelled"));
147
+ return;
148
+ }
149
+ selectedTemplate = response.value;
150
+ }
151
+
129
152
  const target = path.join(process.cwd(), name);
130
- const templateDir = path.join(__dirname, "templates");
153
+ const templateDir = path.join(__dirname, "templates", selectedTemplate);
154
+
155
+ if (!fs.existsSync(templateDir)) {
156
+ console.log(red(`Template '${selectedTemplate}' not found. Available: js, rust`));
157
+ return;
158
+ }
131
159
 
132
160
  if (fs.existsSync(target)) {
133
161
  console.log(yellow(`Folder already exists: ${target}`));
134
162
  return;
135
163
  }
136
164
 
137
- console.log(cyan(`Creating Titan project → ${target}`));
165
+ console.log("\n" + bold(cyan("🚀 Initializing Titan Project...")));
166
+ console.log(gray(` Target: ${target}`));
167
+ console.log(gray(` Template: ${selectedTemplate === 'rust' ? 'Rust + JS (Native Perf)' : 'JavaScript (Standard)'}`));
138
168
 
139
169
  // ----------------------------------------------------------
140
- // 1. Copy full template directory (excluding extension folder)
170
+ // 1. Copy full template directory
141
171
  // ----------------------------------------------------------
142
- copyDir(templateDir, target, ["extension", "_gitignore", "_dockerignore"]);
172
+ copyDir(templateDir, target, ["_gitignore", "_dockerignore"]);
143
173
 
144
174
  // ----------------------------------------------------------
145
175
  // 2. Explicitly install dotfiles
@@ -164,19 +194,24 @@ function initProject(name) {
164
194
  fs.copyFileSync(dockerfileSrc, path.join(target, "Dockerfile"));
165
195
  }
166
196
 
167
- console.log(green("✔ Titan project created!"));
168
- console.log(cyan("Installing dependencies..."));
197
+ console.log(green("✔ Project structure created"));
198
+ console.log(cyan("📦 Installing dependencies..."));
169
199
 
170
- execSync(`npm install esbuild chokidar --silent`, {
171
- cwd: target,
172
- stdio: "inherit",
173
- });
200
+ try {
201
+ execSync(`npm install esbuild chokidar --silent`, {
202
+ cwd: target,
203
+ stdio: "inherit",
204
+ });
205
+ console.log(green("✔ Dependencies installed"));
206
+ } catch (e) {
207
+ console.log(yellow("⚠ Failed to auto-install dependencies. Please run 'npm install' manually."));
208
+ }
174
209
 
175
- console.log(green(" Dependencies installed"));
210
+ console.log("\n" + bold(green("🎉 You're all set!")));
176
211
  console.log(`
177
- Next steps:
178
- cd ${name}
179
- titan dev
212
+ ${gray("Next steps:")}
213
+ ${cyan(`cd ${name}`)}
214
+ ${cyan("titan dev")}
180
215
  `);
181
216
  }
182
217
 
@@ -278,8 +313,19 @@ function updateTitan() {
278
313
 
279
314
  const projectTitan = path.join(root, "titan");
280
315
  const projectServer = path.join(root, "server");
316
+ const projectPkg = path.join(root, "package.json");
317
+
318
+ let templateType = "js"; // Default
319
+ if (fs.existsSync(projectPkg)) {
320
+ try {
321
+ const pkg = JSON.parse(fs.readFileSync(projectPkg, "utf-8"));
322
+ if (pkg.titan && pkg.titan.template) {
323
+ templateType = pkg.titan.template;
324
+ }
325
+ } catch (e) { }
326
+ }
281
327
 
282
- const templatesRoot = path.join(__dirname, "templates");
328
+ const templatesRoot = path.join(__dirname, "templates", templateType);
283
329
  const templateTitan = path.join(templatesRoot, "titan");
284
330
  const templateServer = path.join(templatesRoot, "server");
285
331
 
@@ -341,15 +387,22 @@ function updateTitan() {
341
387
  console.log(green("✔ Updated server/src/"));
342
388
 
343
389
  // Root-level config files
344
- [".gitignore", ".dockerignore", "Dockerfile", "jsconfig.json"].forEach((file) => {
345
- const src = path.join(templatesRoot, file);
346
- const dest = path.join(root, file);
390
+ const rootFiles = {
391
+ "_gitignore": ".gitignore",
392
+ "_dockerignore": ".dockerignore",
393
+ "Dockerfile": "Dockerfile",
394
+ "jsconfig.json": "jsconfig.json"
395
+ };
396
+
397
+ for (const [srcName, destName] of Object.entries(rootFiles)) {
398
+ const src = path.join(templatesRoot, srcName);
399
+ const dest = path.join(root, destName);
347
400
 
348
401
  if (fs.existsSync(src)) {
349
402
  fs.copyFileSync(src, dest);
350
- console.log(green(`✔ Updated ${file}`));
403
+ console.log(green(`✔ Updated ${destName}`));
351
404
  }
352
- });
405
+ }
353
406
 
354
407
  // app/titan.d.ts (JS typing contract)
355
408
  const appDir = path.join(root, "app");
@@ -473,7 +526,18 @@ if (cmd === "create" && args[1] === "ext") {
473
526
  runExtension();
474
527
  } else {
475
528
  switch (cmd) {
476
- case "init": initProject(args[1]); break;
529
+ case "init": {
530
+ const projName = args[1];
531
+ let tpl = null;
532
+
533
+ const tIndex = args.indexOf("--template") > -1 ? args.indexOf("--template") : args.indexOf("-t");
534
+ if (tIndex > -1 && args[tIndex + 1]) {
535
+ tpl = args[tIndex + 1];
536
+ }
537
+
538
+ initProject(projName, tpl);
539
+ break;
540
+ }
477
541
  case "dev": devServer(); break;
478
542
  case "build": buildProd(); break;
479
543
  case "start": startProd(); break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezetgalaxy/titan",
3
- "version": "26.7.5",
3
+ "version": "26.8.2",
4
4
  "description": "Titan Planet is a JavaScript-first backend framework that embeds JS actions into a Rust + Axum server and ships as a single native binary. Routes are compiled to static metadata; only actions run in the embedded JS runtime. No Node.js. No event loop in production.",
5
5
  "license": "ISC",
6
6
  "author": "ezetgalaxy",
@@ -49,6 +49,7 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "chokidar": "^5.0.0",
52
- "esbuild": "^0.27.2"
52
+ "esbuild": "^0.27.2",
53
+ "prompts": "^2.4.2"
53
54
  }
54
- }
55
+ }
@@ -0,0 +1,37 @@
1
+ # Node & Packages
2
+ node_modules/
3
+ npm-debug.log*
4
+ yarn-debug.log*
5
+ yarn-error.log*
6
+ package-lock.json
7
+ yarn.lock
8
+
9
+ # Titan Runtime (Auto-generated - DO NOT COMMIT)
10
+ titan/server-bin*
11
+ .ext/
12
+ server/routes.json
13
+ server/action_map.json
14
+ server/actions/
15
+ server/titan/
16
+ server/src/actions_rust/
17
+
18
+ # Rust Build Artifacts
19
+ server/target/
20
+ Cargo.lock
21
+
22
+ # OS Files
23
+ .DS_Store
24
+ Thumbs.db
25
+ *.tmp
26
+ *.bak
27
+
28
+ # Environment & Secrets
29
+ .env
30
+ .env.local
31
+ .env.*.local
32
+
33
+ # IDEs
34
+ .vscode/
35
+ .idea/
36
+ *.swp
37
+ *.swo
@@ -3,6 +3,9 @@
3
3
  "version": "1.0.0",
4
4
  "description": "A Titan Planet server",
5
5
  "type": "module",
6
+ "titan": {
7
+ "template": "js"
8
+ },
6
9
  "dependencies": {
7
10
  "chokidar": "^5.0.0",
8
11
  "esbuild": "^0.27.2"
@@ -40,6 +40,9 @@ var __titan_exports = (() => {
40
40
  throw new Error("[Titan] Action 'hello' not found or not a function");
41
41
  }
42
42
 
43
- globalThis["hello"] = fn;
43
+ globalThis["hello"] = function(request_arg) {
44
+ globalThis.req = request_arg;
45
+ return fn(request_arg);
46
+ };
44
47
  })();
45
48