{"id":24054646,"url":"https://github.com/velyorix/license-server","last_synced_at":"2026-02-09T18:04:59.863Z","repository":{"id":265217698,"uuid":"869183961","full_name":"Velyorix/license-server","owner":"Velyorix","description":"JWT-based License Server for secure license management, ideal for microservices and software projects like MicroManage. Built with Node.js, Express, MySQL, and Sequelize.","archived":false,"fork":false,"pushed_at":"2024-10-08T22:18:14.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T18:41:36.865Z","etag":null,"topics":["authentication","expressjs","jwt","license-management","license-server","microservices","mysql","nodejs","sequelize","software-licensing","web-api"],"latest_commit_sha":null,"homepage":"https://velyorix.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Velyorix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-07T21:27:34.000Z","updated_at":"2024-11-28T09:02:23.000Z","dependencies_parsed_at":"2024-11-30T08:17:05.229Z","dependency_job_id":null,"html_url":"https://github.com/Velyorix/license-server","commit_stats":null,"previous_names":["velyorix/license-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyorix%2Flicense-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyorix%2Flicense-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyorix%2Flicense-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Velyorix%2Flicense-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Velyorix","download_url":"https://codeload.github.com/Velyorix/license-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250322043,"owners_count":21411693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","expressjs","jwt","license-management","license-server","microservices","mysql","nodejs","sequelize","software-licensing","web-api"],"created_at":"2025-01-09T03:49:13.646Z","updated_at":"2026-02-09T18:04:59.836Z","avatar_url":"https://github.com/Velyorix.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# License Server for Microservices Manager\n\nThis open-source project provides a robust implementation of a **license server** designed to generate, validate, edit, and revoke software licenses for projects like **MicroManage** or other microservices management systems.\n\nThe server allows clients to:\n- **Generate software licenses** based on user information, domain, and IP address.\n- **Validate licenses** before allowing access to critical software functionality.\n- **Edit licenses** (update domain, IP, or regenerate the license key).\n- **Revoke licenses** when they are no longer valid.\n- **Regenerate lost licenses** based on the associated domain.\n\n## Features\n- License generation using **JSON Web Tokens (JWT)**, ensuring secure, verifiable, and tamper-proof licenses.\n- Validation of licenses against a central server, tied to specific **domains** and **IP addresses**.\n- License edition (update the domain/IP and optionally regenerate the license key).\n- License regeneration for clients who have lost their license key.\n- Secure API calls with **LICENSE_SECRET** validation to prevent unauthorized access.\n- License expiration system based on **timestamp**.\n\n## Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/YuketsuSh/license-server.git\n   cd license-server\n   ```\n\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n\n3. Create a `.env` file with your license secret and MySQL credentials:\n   ```env\n   DB_HOST=localhost\n   DB_PORT=3306\n   DB_NAME=your_db_name\n   DB_USER=your_db_username\n   DB_PASSWORD=your_db_password\n   LICENSE_SECRET=your_super_secret_key\n   PORT=3000\n   ```\n\n4. Run the server:\n   ```bash\n   npm start\n   ```\n\n## API Endpoints\n\nAll endpoints require a license secret that must be provided in the request headers:\n\n  ```json\n  \"x-license-secret: your_license_secret\"\n  ```\n\nThis secret license key ensures that the request is legitimate and validates the generation, validation, and management of the license.\n\n### 1. License Generation\n- **POST** `/generate`\n\n  This endpoint generates a new license for a user, based on their domain and IP address.\n\n  **Request Body:**\n  ```json\n  {\n    \"user\": \"client_name\",\n    \"domain\": \"client-domain.com\",\n    \"ipAddress\": \"your-server-ip\",\n  }\n  ```\n\n  **Response:**\n  ```json\n  {\n    \"licenseKey\": \"jwt_license_key\"\n  }\n  ```\n\n### 2. License Validation\n- **POST** `/validate`\n\n  This endpoint validates an existing license by checking the associated domain and IP address.\n\n  **Request Body:**\n  ```json\n  {\n    \"licenseKey\": \"jwt_license_key\",\n    \"domain\": \"client-domain.com\",\n    \"ipAddress\": \"client-ip-server\",\n    \"licenseSecret\": \"your_license_secret\"\n  }\n  ```\n\n  **Response (valid):**\n  ```json\n  {\n    \"valid\": true,\n    \"message\": \"License is valid\"\n  }\n  ```\n\n  **Response (invalid):**\n  ```json\n  {\n    \"valid\": false,\n    \"message\": \"License is invalid or domain/IP does not match\"\n  }\n  ```\n\n### 3. License Revocation\n- **POST** `/revoke`\n\n  This endpoint revokes an existing license, preventing it from being used in the future.\n\n  **Request Body:**\n  ```json\n  {\n    \"licenseKey\": \"jwt_license_key\",\n    \"licenseSecret\": \"your_license_secret\"\n  }\n  ```\n\n  **Response:**\n  ```json\n  {\n    \"message\": \"License was revoked successfully\"\n  }\n  ```\n\n### 4. List Licenses\n- **GET** `/`\n\n  This endpoint lists all licenses in the system.\n\n  **Headers:**\n  ```json\n  {\n    \"x-license-secret\": \"your_license_secret\"\n  }\n  ```\n\n  **Response:**\n  ```json\n  [\n    {\n      \"user\": \"client_name\",\n      \"domain\": \"client-domain.com\",\n      \"ipAddress\": \"client-ip-server\",\n      \"licenseKey\": \"jwt_license_key\"\n    },\n    \"...\"\n  ]\n  ```\n\n### 5. License Edition\n- **PUT** `/edit`\n\n  This endpoint allows updating a license's domain, IP address, and optionally regenerating the license key.\n\n  **Request Body:**\n  ```json\n  {\n    \"licenseKey\": \"existing_license_key\",\n    \"newDomain\": \"newdomain.com\",\n    \"newIpAddress\": \"192.168.1.10\",\n    \"regenerateKey\": true,\n    \"licenseSecret\": \"your_license_secret\"\n  }\n  ```\n\n  **Response:**\n  ```json\n  {\n    \"message\": \"License updated successfully\",\n    \"licenseKey\": \"new_or_same_license_key\",\n    \"domain\": \"newdomain.com\",\n    \"ipAddress\": \"192.168.1.10\"\n  }\n  ```\n\n### 6. License Regeneration\n- **POST** `/regenerate`\n\n  This endpoint regenerates a new license key for an existing license using the domain as the search criterion.\n\n  **Request Body:**\n  ```json\n  {\n    \"domain\": \"client-domain.com\",\n    \"licenseSecret\": \"your_license_secret\"\n  }\n  ```\n\n  **Response:**\n  ```json\n  {\n    \"message\": \"License regenerated successfully\",\n    \"newLicenseKey\": \"new_jwt_license_key\"\n  }\n  ```\n\n## Usage\n\nThis license server is designed for use in projects where software access must be restricted to valid license holders. Each license is tied to a **domain** and **IP address** to prevent unauthorized use. The system supports full license management, including **generation**, **validation**, **revocation**, **edition**, and **regeneration**.\n\n## Security Considerations\n\n- All API calls must include the **LICENSE_SECRET** either in the headers or request body. Calls without this secret are denied with a 403 error.\n- Licenses are signed using **JWT** with the **LICENSE_SECRET**, ensuring they cannot be tampered with.\n- Always use **HTTPS** to secure communication between your application and the license server to prevent data interception.\n\n## Contributing\n\nWe welcome contributions! Feel free to open issues or submit pull requests to improve this project.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvelyorix%2Flicense-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvelyorix%2Flicense-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvelyorix%2Flicense-server/lists"}