@@ -19,38 +19,67 @@ If you can write code then create a pull request to this repo and I will review
1919To get started with development:
2020
21211 . ** Fork and clone the repository**
22+
2223 ``` bash
2324 git clone https://github.com/your-username/unthread-webhook-server.git
2425 cd unthread-webhook-server
2526 ```
2627
27282 . ** Install dependencies**
29+
2830 ``` bash
2931 bun install
3032 ```
33+
3134 > β οΈ ** Important** : This project currently uses Bun as the package manager.
3235
33- 3 . ** Set up environment variables**
36+ 3 . ** Install contribute-now (recommended)**
37+
38+ ``` bash
39+ bunx contribute-now setup
40+ ```
41+
42+ > π ** About contribute-now** : This project uses [ contribute-now] ( https://github.com/warengonzaga/contribute-now ) to automate and standardize the git workflow. It helps enforce the Clean Flow workflow and Clean Commit conventions. You can also install it globally with ` bun install -g contribute-now ` or use ` cn ` alias for convenience.
43+
44+ 4 . ** Install GitHub CLI (optional but recommended)**
45+
46+ ``` bash
47+ # macOS
48+ brew install gh
49+
50+ # Windows
51+ choco install gh
52+
53+ # Linux
54+ apt-get install gh
55+ ```
56+
57+ > π ** About GitHub CLI** : Required for full ` contribute-now ` functionality, especially for PR creation and role detection.
58+
59+ 5 . ** Set up environment variables**
3460 - Copy ` .env.example ` to ` .env `
3561 - Fill in the required information as described in the README
62+
3663 ``` bash
3764 cp .env.example .env
3865 ```
3966
40- 4 . ** Start Redis**
67+ 6 . ** Start Redis**
68+
4169 ``` bash
4270 # Choose one option based on your setup
4371 redis-server # Local installation
4472 brew services start redis # macOS
4573 sudo systemctl start redis-server # Linux
4674 docker run -d -p 6379:6379 redis:alpine # Docker
47-
75+
4876 # OR for full Docker setup with proper naming:
4977 docker network create unthread-integration-network
5078 docker-compose up -d redis-webhook
5179 ```
5280
53- 5 . ** Start the project in development mode**
81+ 7 . ** Start the project in development mode**
82+
5483 ``` bash
5584 bun run dev
5685 ```
@@ -89,7 +118,7 @@ bun run test:coverage # Generate coverage report
89118
90119#### ποΈ Project Structure
91120
92- ```
121+ ``` text
93122src/
94123βββ app.ts # Main application entry point
95124βββ config/ # Configuration files
@@ -152,6 +181,7 @@ bun run lint:ci
152181** Comprehensive ESLint Configuration:**
153182
154183This project uses a modern flat config format (` eslint.config.js ` ) with the following capabilities:
184+
155185- ** TypeScript-first** : Full TypeScript-ESLint integration with strict type checking
156186- ** Security-focused** : Multiple security plugins working together to prevent vulnerabilities
157187- ** Customizable** : Tailored rules for webhook server security requirements
@@ -195,13 +225,15 @@ const data: any = response;
195225This project uses [ Bun's built-in test runner] ( https://bun.com/docs/cli/test ) (` bun:test ` ) for automated testing. When contributing:
196226
197227** Automated Testing:**
228+
198229- Write tests for new features and bug fixes
199230- Ensure all tests pass: ` bun run test `
200231- Maintain minimum 80% code coverage: ` bun run test:coverage `
201232- Follow co-located test patterns (e.g., ` signature.ts ` β ` signature.test.ts ` )
202233- Use ` bun run test:watch ` for development
203234
204235** Manual Testing:**
236+
205237- Test your changes using tools like ngrok for webhook testing
206238- Verify Redis connectivity and queue operations
207239- Test HMAC signature verification with valid Unthread events
@@ -233,6 +265,7 @@ This project uses [Bun's built-in test runner](https://bun.com/docs/cli/test) (`
233265### π Documentation
234266
235267Improvements to documentation are always welcome! This includes:
268+
236269- README updates
237270- Code comments
238271- API documentation
@@ -245,6 +278,7 @@ Improvements to documentation are always welcome! This includes:
245278For any security bugs or issues, please create a private security advisory through GitHub's security advisory feature.
246279
247280For other bugs, please create an issue with:
281+
248282- Clear description of the problem
249283- Steps to reproduce
250284- Expected vs actual behavior
@@ -285,50 +319,52 @@ This project uses [`@wgtechlabs/log-engine`](https://github.com/wgtechlabs/log-e
285319** Custom Enterprise Protection:**
286320
287321``` javascript
288- import { LogEngine } from ' @wgtechlabs/log-engine' ;
322+ import { LogEngine } from " @wgtechlabs/log-engine" ;
289323
290324// Add custom patterns for enterprise-specific data
291325LogEngine .addCustomRedactionPatterns ([
292- / internal. * / i , // Matches any field starting with "internal"
293- / company. * / i , // Matches any field starting with "company"
294- / webhook. * / i , // Matches webhook-specific fields
295- / unthread. * / i // Matches unthread-specific fields
326+ / internal. * / i , // Matches any field starting with "internal"
327+ / company. * / i , // Matches any field starting with "company"
328+ / webhook. * / i , // Matches webhook-specific fields
329+ / unthread. * / i , // Matches unthread-specific fields
296330]);
297331
298332// Add dynamic sensitive field names
299333LogEngine .addSensitiveFields ([
300- ' webhookSecret' ,
301- ' unthreadWebhookSecret' ,
302- ' unthreadApiKey' ,
303- ' redisPassword'
334+ " webhookSecret" ,
335+ " unthreadWebhookSecret" ,
336+ " unthreadApiKey" ,
337+ " redisPassword" ,
304338]);
305339```
306340
307341** Secure Logging Examples:**
308342
309343``` javascript
310344// β
Automatic protection - no configuration needed
311- LogEngine .info (' Webhook authentication' , {
312- webhookId: ' 123456789' , // β
Visible
313- webhookSecret: ' secret123' , // β [REDACTED]
314- targetPlatform: ' telegram' , // β
Visible
315- unthreadApiKey: ' key_123' // β [REDACTED]
345+ LogEngine .info (" Webhook authentication" , {
346+ webhookId: " 123456789" , // β
Visible
347+ webhookSecret: " secret123" , // β [REDACTED]
348+ targetPlatform: " telegram" , // β
Visible
349+ unthreadApiKey: " key_123" , // β [REDACTED]
316350});
317351
318352// β
Event processing protection
319- LogEngine .info (' Event processing' , {
320- eventType: ' message_created' , // β
Visible
321- eventId: ' evt_001' , // β
Visible
322- signature: ' sha256=...' , // β [REDACTED]
323- payload: { /* large data */ } // Automatically truncated
353+ LogEngine .info (" Event processing" , {
354+ eventType: " message_created" , // β
Visible
355+ eventId: " evt_001" , // β
Visible
356+ signature: " sha256=..." , // β [REDACTED]
357+ payload: {
358+ /* large data */
359+ }, // Automatically truncated
324360});
325361
326362// β
Redis queue security
327- LogEngine .info (' Queue publishing' , {
328- queueName: ' unthread-events' , // β
Visible
329- platform: ' unthread' , // β
Visible
330- redisUrl: ' redis://localhost' , // β [REDACTED]
331- eventCount: 5 // β
Visible
363+ LogEngine .info (" Queue publishing" , {
364+ queueName: " unthread-events" , // β
Visible
365+ platform: " unthread" , // β
Visible
366+ redisUrl: " redis://localhost" , // β [REDACTED]
367+ eventCount: 5 , // β
Visible
332368});
333369```
334370
@@ -370,16 +406,16 @@ LOG_TRUNCATION_TEXT="... [CONFIDENTIAL_TRUNCATED]"
370406
371407``` javascript
372408// β οΈ Use with caution - bypasses all redaction
373- LogEngine .debugRaw (' Full webhook payload' , {
374- password: ' visible' , // β οΈ Visible (not redacted)
375- apiKey: ' full-key-visible' // β οΈ Visible (not redacted)
409+ LogEngine .debugRaw (" Full webhook payload" , {
410+ password: " visible" , // β οΈ Visible (not redacted)
411+ apiKey: " full-key-visible" , // β οΈ Visible (not redacted)
376412});
377413
378414// Temporary redaction bypass
379- LogEngine .withoutRedaction ().info (' Debug mode' , sensitiveData);
415+ LogEngine .withoutRedaction ().info (" Debug mode" , sensitiveData);
380416
381417// Test field redaction
382- const isRedacted = LogEngine .testFieldRedaction (' webhookSecret' ); // true
418+ const isRedacted = LogEngine .testFieldRedaction (" webhookSecret" ); // true
383419const currentConfig = LogEngine .getRedactionConfig ();
384420```
385421
0 commit comments