From 3a921deb272da05b55bb8b89e386877e2dd9b005 Mon Sep 17 00:00:00 2001 From: oonyeje Date: Tue, 7 Jul 2026 04:18:07 +0000 Subject: [PATCH] Update README to reflect TypeScript source structure and dev workflow --- README.md | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b9f8fbc..039145f 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ Services like Square can deliver webhooks but cannot add custom HTTP headers lik One proxy serves all projects — routing is driven entirely by environment variables. +Written in **TypeScript** (`src/server.ts`), compiled to plain JS at build time. + --- ## How it works @@ -19,7 +21,7 @@ https://app-proxy.bsidesolutions.net/square │ │ Express server resolves: │ ROUTE_MAP["/square"] = { apiKeySlot: "square", functionId: "verify_square_webhook" } - │ PROJECT_CREDENTIALS["square"] = { project: "staging-crown-x-ms-monet", key: "..." } + │ PROJECT_CREDENTIALS["square"] = { project: "staging-crown-x-ms-monet", apiKey: "..." } │ ▼ POST https://appwrite.bsidesolutions.net/v1/functions/verify_square_webhook/executions @@ -33,13 +35,19 @@ Appwrite function runs, returns response, proxy returns it to caller. ## Quick start -### Local +### Local development ```bash cp .env.example .env # edit .env to fill in PROJECT_CREDENTIALS and ROUTE_MAP npm install + +# Run with hot-reload TypeScript directly +npm run dev + +# Or build + run compiled output +npm run build npm start ``` @@ -48,7 +56,7 @@ npm start ```bash docker build -t bside-webhook-proxy . docker run --rm -p 3012:3012 \ - -e PROJECT_CREDENTIALS='{"square":{"project":"...","key":"..."}}' \ + -e PROJECT_CREDENTIALS='{"square":{"project":"...","apiKey":"..."}}' \ -e ROUTE_MAP='/square=>{"apiKeySlot":"square","functionId":"verify_square_webhook"}' \ bside-webhook-proxy ``` @@ -57,7 +65,7 @@ docker run --rm -p 3012:3012 \ 1. In Coolify → **Add New Resource** → **Application** → **Public/Private Repo** 2. Point at `bside-solutions/bside-webhook-proxy` -3. Coolify auto-builds the Dockerfile +3. Coolify auto-builds the Dockerfile (multi-stage build compiles TypeScript) 4. Set the domain (e.g. `app-proxy.bsidesolutions.net`) 5. Add environment variables (see [Configuration](#configuration)) 6. Deploy @@ -161,19 +169,20 @@ No code changes needed. --- -## Local development +## Project structure -```bash -npm install -npm start ``` - -To test forwarding: - -```bash -curl -X POST 'http://localhost:3012/square' \ - -H 'Content-Type: application/json' \ - -d '{"test": true}' +bside-webhook-proxy/ +├── src/ +│ └── server.ts # TypeScript source (Express server) +├── dist/ # Compiled JS output (gitignored) +├── server.js # Entry point - requires compiled ./dist/server.js +├── package.json # Build + start scripts, deps +├── tsconfig.json # TypeScript compiler config +├── Dockerfile # Multi-stage build (TypeScript -> JS) +├── docker-compose.yml # Example Coolify deploy snippet +├── .env.example # Sample env vars +└── README.md ``` ---