@zintrust/core 0.1.0 → 0.1.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.
Files changed (80) hide show
  1. package/README.md +214 -0
  2. package/package.json +4 -34
  3. package/public/index.html +535 -0
  4. package/src/builder/BundleOptimizer.d.ts.map +1 -1
  5. package/src/builder/BundleOptimizer.js +20 -26
  6. package/src/cache/Cache.d.ts.map +1 -1
  7. package/src/cache/Cache.js +4 -2
  8. package/src/cache/drivers/KVDriver.d.ts.map +1 -1
  9. package/src/cache/drivers/KVDriver.js +2 -1
  10. package/src/cache/drivers/MemoryDriver.d.ts.map +1 -1
  11. package/src/cache/drivers/MemoryDriver.js +5 -0
  12. package/src/cli/CLI.d.ts.map +1 -1
  13. package/src/cli/CLI.js +11 -14
  14. package/src/cli/ErrorHandler.d.ts.map +1 -1
  15. package/src/cli/ErrorHandler.js +2 -4
  16. package/src/cli/commands/AddCommand.d.ts +81 -0
  17. package/src/cli/commands/AddCommand.d.ts.map +1 -1
  18. package/src/cli/commands/AddCommand.js +23 -4
  19. package/src/cli/commands/ConfigCommand.d.ts.map +1 -1
  20. package/src/cli/commands/ConfigCommand.js +27 -23
  21. package/src/cli/commands/D1MigrateCommand.d.ts.map +1 -1
  22. package/src/cli/commands/D1MigrateCommand.js +3 -2
  23. package/src/cli/commands/FixCommand.d.ts.map +1 -1
  24. package/src/cli/commands/FixCommand.js +1 -0
  25. package/src/cli/commands/LogsCommand.d.ts.map +1 -1
  26. package/src/cli/commands/LogsCommand.js +3 -5
  27. package/src/cli/commands/MigrateCommand.d.ts.map +1 -1
  28. package/src/cli/commands/MigrateCommand.js +3 -3
  29. package/src/cli/commands/NewCommand.d.ts.map +1 -1
  30. package/src/cli/commands/NewCommand.js +3 -1
  31. package/src/cli/commands/QACommand.d.ts.map +1 -1
  32. package/src/cli/commands/QACommand.js +5 -6
  33. package/src/cli/scaffolding/ControllerGenerator.d.ts.map +1 -1
  34. package/src/cli/scaffolding/ControllerGenerator.js +10 -9
  35. package/src/cli/scaffolding/MigrationGenerator.d.ts.map +1 -1
  36. package/src/cli/scaffolding/MigrationGenerator.js +10 -9
  37. package/src/cli/scaffolding/ModelGenerator.d.ts.map +1 -1
  38. package/src/cli/scaffolding/ModelGenerator.js +10 -9
  39. package/src/cli/scaffolding/ProjectScaffolder.js +1 -1
  40. package/src/cli/scaffolding/ResponseFactoryGenerator.js +1 -1
  41. package/src/cli/scaffolding/RouteGenerator.d.ts.map +1 -1
  42. package/src/cli/scaffolding/RouteGenerator.js +14 -13
  43. package/src/cli/scaffolding/SeederGenerator.js +1 -1
  44. package/src/cli/scaffolding/ServiceIntegrationTestGenerator.d.ts.map +1 -1
  45. package/src/cli/scaffolding/ServiceIntegrationTestGenerator.js +6 -5
  46. package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts +1 -1
  47. package/src/cli/scaffolding/ServiceRequestFactoryGenerator.d.ts.map +1 -1
  48. package/src/cli/scaffolding/ServiceRequestFactoryGenerator.js +2 -2
  49. package/src/cli/scaffolding/ServiceScaffolder.d.ts.map +1 -1
  50. package/src/cli/scaffolding/ServiceScaffolder.js +11 -10
  51. package/src/cli/scaffolding/TemplateEngine.d.ts +10 -3
  52. package/src/cli/scaffolding/TemplateEngine.d.ts.map +1 -1
  53. package/src/cli/scaffolding/TemplateEngine.js +15 -285
  54. package/src/config/SecretsManager.d.ts.map +1 -1
  55. package/src/config/SecretsManager.js +11 -11
  56. package/src/functions/lambda.d.ts.map +1 -1
  57. package/src/functions/lambda.js +6 -1
  58. package/src/http/Request.d.ts +1 -1
  59. package/src/http/Request.d.ts.map +1 -1
  60. package/src/microservices/MicroserviceBootstrap.d.ts.map +1 -1
  61. package/src/microservices/MicroserviceBootstrap.js +6 -5
  62. package/src/microservices/MicroserviceManager.d.ts.map +1 -1
  63. package/src/microservices/MicroserviceManager.js +9 -10
  64. package/src/microservices/PostgresAdapter.d.ts.map +1 -1
  65. package/src/microservices/PostgresAdapter.js +4 -3
  66. package/src/microservices/ServiceBundler.js +3 -3
  67. package/src/microservices/ServiceHealthMonitor.d.ts.map +1 -1
  68. package/src/microservices/ServiceHealthMonitor.js +6 -2
  69. package/src/performance/Benchmark.d.ts.map +1 -1
  70. package/src/performance/Benchmark.js +3 -0
  71. package/src/performance/Optimizer.d.ts.map +1 -1
  72. package/src/performance/Optimizer.js +7 -5
  73. package/src/runtime/RuntimeDetector.d.ts.map +1 -1
  74. package/src/runtime/RuntimeDetector.js +1 -0
  75. package/src/runtime/adapters/DenoAdapter.js +9 -7
  76. package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -1
  77. package/src/runtime/adapters/FargateAdapter.js +4 -4
  78. package/src/runtime/adapters/NodeServerAdapter.d.ts.map +1 -1
  79. package/src/runtime/adapters/NodeServerAdapter.js +7 -7
  80. package/src/templates/project/basic/config/SecretsManager.ts.tpl +22 -14
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # Getting Started with Zintrust
2
+
3
+ Welcome to Zintrust, a production-grade TypeScript backend framework with proven architectural patterns and zero external dependencies.
4
+
5
+ ## Quick Start (2 minutes)
6
+
7
+ ```bash
8
+ # Install @zintrust/core (Zintrust CLI)
9
+ npm install -g @zintrust/core
10
+
11
+ # Create a new project
12
+ zin new my-app
13
+ cd my-app
14
+
15
+ # Start development
16
+ npm run dev
17
+ ```
18
+
19
+ Your API is now running at `http://localhost:3000`
20
+
21
+ ## What is Zintrust?
22
+
23
+ Zintrust is a **zero-dependency** backend framework built on:
24
+
25
+ - ✅ **Pure Node.js** - No Express, Fastify, or external HTTP libraries
26
+ - ✅ **Type-Safe** - Strict TypeScript with 100% type coverage
27
+ - ✅ **Microservices** - Built-in service discovery and orchestration
28
+ - ✅ **Production Ready** - Used in high-traffic applications
29
+
30
+ ## Key Features
31
+
32
+ ### 🚀 Blazing Fast
33
+
34
+ - Native HTTP server - No framework overhead
35
+ - Type-safe queries with automatic SQL injection prevention
36
+ - Efficient memory management with built-in profiling
37
+
38
+ ### 🛡️ Secure by Default
39
+
40
+ - No raw SQL - QueryBuilder enforces parameterized queries
41
+ - Automatic CSRF protection
42
+ - JWT token management
43
+ - XSS vulnerability prevention
44
+
45
+ ### 📊 Observable
46
+
47
+ - Built-in N+1 query detection
48
+ - Memory profiling per request
49
+ - Request tracing across microservices
50
+ - File-based logging system
51
+
52
+ ### 🔧 Developer Friendly
53
+
54
+ - Modern Active Record ORM
55
+ - Fluent routing API with middleware
56
+ - CLI scaffolding (models, migrations, controllers)
57
+ - Comprehensive testing utilities
58
+
59
+ ## Installation
60
+
61
+ ### Prerequisites
62
+
63
+ - Node.js >= 20.0.0
64
+ - Any npm-compatible package manager (npm, yarn, pnpm, bun)
65
+
66
+ ### From npm (Recommended)
67
+
68
+ Zintrust is distributed on npm as `@zintrust/core`.
69
+
70
+ ```bash
71
+ npm install -g @zintrust/core
72
+ zin new my-app
73
+ ```
74
+
75
+ You can install it with any npm-compatible package manager:
76
+
77
+ ```bash
78
+ # npm
79
+ npm install -g @zintrust/core
80
+
81
+ # yarn
82
+ yarn global add @zintrust/core
83
+
84
+ # pnpm
85
+ pnpm add -g @zintrust/core
86
+
87
+ # bun
88
+ bun add -g @zintrust/core
89
+ ```
90
+
91
+ ### From source
92
+
93
+ ```bash
94
+ git clone https://github.com/ZinTrust/ZinTrust.git
95
+ cd ZinTrust
96
+ npm install
97
+ npm run build
98
+ ```
99
+
100
+ ## Create Your First API
101
+
102
+ ### 1. Define a Model
103
+
104
+ ```typescript
105
+ // app/Models/User.ts
106
+ import { Model } from '@zintrust/core';
107
+
108
+ export const User = Model.define({
109
+ table: 'users',
110
+ fillable: ['name', 'email', 'password'],
111
+ hidden: ['password'],
112
+ timestamps: true,
113
+ casts: {
114
+ is_admin: 'boolean',
115
+ },
116
+ });
117
+ ```
118
+
119
+ ### 2. Create a Route
120
+
121
+ ```typescript
122
+ // routes/api.ts
123
+ import { Application } from '@zintrust/core';
124
+ import { User } from '@app/Models/User';
125
+
126
+ export function registerRoutes(app: Application): void {
127
+ const router = app.getRouter();
128
+
129
+ // Get all users
130
+ router.get('/api/users', async (req, res) => {
131
+ const users = await User.all();
132
+ res.json({ data: users });
133
+ });
134
+
135
+ // Get user by ID
136
+ router.get('/api/users/:id', async (req, res) => {
137
+ const user = await User.find(req.getParam('id'));
138
+ if (!user) {
139
+ return res.setStatus(404).json({ error: 'User not found' });
140
+ }
141
+ res.json({ data: user });
142
+ });
143
+
144
+ // Create user
145
+ router.post('/api/users', async (req, res) => {
146
+ const user = await User.create(req.getBody());
147
+ res.setStatus(201).json({ data: user });
148
+ });
149
+ }
150
+ ```
151
+
152
+ ### 3. Run Your API
153
+
154
+ ```bash
155
+ npm run dev
156
+ ```
157
+
158
+ Test it:
159
+
160
+ ```bash
161
+ # Get all users
162
+ curl http://localhost:3000/api/users
163
+
164
+ # Create a user
165
+ curl -X POST http://localhost:3000/api/users \
166
+ -H "Content-Type: application/json" \
167
+ -d '{"name":"John","email":"john@example.com"}'
168
+ ```
169
+
170
+ ## Next Steps
171
+
172
+ - 📖 [Models & ORM](https://zintrust.com/doc/models) - Database patterns and relationships
173
+ - 🛣️ [Routing](https://zintrust.com/doc/routing) - HTTP routing and middleware
174
+ - 🏗️ [Microservices](https://zintrust.com/doc/microservices) - Build distributed systems
175
+ - ⚙️ [CLI Commands](https://zintrust.com/doc/cli-reference) - Code generation and management
176
+ - 📝 [API Reference](https://zintrust.com/doc/api-reference) - Complete API documentation
177
+
178
+ ## Architecture Overview
179
+
180
+ Zintrust uses a proven layered architecture:
181
+
182
+ ```
183
+ ┌─────────────────────────────────┐
184
+ │ HTTP Request/Response │
185
+ ├─────────────────────────────────┤
186
+ │ Router (URL Matching) │
187
+ ├─────────────────────────────────┤
188
+ │ Middleware Pipeline │
189
+ ├─────────────────────────────────┤
190
+ │ Controllers/Handlers │
191
+ ├─────────────────────────────────┤
192
+ │ Service Layer │
193
+ ├─────────────────────────────────┤
194
+ │ ORM Models │
195
+ ├─────────────────────────────────┤
196
+ │ QueryBuilder (Type-Safe SQL) │
197
+ ├─────────────────────────────────┤
198
+ │ Database Adapter │
199
+ ├─────────────────────────────────┤
200
+ │ Native Database Driver │
201
+ └─────────────────────────────────┘
202
+ ```
203
+
204
+ ## Community & Support
205
+
206
+ - 📚 [Documentation](https://zintrust.com)
207
+ - 💬 [Discord Community](https://discord.gg/zintrust)
208
+ - 🐦 [Follow on X](https://x.com/zintrust)
209
+ - 🐛 [Issue Tracker](https://github.com/ZinTrust/ZinTrust/issues)
210
+ - 🤝 [Contributing Guide](./contributing.md)
211
+
212
+ ## License
213
+
214
+ MIT - See [LICENSE](../LICENSE) for details
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@zintrust/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Production-grade TypeScript backend framework for JavaScript",
5
5
  "homepage": "https://zintrust.com",
6
- "private": false,
7
6
  "repository": {
8
7
  "type": "git",
9
8
  "url": "https://github.com/ZinTrust/ZinTrust.git"
@@ -22,7 +21,8 @@
22
21
  },
23
22
  "files": [
24
23
  "bin",
25
- "src"
24
+ "src",
25
+ "public"
26
26
  ],
27
27
  "engines": {
28
28
  "node": ">=20.0.0",
@@ -46,35 +46,5 @@
46
46
  "license": "MIT",
47
47
  "publishConfig": {
48
48
  "access": "public"
49
- },
50
- "dependencies": {
51
- "bcrypt": "^6.0.0",
52
- "better-sqlite3": "^12.5.0",
53
- "chalk": "^5.6.2",
54
- "commander": "^14.0.2",
55
- "inquirer": "^13.1.0",
56
- "jsonwebtoken": "^9.0.3",
57
- "tsx": "^4.21.0"
58
- },
59
- "devDependencies": {
60
- "@codecov/vite-plugin": "^1.9.1",
61
- "@resvg/resvg-js": "^2.6.2",
62
- "@types/bcrypt": "^6.0.0",
63
- "@types/better-sqlite3": "7.6.13",
64
- "@types/jsonwebtoken": "^9.0.10",
65
- "@types/node": "^25.0.3",
66
- "@typescript-eslint/eslint-plugin": "^8.50.0",
67
- "@typescript-eslint/parser": "^8.50.0",
68
- "@vitest/coverage-v8": "^4.0.16",
69
- "eslint": "^9.39.2",
70
- "globals": "^16.5.0",
71
- "husky": "^9.1.7",
72
- "lint-staged": "^16.2.7",
73
- "prettier": "^3.7.4",
74
- "sonarqube-scanner": "^4.3.2",
75
- "tsc-alias": "^1.8.16",
76
- "typescript": "^5.9.3",
77
- "typescript-eslint": "^8.50.0",
78
- "vitest": "^4.0.16"
79
49
  }
80
- }
50
+ }