GitHub Action Automated Deployment (Recommended for Developers)
If you want higher control, version traceability, or need to manage the Cloudflare Worker configuration more precisely, GitHub Action is the most robust choice.
📋 Deployment Prerequisites
- License Code: Required to start the system, obtain it from the License Center.
- GitHub Account: Used for hosting source code and running Action CI.
- Cloudflare Account: Provides the Worker runtime environment and generates API tokens.
- CF Hosted Domain (Optional): If you want to bind a custom domain, it must be hosted on CF (otherwise,
*.workers.devis assigned).
🛠️ Deployment Steps
1. Preparation (D1 Database)
Create a database named nodeauth-db in the Cloudflare dashboard and record its Database ID.
- Go to
Storage & Databases->D1->Create Database.
Click to view: Detailed steps to create D1 SQL Database



2. Obtain API Token
- Log in to the Cloudflare Dashboard.
- Go here to get your token.
- Click "Create Token".
- Select the "Edit Cloudflare Workers" template.
- Configure "Account Resources" and "Zone Resources".
- Click "Continue to summary," then click "Create Token".
- Copy the generated token.
Click to view: Detailed steps to obtain a Cloudflare Worker deployment token


3. Configure Repository Secrets
This is the most critical step; never write your core keys directly into your code.
- Go to your GitHub project, click "Settings" -> "Secrets and variables" -> "Actions".
- Click "New repository secret" and add the following sequentially:
| Secret Name | Source / Recommended Value |
|---|---|
CLOUDFLARE_API_TOKEN | The API token you just generated in Cloudflare |
CLOUDFLARE_ACCOUNT_ID | The Account ID displayed on the right side of the Cloudflare Workers dashboard |
CLOUDFLARE_D1_DATABASE_ID | The ID of the nodeauth-db you just created |
CLOUDFLARE_D1_DATABASE_NAME | nodeauth-db |
NODEAUTH_LICENSE | System license code, obtain from license.nextmatrix.app/byos. |
ENCRYPTION_KEY | A random key of at least 32 characters, obtain from tools.nodeauth.io. |
JWT_SECRET | A random key of at least 32 characters, obtain from tools.nodeauth.io. |
OAUTH_ALLOWED_USERS | Allowed login list, e.g., your@example.com |
| OAuth Secrets (Example) | Refer to Login Platform Configuration for details |
OAUTH_GITHUB_CLIENT_ID | Your GitHub Client ID |
OAUTH_GITHUB_CLIENT_SECRET | Your GitHub Client Secret |
OAUTH_GITHUB_REDIRECT_URI | https://your-domain.com/oauth/callback |
Click to view: Secrets Configuration Example

⚙️ Advanced Custom Parameters (Optional)
If you also want to customize the Worker name or bind custom domains, add the optional Secrets below and the workflow will configure them automatically:
| Secret Name | Description | Example Value |
|---|---|---|
CLOUDFLARE_WORKERS_NAME | Custom name for the Worker deployed on Cloudflare (default is nodeauth-worker). | my-2fa-server |
CLOUDFLARE_WORKERS_ROUTES | Bind a custom domain. Format: request_path,domain_suffix (use semicolon ; to separate multiple routes). This requires your domain DNS to be managed by Cloudflare. | 2fa.example.com/*,example.com |
CLOUDFLARE_WORKERS_DEV | Whether to enable Cloudflare's default *.workers.dev domain. If you bind a custom domain and want to completely block access via the original domain, set this to false. | false |
CLOUDFLARE_WORKERS_PREVIEW_URLS | Whether to enable URLs generated for preview branches, typically used for secondary development. | true |
4. Trigger Deployment
- Initial Deployment: Click "Actions" at the top of the project, select the
Deploy to Cloudflare Workersworkflow, and click "Run workflow". - Subsequent Updates: Every time you push code to the
mainbranch, GitHub will automatically complete the deployment and sync the database for you.
Click to view: Manual Deployment Trigger Example

💡 Why Choose GitHub Action?
- Transparent Deployment: Every deployment has log records, making errors clear at a glance.
- Secure Secrets: All keys are stored with high-strength encryption by GitHub. Even if the repository is made public, the keys remain protected.
- Continuous Integration: Automated testing and preview mechanisms ensure that the code you push is always functional.