create-bunspace 0.1.0

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 (182) hide show
  1. package/README.md +181 -0
  2. package/dist/bin.js +5755 -0
  3. package/dist/templates/monorepo/CLAUDE.md +164 -0
  4. package/dist/templates/monorepo/LICENSE +21 -0
  5. package/dist/templates/monorepo/MUST-FOLLOW-GUIDELINES.md +269 -0
  6. package/dist/templates/monorepo/README.md +74 -0
  7. package/dist/templates/monorepo/SYNC_VERIFICATION.md +1 -0
  8. package/dist/templates/monorepo/apps/example/package.json +19 -0
  9. package/dist/templates/monorepo/apps/example/src/index.ts +23 -0
  10. package/dist/templates/monorepo/apps/example/src/types/index.ts +7 -0
  11. package/dist/templates/monorepo/apps/example/src/utils/index.ts +7 -0
  12. package/dist/templates/monorepo/core/packages/main/package.json +41 -0
  13. package/dist/templates/monorepo/core/packages/main/rolldown.config.ts +24 -0
  14. package/dist/templates/monorepo/core/packages/main/src/index.ts +80 -0
  15. package/dist/templates/monorepo/core/packages/main/src/types/constants.ts +15 -0
  16. package/dist/templates/monorepo/core/packages/main/src/types/index.ts +8 -0
  17. package/dist/templates/monorepo/core/packages/main/src/types/main.types.ts +25 -0
  18. package/dist/templates/monorepo/core/packages/main/src/utils/index.ts +5 -0
  19. package/dist/templates/monorepo/core/packages/utils/package.json +43 -0
  20. package/dist/templates/monorepo/core/packages/utils/rolldown.config.ts +34 -0
  21. package/dist/templates/monorepo/core/packages/utils/src/index.ts +2 -0
  22. package/dist/templates/monorepo/core/packages/utils/src/logger.ts +68 -0
  23. package/dist/templates/monorepo/core/packages/utils/src/result.ts +146 -0
  24. package/dist/templates/monorepo/core/packages/utils/src/types/constants.ts +15 -0
  25. package/dist/templates/monorepo/core/packages/utils/src/types/index.ts +8 -0
  26. package/dist/templates/monorepo/core/packages/utils/src/types/utils.types.ts +32 -0
  27. package/dist/templates/monorepo/core/packages/utils/src/utils/index.ts +5 -0
  28. package/dist/templates/monorepo/oxlint.json +14 -0
  29. package/dist/templates/monorepo/package.json +39 -0
  30. package/dist/templates/monorepo/tsconfig.json +35 -0
  31. package/dist/templates/telegram-bot/.oxlintrc.json +33 -0
  32. package/dist/templates/telegram-bot/.prettierignore +5 -0
  33. package/dist/templates/telegram-bot/.prettierrc +26 -0
  34. package/dist/templates/telegram-bot/CLAUDE.deploy.md +356 -0
  35. package/dist/templates/telegram-bot/CLAUDE.dev.md +266 -0
  36. package/dist/templates/telegram-bot/CLAUDE.md +280 -0
  37. package/dist/templates/telegram-bot/Dockerfile +46 -0
  38. package/dist/templates/telegram-bot/README.md +245 -0
  39. package/dist/templates/telegram-bot/apps/.gitkeep +0 -0
  40. package/dist/templates/telegram-bot/bun.lock +208 -0
  41. package/dist/templates/telegram-bot/core/.env.example +71 -0
  42. package/dist/templates/telegram-bot/core/README.md +1067 -0
  43. package/dist/templates/telegram-bot/core/package.json +15 -0
  44. package/dist/templates/telegram-bot/core/src/config/env.ts +131 -0
  45. package/dist/templates/telegram-bot/core/src/config/index.ts +97 -0
  46. package/dist/templates/telegram-bot/core/src/config/logging.ts +110 -0
  47. package/dist/templates/telegram-bot/core/src/handlers/control.ts +85 -0
  48. package/dist/templates/telegram-bot/core/src/handlers/health.ts +83 -0
  49. package/dist/templates/telegram-bot/core/src/handlers/logs.ts +126 -0
  50. package/dist/templates/telegram-bot/core/src/index.ts +161 -0
  51. package/dist/templates/telegram-bot/core/src/middleware/auth.ts +41 -0
  52. package/dist/templates/telegram-bot/core/src/middleware/error-handler.ts +41 -0
  53. package/dist/templates/telegram-bot/core/src/middleware/logging.ts +1 -0
  54. package/dist/templates/telegram-bot/core/src/middleware/topics.ts +55 -0
  55. package/dist/templates/telegram-bot/core/src/types/bot.ts +92 -0
  56. package/dist/templates/telegram-bot/core/src/types/constants.ts +50 -0
  57. package/dist/templates/telegram-bot/core/src/types/result.ts +1 -0
  58. package/dist/templates/telegram-bot/core/src/utils/bot-manager.test.ts +111 -0
  59. package/dist/templates/telegram-bot/core/src/utils/bot-manager.ts +201 -0
  60. package/dist/templates/telegram-bot/core/src/utils/commands.ts +63 -0
  61. package/dist/templates/telegram-bot/core/src/utils/formatters.ts +82 -0
  62. package/dist/templates/telegram-bot/core/src/utils/instance-manager.ts +189 -0
  63. package/dist/templates/telegram-bot/core/src/utils/memory.ts +33 -0
  64. package/dist/templates/telegram-bot/core/src/utils/result.ts +26 -0
  65. package/dist/templates/telegram-bot/core/src/utils/telegram.ts +31 -0
  66. package/dist/templates/telegram-bot/core/src/utils/type-guards.ts +71 -0
  67. package/dist/templates/telegram-bot/core/tsconfig.json +9 -0
  68. package/dist/templates/telegram-bot/docker-compose.yml +37 -0
  69. package/dist/templates/telegram-bot/docs/cli-commands.md +377 -0
  70. package/dist/templates/telegram-bot/docs/development.md +363 -0
  71. package/dist/templates/telegram-bot/docs/environment.md +460 -0
  72. package/dist/templates/telegram-bot/docs/examples/middleware-auth.md +335 -0
  73. package/dist/templates/telegram-bot/docs/examples/simple-command.md +207 -0
  74. package/dist/templates/telegram-bot/docs/examples/webhook-setup.md +362 -0
  75. package/dist/templates/telegram-bot/docs/getting-started.md +223 -0
  76. package/dist/templates/telegram-bot/docs/troubleshooting.md +489 -0
  77. package/dist/templates/telegram-bot/package.json +49 -0
  78. package/dist/templates/telegram-bot/packages/utils/package.json +12 -0
  79. package/dist/templates/telegram-bot/packages/utils/src/index.ts +2 -0
  80. package/dist/templates/telegram-bot/packages/utils/src/logger.ts +72 -0
  81. package/dist/templates/telegram-bot/packages/utils/src/result.ts +80 -0
  82. package/dist/templates/telegram-bot/tools/README.md +47 -0
  83. package/dist/templates/telegram-bot/tools/commands/doctor.ts +460 -0
  84. package/dist/templates/telegram-bot/tools/commands/index.ts +35 -0
  85. package/dist/templates/telegram-bot/tools/commands/ngrok.ts +207 -0
  86. package/dist/templates/telegram-bot/tools/commands/setup.ts +368 -0
  87. package/dist/templates/telegram-bot/tools/commands/status.ts +140 -0
  88. package/dist/templates/telegram-bot/tools/index.ts +16 -0
  89. package/dist/templates/telegram-bot/tools/package.json +12 -0
  90. package/dist/templates/telegram-bot/tools/utils/index.ts +13 -0
  91. package/dist/templates/telegram-bot/tsconfig.json +22 -0
  92. package/dist/templates/telegram-bot/vitest.config.ts +29 -0
  93. package/package.json +35 -0
  94. package/templates/monorepo/CLAUDE.md +164 -0
  95. package/templates/monorepo/LICENSE +21 -0
  96. package/templates/monorepo/MUST-FOLLOW-GUIDELINES.md +269 -0
  97. package/templates/monorepo/README.md +74 -0
  98. package/templates/monorepo/apps/example/package.json +19 -0
  99. package/templates/monorepo/apps/example/src/index.ts +23 -0
  100. package/templates/monorepo/apps/example/src/types/index.ts +7 -0
  101. package/templates/monorepo/apps/example/src/utils/index.ts +7 -0
  102. package/templates/monorepo/core/packages/main/package.json +41 -0
  103. package/templates/monorepo/core/packages/main/rolldown.config.ts +24 -0
  104. package/templates/monorepo/core/packages/main/src/index.ts +80 -0
  105. package/templates/monorepo/core/packages/main/src/types/constants.ts +15 -0
  106. package/templates/monorepo/core/packages/main/src/types/index.ts +8 -0
  107. package/templates/monorepo/core/packages/main/src/types/main.types.ts +25 -0
  108. package/templates/monorepo/core/packages/main/src/utils/index.ts +5 -0
  109. package/templates/monorepo/core/packages/utils/package.json +43 -0
  110. package/templates/monorepo/core/packages/utils/rolldown.config.ts +34 -0
  111. package/templates/monorepo/core/packages/utils/src/index.ts +2 -0
  112. package/templates/monorepo/core/packages/utils/src/logger.ts +68 -0
  113. package/templates/monorepo/core/packages/utils/src/result.ts +146 -0
  114. package/templates/monorepo/core/packages/utils/src/types/constants.ts +15 -0
  115. package/templates/monorepo/core/packages/utils/src/types/index.ts +8 -0
  116. package/templates/monorepo/core/packages/utils/src/types/utils.types.ts +32 -0
  117. package/templates/monorepo/core/packages/utils/src/utils/index.ts +5 -0
  118. package/templates/monorepo/oxlint.json +14 -0
  119. package/templates/monorepo/package.json +39 -0
  120. package/templates/monorepo/tsconfig.json +35 -0
  121. package/templates/telegram-bot/.oxlintrc.json +33 -0
  122. package/templates/telegram-bot/.prettierignore +5 -0
  123. package/templates/telegram-bot/.prettierrc +26 -0
  124. package/templates/telegram-bot/CLAUDE.deploy.md +356 -0
  125. package/templates/telegram-bot/CLAUDE.dev.md +266 -0
  126. package/templates/telegram-bot/CLAUDE.md +280 -0
  127. package/templates/telegram-bot/Dockerfile +46 -0
  128. package/templates/telegram-bot/README.md +245 -0
  129. package/templates/telegram-bot/apps/.gitkeep +0 -0
  130. package/templates/telegram-bot/bun.lock +208 -0
  131. package/templates/telegram-bot/core/.env.example +71 -0
  132. package/templates/telegram-bot/core/README.md +1067 -0
  133. package/templates/telegram-bot/core/package.json +15 -0
  134. package/templates/telegram-bot/core/src/config/env.ts +131 -0
  135. package/templates/telegram-bot/core/src/config/index.ts +97 -0
  136. package/templates/telegram-bot/core/src/config/logging.ts +110 -0
  137. package/templates/telegram-bot/core/src/handlers/control.ts +85 -0
  138. package/templates/telegram-bot/core/src/handlers/health.ts +83 -0
  139. package/templates/telegram-bot/core/src/handlers/logs.ts +126 -0
  140. package/templates/telegram-bot/core/src/index.ts +161 -0
  141. package/templates/telegram-bot/core/src/middleware/auth.ts +41 -0
  142. package/templates/telegram-bot/core/src/middleware/error-handler.ts +41 -0
  143. package/templates/telegram-bot/core/src/middleware/logging.ts +1 -0
  144. package/templates/telegram-bot/core/src/middleware/topics.ts +55 -0
  145. package/templates/telegram-bot/core/src/types/bot.ts +92 -0
  146. package/templates/telegram-bot/core/src/types/constants.ts +50 -0
  147. package/templates/telegram-bot/core/src/types/result.ts +1 -0
  148. package/templates/telegram-bot/core/src/utils/bot-manager.test.ts +111 -0
  149. package/templates/telegram-bot/core/src/utils/bot-manager.ts +201 -0
  150. package/templates/telegram-bot/core/src/utils/commands.ts +63 -0
  151. package/templates/telegram-bot/core/src/utils/formatters.ts +82 -0
  152. package/templates/telegram-bot/core/src/utils/instance-manager.ts +189 -0
  153. package/templates/telegram-bot/core/src/utils/memory.ts +33 -0
  154. package/templates/telegram-bot/core/src/utils/result.ts +26 -0
  155. package/templates/telegram-bot/core/src/utils/telegram.ts +31 -0
  156. package/templates/telegram-bot/core/src/utils/type-guards.ts +71 -0
  157. package/templates/telegram-bot/core/tsconfig.json +9 -0
  158. package/templates/telegram-bot/docker-compose.yml +37 -0
  159. package/templates/telegram-bot/docs/cli-commands.md +377 -0
  160. package/templates/telegram-bot/docs/development.md +363 -0
  161. package/templates/telegram-bot/docs/environment.md +460 -0
  162. package/templates/telegram-bot/docs/examples/middleware-auth.md +335 -0
  163. package/templates/telegram-bot/docs/examples/simple-command.md +207 -0
  164. package/templates/telegram-bot/docs/examples/webhook-setup.md +362 -0
  165. package/templates/telegram-bot/docs/getting-started.md +223 -0
  166. package/templates/telegram-bot/docs/troubleshooting.md +489 -0
  167. package/templates/telegram-bot/package.json +49 -0
  168. package/templates/telegram-bot/packages/utils/package.json +12 -0
  169. package/templates/telegram-bot/packages/utils/src/index.ts +2 -0
  170. package/templates/telegram-bot/packages/utils/src/logger.ts +72 -0
  171. package/templates/telegram-bot/packages/utils/src/result.ts +80 -0
  172. package/templates/telegram-bot/tools/README.md +47 -0
  173. package/templates/telegram-bot/tools/commands/doctor.ts +460 -0
  174. package/templates/telegram-bot/tools/commands/index.ts +35 -0
  175. package/templates/telegram-bot/tools/commands/ngrok.ts +207 -0
  176. package/templates/telegram-bot/tools/commands/setup.ts +368 -0
  177. package/templates/telegram-bot/tools/commands/status.ts +140 -0
  178. package/templates/telegram-bot/tools/index.ts +16 -0
  179. package/templates/telegram-bot/tools/package.json +12 -0
  180. package/templates/telegram-bot/tools/utils/index.ts +13 -0
  181. package/templates/telegram-bot/tsconfig.json +22 -0
  182. package/templates/telegram-bot/vitest.config.ts +29 -0
