License Management System
A comprehensive solution for software license management with secure verification capabilities. This system provides separate portals for administrators and users, along with a robust API for license verification in client applications.

AdminUser: testuser AdminPassword: testpass
Features
Admin Portal
- Dashboard: Get a comprehensive overview of your license system with statistics on total users, licenses, active users, and licenses expiring soon.
- User Management: Create, view, and manage users with unique user hashes for authentication.
- License Management: Generate and manage software licenses with detailed controls:
- License key generation
- Expiration dates
- Hardware binding options
- License revocation capabilities
- Software assignment
- Secure Authentication: Admin authentication with role-based permissions.
User Portal
- License Dashboard: Users can view all their licenses in one place.
- License Details: Detailed view of each license with key information:
- License key
- Software name
- Expiration date
- Hardware binding status
- Usage instructions
- Secure Authentication: Simple authentication using a unique user hash.
License Verification API
- Secure Communication: All API requests and responses are encrypted using AES.
- Hardware Binding: Optional hardware ID binding for enhanced security.
- Comprehensive Validation: Checks for license validity, expiration, revocation, and hardware binding.
Tech Stack
- Frontend: Next.js, React, Tailwind CSS, shadcn/ui
- Backend: Next.js API Routes
- Database: PostgreSQL with Prisma ORM
- Authentication: JWT (JSON Web Tokens)
- Security: AES encryption for API communication, reCAPTCHA for form protection
- Charts: Recharts for data visualization
Installation
Prerequisites
- Node.js 18+
- PostgreSQL database
- npm or yarn
Setup Instructions
- Clone the repository:
git clone https://github.com/killcod3/license-management-system.git
cd license-management-system
- Install dependencies:
npm install
# or
yarn install
- Set up environment variables by creating a
.envfile:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/license_management"
# JWT Secret (generate a secure random string)
JWT_SECRET="your-secure-jwt-secret-key"
# AES Secret for License Verification API (generate a secure random string)
AES_SECRET_KEY="your-secure-aes-secret-key"
# Google reCAPTCHA (register at https://www.google.com/recaptcha)
NEXT_PUBLIC_RECAPTCHA_SITE_KEY="your-recaptcha-site-key"
RECAPTCHA_SECRET_KEY="your-recaptcha-secret-key"
- Run database migrations:
npx prisma migrate dev
- Start the development server:
npm run dev
# or
yarn dev
- Visit
http://localhost:3000in your browser to access the application.
First-time Login
When you first run the system and try to login to the admin portal, it will automatically create an owner account with the credentials you provide. This only happens if no admin accounts exist in the system.
Deployment
Build for Production
npm run build
# or
yarn build
Start Production Server
npm start
# or
yarn start
License Verification API
The system includes a secure API for verifying licenses in your software applications. See API Documentation for detailed documentation and examples.
Security Considerations
- All passwords are securely hashed using bcrypt
- JWT tokens are used for authentication and have an 8-hour expiration
- reCAPTCHA protection is implemented on all login forms
- License verification API uses AES encryption for all communication
- Hardware binding adds an additional layer of protection against unauthorized license sharing
Database Schema
Admin Table
id: Unique identifier (CUID)username: Admin username (unique)password: Hashed passwordrole: Admin role ('owner' or 'admin')createdAt: Timestamp of account creationupdatedAt: Timestamp of last update
User Table
id: Unique identifier (CUID)username: User's nameuserHash: Unique hash used for authenticationcreatedAt: Timestamp of account creationupdatedAt: Timestamp of last updatelicenses: Relation to License table
License Table
id: Unique identifier (CUID)licenseKey: Unique license keyuserId: Foreign key to User tablesoftwareName: Name of the softwareexpirationDate: License expiration datehardwareId: Optional hardware identifier for bindinghardwareBindingEnabled: Whether hardware binding is enabledstatus: License status ('active' or 'revoked')createdAt: Timestamp of license creationupdatedAt: Timestamp of last update
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.