@venizia/ignis-docs 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 (123) hide show
  1. package/mcp-server/dist/common/config.d.ts +27 -0
  2. package/mcp-server/dist/common/config.d.ts.map +1 -0
  3. package/mcp-server/dist/common/config.js +27 -0
  4. package/mcp-server/dist/common/config.js.map +1 -0
  5. package/mcp-server/dist/common/index.d.ts +3 -0
  6. package/mcp-server/dist/common/index.d.ts.map +1 -0
  7. package/mcp-server/dist/common/index.js +19 -0
  8. package/mcp-server/dist/common/index.js.map +1 -0
  9. package/mcp-server/dist/common/paths.d.ts +13 -0
  10. package/mcp-server/dist/common/paths.d.ts.map +1 -0
  11. package/mcp-server/dist/common/paths.js +23 -0
  12. package/mcp-server/dist/common/paths.js.map +1 -0
  13. package/mcp-server/dist/helpers/docs.helper.d.ts +81 -0
  14. package/mcp-server/dist/helpers/docs.helper.d.ts.map +1 -0
  15. package/mcp-server/dist/helpers/docs.helper.js +171 -0
  16. package/mcp-server/dist/helpers/docs.helper.js.map +1 -0
  17. package/mcp-server/dist/helpers/index.d.ts +3 -0
  18. package/mcp-server/dist/helpers/index.d.ts.map +1 -0
  19. package/mcp-server/dist/helpers/index.js +19 -0
  20. package/mcp-server/dist/helpers/index.js.map +1 -0
  21. package/mcp-server/dist/helpers/logger.helper.d.ts +7 -0
  22. package/mcp-server/dist/helpers/logger.helper.d.ts.map +1 -0
  23. package/mcp-server/dist/helpers/logger.helper.js +22 -0
  24. package/mcp-server/dist/helpers/logger.helper.js.map +1 -0
  25. package/mcp-server/dist/index.d.ts +3 -0
  26. package/mcp-server/dist/index.d.ts.map +1 -0
  27. package/mcp-server/dist/index.js +62 -0
  28. package/mcp-server/dist/index.js.map +1 -0
  29. package/mcp-server/dist/tools/base.tool.d.ts +98 -0
  30. package/mcp-server/dist/tools/base.tool.d.ts.map +1 -0
  31. package/mcp-server/dist/tools/base.tool.js +47 -0
  32. package/mcp-server/dist/tools/base.tool.js.map +1 -0
  33. package/mcp-server/dist/tools/get-doc-content.tool.d.ts +30 -0
  34. package/mcp-server/dist/tools/get-doc-content.tool.d.ts.map +1 -0
  35. package/mcp-server/dist/tools/get-doc-content.tool.js +127 -0
  36. package/mcp-server/dist/tools/get-doc-content.tool.js.map +1 -0
  37. package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts +40 -0
  38. package/mcp-server/dist/tools/get-doc-metadata.tool.d.ts.map +1 -0
  39. package/mcp-server/dist/tools/get-doc-metadata.tool.js +121 -0
  40. package/mcp-server/dist/tools/get-doc-metadata.tool.js.map +1 -0
  41. package/mcp-server/dist/tools/index.d.ts +8 -0
  42. package/mcp-server/dist/tools/index.d.ts.map +1 -0
  43. package/mcp-server/dist/tools/index.js +18 -0
  44. package/mcp-server/dist/tools/index.js.map +1 -0
  45. package/mcp-server/dist/tools/list-categories.tool.d.ts +20 -0
  46. package/mcp-server/dist/tools/list-categories.tool.d.ts.map +1 -0
  47. package/mcp-server/dist/tools/list-categories.tool.js +105 -0
  48. package/mcp-server/dist/tools/list-categories.tool.js.map +1 -0
  49. package/mcp-server/dist/tools/list-docs.tool.d.ts +32 -0
  50. package/mcp-server/dist/tools/list-docs.tool.d.ts.map +1 -0
  51. package/mcp-server/dist/tools/list-docs.tool.js +121 -0
  52. package/mcp-server/dist/tools/list-docs.tool.js.map +1 -0
  53. package/mcp-server/dist/tools/search-docs.tool.d.ts +32 -0
  54. package/mcp-server/dist/tools/search-docs.tool.d.ts.map +1 -0
  55. package/mcp-server/dist/tools/search-docs.tool.js +120 -0
  56. package/mcp-server/dist/tools/search-docs.tool.js.map +1 -0
  57. package/package.json +102 -0
  58. package/wiki/get-started/5-minute-quickstart.md +266 -0
  59. package/wiki/get-started/best-practices/api-usage-examples.md +222 -0
  60. package/wiki/get-started/best-practices/architectural-patterns.md +129 -0
  61. package/wiki/get-started/best-practices/code-style-standards.md +122 -0
  62. package/wiki/get-started/best-practices/common-pitfalls.md +136 -0
  63. package/wiki/get-started/best-practices/contribution-workflow.md +145 -0
  64. package/wiki/get-started/best-practices/deployment-strategies.md +121 -0
  65. package/wiki/get-started/best-practices/performance-optimization.md +88 -0
  66. package/wiki/get-started/best-practices/security-guidelines.md +97 -0
  67. package/wiki/get-started/best-practices/troubleshooting-tips.md +100 -0
  68. package/wiki/get-started/building-a-crud-api.md +717 -0
  69. package/wiki/get-started/core-concepts/application.md +168 -0
  70. package/wiki/get-started/core-concepts/components.md +96 -0
  71. package/wiki/get-started/core-concepts/controllers.md +441 -0
  72. package/wiki/get-started/core-concepts/dependency-injection.md +160 -0
  73. package/wiki/get-started/core-concepts/persistent.md +591 -0
  74. package/wiki/get-started/core-concepts/services.md +88 -0
  75. package/wiki/get-started/index.md +65 -0
  76. package/wiki/get-started/mcp-docs-server.md +840 -0
  77. package/wiki/get-started/philosophy.md +123 -0
  78. package/wiki/get-started/prerequisites.md +113 -0
  79. package/wiki/get-started/quickstart.md +382 -0
  80. package/wiki/index.md +48 -0
  81. package/wiki/references/base/application.md +67 -0
  82. package/wiki/references/base/components.md +80 -0
  83. package/wiki/references/base/controllers.md +361 -0
  84. package/wiki/references/base/datasources.md +105 -0
  85. package/wiki/references/base/dependency-injection.md +83 -0
  86. package/wiki/references/base/models.md +104 -0
  87. package/wiki/references/base/repositories.md +118 -0
  88. package/wiki/references/base/services.md +97 -0
  89. package/wiki/references/components/authentication.md +224 -0
  90. package/wiki/references/components/health-check.md +190 -0
  91. package/wiki/references/components/index.md +61 -0
  92. package/wiki/references/components/request-tracker.md +35 -0
  93. package/wiki/references/components/socket-io.md +127 -0
  94. package/wiki/references/components/swagger.md +175 -0
  95. package/wiki/references/helpers/cron.md +94 -0
  96. package/wiki/references/helpers/crypto.md +117 -0
  97. package/wiki/references/helpers/env.md +67 -0
  98. package/wiki/references/helpers/error.md +80 -0
  99. package/wiki/references/helpers/index.md +21 -0
  100. package/wiki/references/helpers/inversion.md +141 -0
  101. package/wiki/references/helpers/logger.md +98 -0
  102. package/wiki/references/helpers/network.md +143 -0
  103. package/wiki/references/helpers/queue.md +131 -0
  104. package/wiki/references/helpers/redis.md +121 -0
  105. package/wiki/references/helpers/socket-io.md +103 -0
  106. package/wiki/references/helpers/storage.md +130 -0
  107. package/wiki/references/helpers/testing.md +115 -0
  108. package/wiki/references/helpers/worker-thread.md +162 -0
  109. package/wiki/references/src-details/core.md +249 -0
  110. package/wiki/references/src-details/dev-configs.md +302 -0
  111. package/wiki/references/src-details/docs.md +61 -0
  112. package/wiki/references/src-details/helpers.md +211 -0
  113. package/wiki/references/src-details/inversion.md +345 -0
  114. package/wiki/references/src-details/mcp-server.md +726 -0
  115. package/wiki/references/utilities/crypto.md +39 -0
  116. package/wiki/references/utilities/date.md +72 -0
  117. package/wiki/references/utilities/index.md +12 -0
  118. package/wiki/references/utilities/module.md +40 -0
  119. package/wiki/references/utilities/parse.md +68 -0
  120. package/wiki/references/utilities/performance.md +64 -0
  121. package/wiki/references/utilities/promise.md +83 -0
  122. package/wiki/references/utilities/request.md +66 -0
  123. package/wiki/references/utilities/schema.md +88 -0
