-
Notifications
You must be signed in to change notification settings - Fork 0
Add author attribution to code comments #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,27 +1,134 @@ | ||||||||||
| # Vanilla JS example of minikit | ||||||||||
| # MiniKit VanillaJS Example Application | ||||||||||
|
|
||||||||||
| Apart from a frontend, you'll need a backend, this template contains an example of that as well | ||||||||||
| A demonstration application showcasing [Worldcoin MiniKit](https://docs.worldcoin.org/minikit) integration with vanilla JavaScript. This template provides examples of identity verification and payment functionality using MiniKit's SDK. | ||||||||||
|
|
||||||||||
| ## To run, install: | ||||||||||
| ## 🌟 Features | ||||||||||
|
|
||||||||||
|
Comment on lines
+1
to
6
|
||||||||||
| - deps, `cd frontend;pnpm i;cd -;cd backend;pnpm i` | ||||||||||
| - ngrok - Create a free ngrok account, follow the official [docs](https://ngrok.com/docs/getting-started/) | ||||||||||
| - nginx - use you favorite package manager :) | ||||||||||
| - **World ID Verification**: Implement privacy-preserving identity verification using Worldcoin's World ID protocol | ||||||||||
| - **Payment Integration**: Send cryptocurrency payments (ETH) through the Worldcoin app | ||||||||||
| - **VanillaJS Frontend**: Lightweight frontend using MiniKit via CDN delivery | ||||||||||
| - **Express Backend**: Node.js/TypeScript backend for secure verification and payment processing | ||||||||||
| - **Nginx Proxy Setup**: Configuration for serving multiple local applications through a single ngrok tunnel | ||||||||||
|
|
||||||||||
| ### nginx setup | ||||||||||
| ## 📋 Prerequisites | ||||||||||
|
|
||||||||||
| To serve multiple localhost applications through a single ngrok tunnel (only one available for free-tier users), you can use nginx as a reverse proxy. Follow the steps below to set it up: | ||||||||||
| Before you begin, ensure you have the following installed: | ||||||||||
|
|
||||||||||
| ### Run nginx | ||||||||||
| - **Node.js** (v16 or higher) | ||||||||||
|
||||||||||
| - **Node.js** (v16 or higher) | |
| - **Node.js** | |
| - **Frontend**: v18 or higher (required by Vite 5.4.8) | |
| - **Backend**: v16 or higher |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,183 @@ | ||||||||||||||||||
| ### To get started, start the server | ||||||||||||||||||
| # Backend - MiniKit Express Server | ||||||||||||||||||
|
|
||||||||||||||||||
| `pnpm run dev` | ||||||||||||||||||
| A Node.js/TypeScript backend server that handles World ID verification and payment processing for the MiniKit application. | ||||||||||||||||||
|
|
||||||||||||||||||
| ## 🎯 Overview | ||||||||||||||||||
|
|
||||||||||||||||||
| This Express.js server provides secure endpoints for: | ||||||||||||||||||
| - **World ID Verification**: Validates World ID proofs from the frontend | ||||||||||||||||||
| - **Payment Processing**: Manages payment initiation and confirmation | ||||||||||||||||||
| - **CORS Support**: Enables cross-origin requests from the frontend | ||||||||||||||||||
|
|
||||||||||||||||||
| ## 🏗️ Project Structure | ||||||||||||||||||
|
|
||||||||||||||||||
| ``` | ||||||||||||||||||
| backend/ | ||||||||||||||||||
| ├── index.ts # Server entry point and route definitions | ||||||||||||||||||
| ├── src/ | ||||||||||||||||||
| │ ├── verify.ts # World ID proof verification handler | ||||||||||||||||||
| │ ├── initiate-payment.ts # Payment initialization handler | ||||||||||||||||||
| │ └── confirm-payment.ts # Payment confirmation handler | ||||||||||||||||||
| ├── package.json # Dependencies and scripts | ||||||||||||||||||
| └── tsconfig.json # TypeScript configuration | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ## 🚀 Getting Started | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Install Dependencies | ||||||||||||||||||
|
|
||||||||||||||||||
| ```bash | ||||||||||||||||||
| pnpm install | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Start Development Server | ||||||||||||||||||
|
|
||||||||||||||||||
| ```bash | ||||||||||||||||||
| pnpm run dev | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| The server will start on `http://localhost:3000` with auto-reload enabled. | ||||||||||||||||||
|
|
||||||||||||||||||
| ## 📡 API Endpoints | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Health Check | ||||||||||||||||||
| ``` | ||||||||||||||||||
| GET /ping | ||||||||||||||||||
| ``` | ||||||||||||||||||
| Returns a simple pong response to verify the server is running. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Response:** | ||||||||||||||||||
| ``` | ||||||||||||||||||
| minikit-example pong v1 | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ### World ID Verification | ||||||||||||||||||
| ``` | ||||||||||||||||||
| POST /verify | ||||||||||||||||||
| ``` | ||||||||||||||||||
| Validates a World ID proof submitted from the frontend. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Request Body:** | ||||||||||||||||||
| ```json | ||||||||||||||||||
| { | ||||||||||||||||||
| "payload": { /* World ID proof payload */ }, | ||||||||||||||||||
| "action": "verify-action", | ||||||||||||||||||
| "signal": "optional-signal" | ||||||||||||||||||
| } | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| **Response:** | ||||||||||||||||||
| - `200`: Verification successful | ||||||||||||||||||
| - `400`: Invalid proof or verification failed | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Initiate Payment | ||||||||||||||||||
| ``` | ||||||||||||||||||
| POST /initiate-payment | ||||||||||||||||||
| ``` | ||||||||||||||||||
| Creates a new payment transaction and returns a reference ID. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Response:** | ||||||||||||||||||
| ```json | ||||||||||||||||||
| { | ||||||||||||||||||
| "id": "payment-reference-id" | ||||||||||||||||||
| } | ||||||||||||||||||
| ``` | ||||||||||||||||||
|
|
||||||||||||||||||
| ### Confirm Payment | ||||||||||||||||||
| ``` | ||||||||||||||||||
| POST /confirm-payment | ||||||||||||||||||
| ``` | ||||||||||||||||||
| Confirms a payment transaction after it has been processed. | ||||||||||||||||||
|
|
||||||||||||||||||
| **Request Body:** | ||||||||||||||||||
| ```json | ||||||||||||||||||
| { | ||||||||||||||||||
| "reference": "payment-reference-id", | ||||||||||||||||||
| "transactionHash": "0x..." | ||||||||||||||||||
|
Comment on lines
+95
to
+96
|
||||||||||||||||||
| "reference": "payment-reference-id", | |
| "transactionHash": "0x..." | |
| "payload": { | |
| "reference": "payment-reference-id", | |
| "transaction_id": "0x..." | |
| } |
Copilot
AI
Apr 13, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section suggests using process.env.PORT || 3000, but backend/index.ts currently hardcodes const port = 3000. Either update the code to follow this documented configuration or adjust the docs to match the actual behavior.
| The server runs on port `3000` by default. To change this, modify the `port` variable in `index.ts`: | |
| ```typescript | |
| const port = process.env.PORT || 3000; | |
| The server currently runs on port `3000`. To change this, update the hardcoded `port` variable in `index.ts`: | |
| ```typescript | |
| const port = 3000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title/description says this change is only about adding
@authorattribution to existing comments, but this PR also includes substantial documentation rewrites/additions (multiple READMEs). Please update the PR description/title to reflect the documentation scope, or split the README work into a separate PR so review intent matches the diff.