@@ -0,0 +1,363 @@
1
+ # Development Guide
2
+
3
+ Guía completa de desarrollo para extender y modificar el bot.
4
+
5
+ ## Scripts Disponibles
6
+
7
+ | Script | Descripción | Cuándo Usar |
8
+ | ------ | ----------- | ----------- |
9
+ | `bun run dev` | Hot reload desarrollo | Desarrollo activo |
10
+ | `bun run start` | Producción | Testing en producción |
11
+ | `bun run typecheck` | Type-check | Antes de commit |
12
+ | `bun run lint` | Linting | Antes de commit |
13
+ | `bun run build` | Typecheck + lint | Verificación completa |
14
+ | `bun test` | Ejecutar tests | Desarrollo de features |
15
+ | `bun run clean:logs` | Limpiar logs | Debugging |
16
+ | `bun run doctor` | Diagnóstico | Problemas de configuración |
17
+
18
+ ## Hot Reload
19
+
20
+ El comando `bun run dev` usa `--watch` para recarga automática:
21
+
22
+ ```bash
23
+ bun run dev
24
+ ```
25
+
26
+ ### Cómo Funciona
27
+
28
+ 1. **Watch** - Bun monitorea archivos en `core/src/`
29
+ 2. **Detecta cambios** - Al guardar, detecta modificaciones
30
+ 3. **Recompila** - Recompila automáticamente
31
+ 4. **Reinicia** - Reinicia el bot sin intervención manual
32
+
33
+ ### Limitaciones
34
+
35
+ - **No typecheck en vivo** - Solo recompila, no valida tipos
36
+ - **Para typecheck** - Usa `bun run typecheck` en otra terminal
37
+ - **Timeouts** - El bot puede tardar ~2s en reiniciar
38
+
39
+ ### Flujo Recomendado
40
+
41
+ **Terminal 1: Bot con hot reload**
42
+ ```bash
43
+ bun run dev
44
+ ```
45
+
46
+ **Terminal 2: Typecheck continuo**
47
+ ```bash
48
+ bun run typecheck --watch # Si estuviera disponible
49
+ ```
50
+
51
+ ## Agregar Comandos
52
+
53
+ ### 1. Crear Handler
54
+
55
+ **Archivo**: `core/src/handlers/mycommand.ts`
56
+
57
+ ```typescript
58
+ import type { Context } from 'telegraf'
59
+
60
+ export async function handleMyCommand(ctx: Context): Promise<void> {
61
+ const { message } = ctx
62
+ const username = message?.from?.username ?? 'stranger'
63
+
64
+ await ctx.reply(`Hello, ${username}!`)
65
+ }
66
+ ```
67
+
68
+ ### 2. Registrar en Bot
69
+
70
+ **Archivo**: `core/src/index.ts`
71
+
72
+ ```typescript
73
+ import { handleMyCommand } from './handlers/mycommand.js'
74
+
75
+ bot.command('mycommand', handleMyCommand)
76
+ ```
77
+
78
+ ### 3. Probar
79
+
80
+ ```bash
81
+ bun run dev
82
+ # En Telegram: /mycommand
83
+ ```
84
+
85
+ ### Comandos con Argumentos
86
+
87
+ ```typescript
88
+ export async function handleGreet(ctx: Context): Promise<void> {
89
+ const message = ctx.message
90
+ const text = message?.text
91
+ const args = text?.split(' ').slice(1) ?? []
92
+ const name = args[0] ?? 'stranger'
93
+
94
+ await ctx.reply(`Hello, ${name}!`)
95
+ }
96
+ ```
97
+
98
+ Uso: `/greet Alice` → `Hello, Alice!`
99
+
100
+ ## Agregar Middleware
101
+
102
+ ### Middleware Simple
103
+
104
+ **Archivo**: `core/src/middleware/timestamp.ts`
105
+
106
+ ```typescript
107
+ import type { Context, Middleware } from 'telegraf'
108
+
109
+ export function timestamp(): Middleware<Context> {
110
+ return async (ctx, next) => {
111
+ const start = Date.now()
112
+ await next()
113
+ const duration = Date.now() - start
114
+ console.log(`Request took ${duration}ms`)
115
+ }
116
+ }
117
+ ```
118
+
119
+ **Registrar**:
120
+ ```typescript
121
+ import { timestamp } from './middleware/timestamp.js'
122
+
123
+ bot.use(timestamp())
124
+ ```
125
+
126
+ ### Middleware con Auth
127
+
128
+ **Archivo**: `core/src/middleware/admin-only.ts`
129
+
130
+ ```typescript
131
+ import type { Context, Middleware } from 'telegraf'
132
+
133
+ const ADMIN_IDS = ['123456789', '987654321']
134
+
135
+ export function adminOnly(): Middleware<Context> {
136
+ return async (ctx, next) => {
137
+ const userId = ctx.from?.id.toString()
138
+
139
+ if (!userId || !ADMIN_IDS.includes(userId)) {
140
+ await ctx.reply('⛔ You are not authorized')
141
+ return
142
+ }
143
+
144
+ return next()
145
+ }
146
+ }
147
+ ```
148
+
149
+ **Usar**:
150
+ ```typescript
151
+ import { adminOnly } from './middleware/admin-only.js'
152
+
153
+ bot.command('admin', adminOnly(), handleAdmin)
154
+ ```
155
+
156
+ ## Patrones Comunes
157
+
158
+ ### Manejo de Errors con Result Type
159
+
160
+ ```typescript
161
+ import { ok, err, type Result, botError } from '@mks2508/telegram-bot-utils'
162
+
163
+ function divide(a: number, b: number): Result<number> {
164
+ if (b === 0) {
165
+ return err(botError('INVALID_ARGS', 'Cannot divide by zero'))
166
+ }
167
+ return ok(a / b)
168
+ }
169
+
170
+ // En un handler
171
+ export async function handleCalc(ctx: Context): Promise<void> {
172
+ const result = divide(10, 2)
173
+
174
+ if (result.ok) {
175
+ await ctx.reply(`Result: ${result.value}`)
176
+ } else {
177
+ await ctx.reply(`Error: ${result.error.message}`)
178
+ }
179
+ }
180
+ ```
181
+
182
+ ### Logging con Better Logger
183
+
184
+ ```typescript
185
+ import { botLogger, kv, badge } from '@mks2508/telegram-bot-utils'
186
+
187
+ export async function handleMyCommand(ctx: Context): Promise<void> {
188
+ botLogger.info(`${badge('CMD')} /mycommand`, kv({ user: ctx.from.id }))
189
+
190
+ try {
191
+ // ... logic
192
+ botLogger.success('Command executed successfully')
193
+ } catch (error) {
194
+ botLogger.error('Command failed:', error)
195
+ }
196
+ }
197
+ ```
198
+
199
+ ### Async Operations con Timeout
200
+
201
+ ```typescript
202
+ async function fetchWithTimeout(url: string, timeout = 5000): Promise<string> {
203
+ const controller = new AbortController()
204
+ const timeoutId = setTimeout(() => controller.abort(), timeout)
205
+
206
+ try {
207
+ const response = await fetch(url, { signal: controller.signal })
208
+ const text = await response.text()
209
+ return text
210
+ } finally {
211
+ clearTimeout(timeoutId)
212
+ }
213
+ }
214
+ ```
215
+
216
+ ## Debugging
217
+
218
+ ### Logs en Consola
219
+
220
+ El bot usa Better Logger con preset cyberpunk:
221
+
222
+ ```
223
+ [Bot] ℹ Bot started successfully
224
+ [Bot] ✓ Polling for updates...
225
+ [Cmd] ℹ /health from user 123456789
226
+ [Bot] ✓ Health check completed in 45ms
227
+ ```
228
+
229
+ ### Ver Variables de Entorno
230
+
231
+ ```bash
232
+ # Ver todas las variables
233
+ cat core/.env.local
234
+
235
+ # Ver variable específica
236
+ grep TG_BOT_TOKEN core/.env.local
237
+ ```
238
+
239
+ ### Ver Instancias Corriendo
240
+
241
+ ```bash
242
+ bun run cli status
243
+ ```
244
+
245
+ ### Ver Logs Archivados
246
+
247
+ ```bash
248
+ # Logs de info
249
+ cat core/logs/info.log
250
+
251
+ # Logs de error
252
+ cat core/logs/error.log
253
+ ```
254
+
255
+ ### Habilitar Debug Mode
256
+
257
+ En `core/.env.local`:
258
+ ```bash
259
+ TG_DEBUG=true
260
+ LOG_LEVEL=debug
261
+ ```
262
+
263
+ ## Testing
264
+
265
+ ### Escribir Tests
266
+
267
+ **Archivo**: `core/src/handlers/mycommand.test.ts`
268
+
269
+ ```typescript
270
+ import { describe, test, expect } from 'bun:test'
271
+ import { handleMyCommand } from './mycommand.js'
272
+
273
+ describe('handleMyCommand', () => {
274
+ test('debe responder con greeting', async () => {
275
+ const mockCtx = {
276
+ from: { id: 123, username: 'testuser' },
277
+ reply: async (msg: string) => msg,
278
+ }
279
+
280
+ await handleMyCommand(mockCtx as never)
281
+ expect(mockCtx.reply).toHaveBeenCalledWith('Hello, testuser!')
282
+ })
283
+ })
284
+ ```
285
+
286
+ ### Ejecutar Tests
287
+
288
+ ```bash
289
+ # Todos los tests
290
+ bun test
291
+
292
+ # Un archivo específico
293
+ bun test core/src/handlers/mycommand.test.ts
294
+
295
+ # Watch mode
296
+ bun test --watch
297
+
298
+ # Con coverage
299
+ bun test --coverage
300
+ ```
301
+
302
+ ## Antes de Commitear
303
+
304
+ ### Checklist
305
+
306
+ - [ ] `bun run typecheck` → 0 errores
307
+ - [ ] `bun run lint` → 0 warnings, 0 errors
308
+ - [ ] `bun test` → Todos los tests pasan
309
+ - [ ] No `console.log` (usar `botLogger`)
310
+ - [ ] Código formateado
311
+
312
+ ### Precommit Hook (Opcional)
313
+
314
+ ```json
315
+ {
316
+ "scripts": {
317
+ "precommit": "bun run build && bun test"
318
+ }
319
+ }
320
+ ```
321
+
322
+ Usar con Husky o similar:
323
+ ```bash
324
+ npm pkg set scripts.precommit="bun run precommit"
325
+ ```
326
+
327
+ ## Estructura de Archivos
328
+
329
+ ```
330
+ core/src/
331
+ ├── index.ts # Entry point, registro de comandos
332
+ ├── config/
333
+ │ ├── env.ts # Zod schema para env
334
+ │ └── index.ts # Config singleton
335
+ ├── handlers/ # Command handlers
336
+ │ ├── health.ts
337
+ │ ├── control.ts
338
+ │ └── mycommand.ts # Tus comandos aquí
339
+ ├── middleware/ # Telegraf middleware
340
+ │ ├── auth.ts
341
+ │ ├── error-handler.ts
342
+ │ └── mymiddleware.ts # Tu middleware aquí
343
+ ├── types/ # TypeScript types
344
+ │ ├── result.ts # Result type (re-export)
345
+ │ └── bot.ts # Bot-specific types
346
+ └── utils/ # Utilities
347
+ ├── bot-manager.ts # Bot lifecycle
348
+ ├── instance-manager.ts
349
+ └── myutil.ts # Tus utils aquí
350
+ ```
351
+
352
+ ## Recursos Adicionales
353
+
354
+ - **Telegraf Docs** - [telegraf.js.org](https://telegraf.js.org/)
355
+ - **Telegram Bot API** - [core.telegram.org/bots/api](https://core.telegram.org/bots/api)
356
+ - **Better Logger** - [@mks2508/better-logger](https://github.com/mks2508/better-logger)
357
+ - **CLAUDE.dev.md** - [Guía de desarrollo completa](../CLAUDE.dev.md)
358
+
359
+ ## Referencias
360
+
361
+ - [Getting Started](./getting-started.md) - Primeros pasos
362
+ - [CLI Commands](./cli-commands.md) - Comandos CLI
363
+ - [Environment](./environment.md) - Variables de entorno