@@ -0,0 +1,145 @@
1
+ # Contribution Workflow
2
+
3
+ Guidelines for contributing to Ignis - help us maintain quality and streamline the process.
4
+
5
+ ## Git Branching Strategy
6
+
7
+ ```
8
+ main (production)
9
+
10
+ │ merge only from develop
11
+
12
+ develop (staging)
13
+
14
+ │ PRs target here
15
+
16
+ feature/*, fix/*, docs/* (your work)
17
+ ```
18
+
19
+ **Important:**
20
+ - ✅ Create PRs to `develop` branch
21
+ - ❌ Do NOT create PRs to `main` branch
22
+ - `main` only accepts merges from `develop`
23
+ - Releases are tagged in git (e.g., `v1.0.0`)
24
+
25
+ ## 1. Setup
26
+
27
+ **Quick start:**
28
+ ```bash
29
+ # 1. Fork the repository on GitHub
30
+
31
+ # 2. Clone your fork
32
+ git clone https://github.com/YOUR_USERNAME/ignis.git
33
+ cd ignis
34
+
35
+ # 3. Install dependencies
36
+ bun install
37
+
38
+ # 4. Add upstream remote
39
+ git remote add upstream https://github.com/VENIZIA-AI/ignis.git
40
+ ```
41
+
42
+ ## 2. Development Workflow
43
+
44
+ ### Step 1: Create Branch
45
+
46
+ ```bash
47
+ # Sync with upstream
48
+ git fetch upstream
49
+ git checkout main
50
+ git merge upstream/main
51
+
52
+ # Create feature branch
53
+ git checkout -b feature/your-feature-name
54
+ ```
55
+
56
+ **Branch naming:**
57
+ | Type | Format | Example |
58
+ |------|--------|---------|
59
+ | Feature | `feature/description` | `feature/add-redis-cache` |
60
+ | Bug fix | `fix/description` | `fix/auth-token-expiry` |
61
+ | Docs | `docs/description` | `docs/update-quickstart` |
62
+ | Chore | `chore/description` | `chore/upgrade-deps` |
63
+
64
+ ### Step 2: Make Changes
65
+
66
+ **Checklist:**
67
+ - ✅ Follow [Code Style Standards](./code-style-standards.md)
68
+ - ✅ Follow [Architectural Patterns](./architectural-patterns.md)
69
+ - ✅ Add tests for new features/fixes
70
+ - ✅ Update docs in `packages/docs/wiki` if needed
71
+
72
+ ### Step 3: Commit
73
+
74
+ Use [Conventional Commits](https://www.conventionalcommits.org/):
75
+
76
+ ```bash
77
+ # Examples
78
+ git commit -m "feat: add Redis caching helper"
79
+ git commit -m "fix: correct JWT token validation"
80
+ git commit -m "docs: update controller examples"
81
+ git commit -m "chore: upgrade Hono to v4.0"
82
+ ```
83
+
84
+ **Commit types:**
85
+ - `feat:` - New feature
86
+ - `fix:` - Bug fix
87
+ - `docs:` - Documentation only
88
+ - `chore:` - Maintenance (deps, config)
89
+ - `refactor:` - Code restructuring
90
+ - `test:` - Adding tests
91
+
92
+ ### Step 4: Validate
93
+
94
+ ```bash
95
+ # Lint and format
96
+ bun run lint:fix
97
+
98
+ # Build TypeScript
99
+ bun run build
100
+
101
+ # Run tests
102
+ bun run test
103
+ ```
104
+
105
+ ## 3. Submit Pull Request
106
+
107
+ ```bash
108
+ # Push your branch
109
+ git push origin feature/your-feature-name
110
+ ```
111
+
112
+ **PR Guidelines:**
113
+
114
+ | Item | Description |
115
+ |------|-------------|
116
+ | **Title** | Use conventional commit format: `feat: add Redis caching` |
117
+ | **Description** | Explain what and why (not just how) |
118
+ | **Link issues** | Reference related issues: `Closes #123` |
119
+ | **Screenshots** | Include for UI changes |
120
+ | **Breaking changes** | Clearly mark and explain |
121
+
122
+ **PR Checklist:**
123
+ - ✅ All tests pass
124
+ - ✅ Code is linted and formatted
125
+ - ✅ Documentation updated
126
+ - ✅ Commit messages follow conventions
127
+ - ✅ Branch is up-to-date with `main`
128
+
129
+ ## 4. Review Process
130
+
131
+ **What to expect:**
132
+ 1. Maintainer reviews your PR (usually within 2-3 days)
133
+ 2. Feedback or change requests may be provided
134
+ 3. Address feedback and push updates
135
+ 4. Once approved, maintainer merges to `main`
136
+
137
+ **Responding to feedback:**
138
+ ```bash
139
+ # Make requested changes
140
+ git add .
141
+ git commit -m "fix: address review feedback"
142
+ git push origin feature/your-feature-name
143
+ ```
144
+
145
+ **Thank you for contributing to Ignis! 🎉**
@@ -0,0 +1,121 @@
1
+ # Deployment Strategies
2
+
3
+ Deploy your Ignis application reliably, securely, and efficiently.
4
+
5
+ ## 1. Building for Production
6
+
7
+ Compile TypeScript to JavaScript before deploying:
8
+
9
+ ```bash
10
+ bun run build
11
+ ```
12
+
13
+ **What this does:**
14
+ 1. `tsc -p tsconfig.json` - Compile TypeScript → JavaScript
15
+ 2. `tsc-alias -p tsconfig.json` - Replace path aliases (`@/*`) with relative paths
16
+
17
+ **Output:** `dist/` folder with production-ready JavaScript.
18
+
19
+ ## 2. Environment Configuration
20
+
21
+ Use environment variables for all configuration - never hard-code.
22
+
23
+ **Production Environment Variables:**
24
+ | Variable | Value | Purpose |
25
+ |----------|-------|---------|
26
+ | `NODE_ENV` | `production` | Enables performance optimizations |
27
+ | `APP_ENV_APPLICATION_SECRET` | Strong random string | Application secret |
28
+ | `APP_ENV_JWT_SECRET` | Strong random string | JWT signing key |
29
+ | `APP_ENV_POSTGRES_*` | Production DB credentials | Database connection |
30
+ | `APP_ENV_SERVER_HOST` | `0.0.0.0` | Accept connections from any IP |
31
+ | `APP_ENV_SERVER_PORT` | `3000` or cloud-assigned | Server port |
32
+
33
+ **Where to store:**
34
+ - **Docker:** Use environment variables in `docker-compose.yml` or secrets
35
+ - **Kubernetes:** ConfigMaps and Secrets
36
+ - **Cloud Platforms:** AWS Secrets Manager, Azure Key Vault, Google Secret Manager
37
+
38
+ ## 3. Deployment Methods
39
+
40
+ ### Docker Deployment (Recommended)
41
+
42
+ **Dockerfile:**
43
+ ```dockerfile
44
+ FROM node:20-slim
45
+
46
+ WORKDIR /usr/src/app
47
+
48
+ # Copy dependency files
49
+ COPY package.json bun.lockb ./
50
+
51
+ # Install production dependencies
52
+ RUN bun install --production
53
+
54
+ # Copy source code
55
+ COPY . .
56
+
57
+ # Build TypeScript
58
+ RUN bun run build
59
+
60
+ # Expose port
61
+ EXPOSE 3000
62
+
63
+ # Start server
64
+ CMD [ "bun", "run", "server:prod" ]
65
+ ```
66
+
67
+ **Build and deploy:**
68
+ ```bash
69
+ # Build image
70
+ docker build -t my-ignis-app .
71
+
72
+ # Run container
73
+ docker run -p 3000:3000 \
74
+ -e NODE_ENV=production \
75
+ -e APP_ENV_APPLICATION_SECRET=xxx \
76
+ my-ignis-app
77
+ ```
78
+
79
+ ### Bun Single Executable (Alternative)
80
+
81
+ Compile your app into a single standalone binary:
82
+
83
+ ```bash
84
+ bun build --compile --minify --target=bun-linux-x64 \
85
+ ./src/index.ts --outfile ./dist/my-app
86
+ ```
87
+
88
+ **Pros:** No dependencies needed on server, simple deployment
89
+ **Cons:** Platform-specific, newer technology (test thoroughly)
90
+
91
+ **Deploy:**
92
+ ```bash
93
+ # Copy executable and .env to server
94
+ scp dist/my-app .env user@server:/app/
95
+
96
+ # Run
97
+ ./my-app
98
+ ```
99
+
100
+ ## 4. Production Best Practices
101
+
102
+ **Use a process manager:**
103
+ - **PM2** - For Node.js/Bun processes
104
+ - **systemd** - Linux service management
105
+ - **Docker/Kubernetes** - Built-in orchestration
106
+
107
+ **Example with PM2:**
108
+ ```bash
109
+ pm2 start dist/index.js --name my-app -i max
110
+ pm2 save
111
+ pm2 startup
112
+ ```
113
+
114
+ **Health checks:**
115
+ Add health check endpoint for load balancers:
116
+ ```typescript
117
+ // In application.ts
118
+ this.component(HealthCheckComponent);
119
+ ```
120
+
121
+ Access at `/health-check` for liveness/readiness probes.
@@ -0,0 +1,88 @@
1
+ # Performance Optimization
2
+
3
+ Optimize your Ignis application for speed and scalability.
4
+
5
+ ## 1. Measure Performance
6
+
7
+ Identify bottlenecks before optimizing:
8
+
9
+ ```typescript
10
+ import { executeWithPerformanceMeasure } from '@venizia/ignis';
11
+
12
+ await executeWithPerformanceMeasure({
13
+ logger: this.logger,
14
+ scope: 'DataProcessing',
15
+ description: 'Process large dataset',
16
+ task: async () => {
17
+ await processLargeDataset();
18
+ },
19
+ });
20
+ ```
21
+
22
+ Logs execution time automatically.
23
+
24
+ > **Deep Dive:** See [Performance Utility](../../references/utilities/performance.md) for advanced profiling.
25
+
26
+ ## 2. Offload CPU-Intensive Tasks
27
+
28
+ Prevent blocking the event loop with Worker Threads:
29
+
30
+ **Use Worker Threads for:**
31
+ - Complex calculations or crypto operations
32
+ - Large file/data processing
33
+ - Any synchronous task > 5ms
34
+
35
+ > **Deep Dive:** See [Worker Thread Helper](../../references/helpers/worker-thread.md) for implementation guide.
36
+
37
+ ## 3. Optimize Database Queries
38
+
39
+ | Technique | Example | Impact |
40
+ |-----------|---------|--------|
41
+ | **Select specific fields** | `fields: { id: true, name: true }` | Reduce data transfer |
42
+ | **Use indexes** | Create indexes on WHERE/JOIN columns | 10-100x faster queries |
43
+ | **Paginate results** | `limit: 20, offset: 0` | Prevent memory overflow |
44
+ | **Eager load relations** | `include: [{ relation: 'creator' }]` | Solve N+1 problem |
45
+
46
+ **Example:**
47
+ ```typescript
48
+ await userRepository.find({
49
+ filter: {
50
+ fields: { id: true, name: true, email: true }, // ✅ Specific fields
51
+ where: { status: 'ACTIVE' },
52
+ limit: 20, // ✅ Pagination
53
+ include: [{ relation: 'profile' }], // ✅ Eager load
54
+ },
55
+ });
56
+ ```
57
+
58
+ ## 4. Implement Caching
59
+
60
+ Reduce database load with caching:
61
+
62
+ | Cache Type | Use Case | Implementation |
63
+ |-----------|----------|----------------|
64
+ | **Redis** | Distributed cache, session storage | [Redis Helper](../../references/helpers/redis.md) |
65
+ | **In-Memory** | Single-process cache | `MemoryStorageHelper` |
66
+
67
+ **Example:**
68
+ ```typescript
69
+ // Cache expensive query results
70
+ const cached = await redis.get('users:active');
71
+ if (!cached) {
72
+ const users = await userRepository.find({ where: { active: true } });
73
+ await redis.set('users:active', users, 300); // 5 min TTL
74
+ }
75
+ ```
76
+
77
+ ## 5. Production Settings
78
+
79
+ | Setting | Value | Why |
80
+ |---------|-------|-----|
81
+ | `NODE_ENV` | `production` | Enables library optimizations |
82
+ | Process Manager | PM2, systemd, Docker | Auto-restart, cluster mode |
83
+ | Cluster Mode | CPU cores | Utilize all CPUs |
84
+
85
+ **PM2 Cluster Mode:**
86
+ ```bash
87
+ pm2 start dist/index.js -i max # Use all CPU cores
88
+ ```
@@ -0,0 +1,97 @@
1
+ # Security Guidelines
2
+
3
+ Critical security practices to protect your Ignis application.
4
+
5
+ ## 1. Secret Management
6
+
7
+ **Never hard-code secrets.** Use environment variables for all sensitive data.
8
+
9
+ | Environment | Where to Store Secrets |
10
+ |-------------|----------------------|
11
+ | Development | `.env` file (add to `.gitignore`) |
12
+ | Production | Cloud provider's secret manager (AWS Secrets Manager, Azure Key Vault, etc.) |
13
+
14
+ **Example `.env`:**
15
+ ```bash
16
+ APP_ENV_APPLICATION_SECRET=your_strong_random_secret_here
17
+ APP_ENV_JWT_SECRET=another_strong_random_secret_here
18
+ APP_ENV_POSTGRES_PASSWORD=database_password_here
19
+ ```
20
+
21
+ **Generate strong secrets:**
22
+ ```bash
23
+ node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
24
+ ```
25
+
26
+ ## 2. Input Validation
27
+
28
+ **Always validate incoming data** with Zod schemas. Ignis automatically rejects invalid requests.
29
+
30
+ ```typescript
31
+ import { z } from '@hono/zod-openapi';
32
+ import { jsonContent, jsonResponse } from '@venizia/ignis';
33
+
34
+ const CreateUserRoute = {
35
+ method: 'post',
36
+ path: '/users',
37
+ request: {
38
+ body: jsonContent({
39
+ schema: z.object({
40
+ email: z.string().email(), // Valid email
41
+ age: z.number().int().min(18), // Adult only
42
+ role: z.enum(['user', 'admin']), // Whitelist
43
+ }),
44
+ }),
45
+ },
46
+ responses: jsonResponse({ /* ... */ }),
47
+ } as const;
48
+ ```
49
+
50
+ **Validation happens automatically** - invalid requests never reach your handler.
51
+
52
+ ## 3. Authentication & Authorization
53
+
54
+ Protect sensitive endpoints with `AuthenticateComponent`.
55
+
56
+ **Setup:**
57
+ ```typescript
58
+ // application.ts
59
+ this.component(AuthenticateComponent);
60
+ ```
61
+
62
+ **Protect routes:**
63
+ ```typescript
64
+ const SecureRoute = {
65
+ path: '/admin/users',
66
+ authStrategies: [Authentication.STRATEGY_JWT], // Requires JWT
67
+ // ...
68
+ };
69
+ ```
70
+
71
+ > **Deep Dive:** See [Authentication Component](../../references/components/authentication.md) for full setup guide.
72
+
73
+ **Access user in protected routes:**
74
+ ```typescript
75
+ const user = c.get(Authentication.CURRENT_USER) as IJWTTokenPayload;
76
+ if (!user.roles.includes('admin')) {
77
+ throw new ApplicationError({ statusCode: 403, message: 'Forbidden' });
78
+ }
79
+ ```
80
+
81
+ ## 4. Secure Dependencies
82
+
83
+ Regularly audit and update dependencies:
84
+
85
+ ```bash
86
+ # Check for vulnerabilities
87
+ bun audit
88
+
89
+ # Update dependencies
90
+ bun update
91
+ ```
92
+
93
+ **Critical packages to keep updated:**
94
+ - `hono` - Web framework
95
+ - `jose` - JWT handling
96
+ - `drizzle-orm` - Database ORM
97
+ - `@venizia/ignis` - Framework core
@@ -0,0 +1,100 @@
1
+ # Troubleshooting Tips
2
+
3
+ Common issues and their solutions when building Ignis applications.
4
+
5
+ ## 1. Application Fails to Start
6
+
7
+ | Symptom | Cause | Solution |
8
+ |---------|-------|----------|
9
+ | App exits immediately | Missing environment variables | Check `.env` file has all required vars (especially `APP_ENV_APPLICATION_SECRET`, `APP_ENV_JWT_SECRET`) |
10
+ | Connection error on startup | Database unreachable | Verify `APP_ENV_POSTGRES_*` values and PostgreSQL is running |
11
+ | `Error: listen EADDRINUSE` | Port already in use | Change `APP_ENV_SERVER_PORT` or stop conflicting process |
12
+
13
+ **Quick fix:**
14
+ ```bash
15
+ # Check if PostgreSQL is running
16
+ psql -U postgres -c "SELECT 1;"
17
+
18
+ # Find process using port 3000
19
+ lsof -ti:3000 | xargs kill -9
20
+ ```
21
+
22
+ ## 2. API Endpoint Returns 404
23
+
24
+ | Cause | Check | Fix |
25
+ |-------|-------|-----|
26
+ | Controller not registered | Missing in `application.ts` | Add `this.controller(MyController)` to `preConfigure()` |
27
+ | Incorrect path | Typo in route path | Verify `@controller({ path })` and route path match URL |
28
+ | Wrong base path | Missing `/api` prefix | Check `path.base` in application config |
29
+
30
+ **Debug routes:**
31
+ ```typescript
32
+ // In application.ts config
33
+ export const appConfigs: IApplicationConfigs = {
34
+ debug: {
35
+ showRoutes: process.env.NODE_ENV !== 'production',
36
+ },
37
+ };
38
+ ```
39
+
40
+ This prints all registered routes on startup.
41
+
42
+ ## 3. Dependency Injection Fails (`Binding not found`)
43
+
44
+ | Cause | Example Error | Fix |
45
+ |-------|--------------|-----|
46
+ | Resource not registered | `Binding 'services.MyService' not found` | Add `this.service(MyService)` to `preConfigure()` |
47
+ | Wrong injection key | Key mismatch or typo | Use `BindingKeys.build()` helper |
48
+ | Wrong namespace | Using `repository` instead of `service` | Check correct namespace in `@inject` |
49
+
50
+ **Debug bindings:**
51
+ ```typescript
52
+ // In postConfigure() method
53
+ async postConfigure(): Promise<void> {
54
+ this.logger.info('Available bindings: %s',
55
+ Array.from(this.bindings.keys())
56
+ );
57
+ }
58
+ ```
59
+
60
+ ## 4. Authentication Fails (401 Unauthorized)
61
+
62
+ | Symptom | Cause | Solution |
63
+ |---------|-------|----------|
64
+ | `401 Unauthorized` on protected route | Missing Authorization header | Add `Authorization: Bearer <token>` header |
65
+ | Token expired | JWT past expiration | Request new token from login endpoint |
66
+ | Invalid signature | Wrong `JWT_SECRET` | Ensure `APP_ENV_JWT_SECRET` matches across services |
67
+ | Malformed header | Missing "Bearer " prefix | Format: `Bearer eyJhbGc...` |
68
+
69
+ **Test with curl:**
70
+ ```bash
71
+ curl -H "Authorization: Bearer YOUR_TOKEN" \
72
+ http://localhost:3000/api/protected-route
73
+ ```
74
+
75
+ ## 5. General Debugging Tips
76
+
77
+ **Enable detailed logging:**
78
+ ```typescript
79
+ // Increase log verbosity
80
+ LoggerFactory.setLevel('debug');
81
+ ```
82
+
83
+ **Common debugging commands:**
84
+ ```bash
85
+ # View application logs
86
+ tail -f logs/app.log
87
+
88
+ # Check TypeScript compilation errors
89
+ bun run build
90
+
91
+ # Validate environment variables
92
+ cat .env | grep APP_ENV
93
+ ```
94
+
95
+ **Useful debugging patterns:**
96
+ - Add `console.log()` in route handlers to trace execution
97
+ - Use `try-catch` blocks to catch and log errors
98
+ - Check database queries with Drizzle's logging: `{ logger: true }`
99
+
100
+ > **Deep Dive:** See [Logger Helper](../../references/helpers/logger.md) for advanced logging configuration.