Skip to content

naix1337/authsysteminsolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Auth System - Full-Stack Forum & KeyAuth Integration

Production-ready authentication and forum system with C++ loader integration, designed for secure software licensing and community management.

License TypeScript NestJS Next.js

🎯 Features

πŸ” Authentication & Security

  • JWT Authentication with refresh token rotation
  • Session Binding to Device + IP + Timestamp
  • Multi-factor Security with device fingerprinting
  • Payload Encryption (AES-256-GCM on top of HTTPS)
  • Anti-Replay Protection with nonce-based system
  • Rate Limiting (Redis-backed)

🎫 License Management

  • Multiple License Types: Trial, Subscription, Lifetime, One-Time
  • Device Binding with configurable device limits
  • HWID Tracking with tolerance for hardware changes
  • Activation Management with automatic expiration
  • License Suspension and shadow banning

πŸ›‘οΈ C++ Loader Integration

  • Secure Handshake protocol (RSA-4096 key exchange)
  • Anti-Debugging detection (IsDebuggerPresent, PEB checks)
  • Anti-VM/Sandbox detection
  • Memory & Binary Integrity validation
  • Self-Checksum verification
  • Complete API Interface with example code

πŸ’¬ Forum System

  • Categories & Threads with soft-delete support
  • RBAC/ABAC Permissions (Role & Attribute-based access control)
  • Thread/Post-level Permissions
  • Markdown Support for rich text
  • Direct Messaging between users
  • File Attachments with size limits

πŸ‘‘ Admin Dashboard

  • User Management (ban, HWID reset, session control)
  • License Management (generate, revoke, view activations)
  • Security Monitoring (audit logs, suspicious activity alerts)
  • Real-time Statistics

πŸ—οΈ Tech Stack

Backend

  • NestJS (TypeScript)
  • PostgreSQL (Database)
  • Redis (Caching, Sessions, Rate Limiting)
  • Prisma (ORM)
  • JWT (Authentication)
  • OpenSSL (Cryptography)

Frontend

  • Next.js 14 (React with App Router)
  • TypeScript
  • TailwindCSS (Dark mode support)
  • Axios (API Client)

C++ Loader

  • CMake (Build System)
  • OpenSSL (libssl, libcrypto)
  • libcurl (HTTP Client)

πŸš€ Quick Start

Prerequisites

  • Node.js 20+
  • Option A: Docker - Docker & Docker Compose
  • Option B: Local - PostgreSQL 16+ & Redis 7+

Option A: Mit Docker (Empfohlen)

1. Clone Repository

git clone https://github.com/naix1337/authsysteminsolution.git
cd authsysteminsolution

2. Start Database Services

docker-compose up -d postgres redis

3. Backend Setup

cd backend
npm install
npx prisma generate
npx prisma migrate dev
npm run start:dev

Backend runs on: http://localhost:3001
API Docs: http://localhost:3001/api/docs

4. Frontend Setup

cd frontend
npm install
npm run dev

Frontend runs on: http://localhost:3000


Option B: Ohne Docker (Lokale Installation)

πŸ“˜ Siehe SETUP-OHNE-DOCKER.md fΓΌr detaillierte Anleitung!

Kurzversion:

  1. Installiere PostgreSQL 16+ und Redis lokal
  2. Erstelle Datenbank: CREATE DATABASE authsystem;
  3. Konfiguriere backend/.env (siehe .env.example)
  4. Backend: npm install && npx prisma migrate dev && npm run start:dev
  5. Frontend: npm install && npm run dev

C++ Loader (Optional)

git clone https://github.com/YOUR_USERNAME/auth-system.git
cd auth-system

2. Start Database Services

docker-compose up -d postgres redis

3. Backend Setup

cd backend
npm install
npx prisma generate
npx prisma migrate dev
npm run start:dev

Backend runs on: http://localhost:3001
API Docs: http://localhost:3001/api/docs

4. Frontend Setup

cd frontend
npm install
npm run dev

Frontend runs on: http://localhost:3000

5. C++ Loader (Optional)

cd cpp-loader
mkdir build && cd build
cmake ..
cmake --build . --config Release

πŸ“ Project Structure

auth-system/
β”œβ”€β”€ backend/              # NestJS Backend API
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ auth/        # Authentication module
β”‚   β”‚   β”œβ”€β”€ loader/      # C++ Loader API
β”‚   β”‚   β”œβ”€β”€ licensing/   # License management
β”‚   β”‚   β”œβ”€β”€ forum/       # Forum features
β”‚   β”‚   β”œβ”€β”€ admin/       # Admin panel
β”‚   β”‚   β”œβ”€β”€ crypto/      # Cryptography utilities
β”‚   β”‚   β”œβ”€β”€ security/    # Security middleware
β”‚   β”‚   └── permissions/ # RBAC/ABAC
β”‚   └── prisma/
β”‚       └── schema.prisma # Database schema (21 tables)
β”‚
β”œβ”€β”€ frontend/            # Next.js Frontend
β”‚   └── src/
β”‚       β”œβ”€β”€ app/         # App router pages
β”‚       β”œβ”€β”€ components/  # Reusable components
β”‚       └── features/    # Feature modules
β”‚
β”œβ”€β”€ cpp-loader/          # C++ Loader Client
β”‚   β”œβ”€β”€ include/         # Header files
β”‚   β”‚   β”œβ”€β”€ protection.h     # Anti-debug/VM
β”‚   β”‚   └── auth_client.h    # API interface
β”‚   β”œβ”€β”€ examples/        # Integration examples
β”‚   └── CMakeLists.txt   # Build configuration
β”‚
β”œβ”€β”€ docs/                # Documentation
β”‚   β”œβ”€β”€ DEPLOYMENT.md    # Production deployment guide
β”‚   └── ...
β”‚
└── docker-compose.yml   # PostgreSQL + Redis

πŸ“Š Database Schema

21 Tables including:

  • Users & Sessions (JWT, Refresh Tokens)
  • Device Fingerprints (HWID tracking)
  • Licenses & Activations (License management)
  • Forum (Categories, Threads, Posts, Likes)
  • Permissions (Roles, RBAC/ABAC)
  • Security (Audit Logs, IP Reputation, Security Events)
  • Admin (Ban Records, Admin Actions)

See prisma/schema.prisma for complete schema.


πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - User login
  • POST /api/auth/refresh - Refresh access token
  • POST /api/auth/logout - Logout user
  • GET /api/auth/verify - Verify session

C++ Loader

  • POST /api/loader/handshake - Initial handshake
  • POST /api/loader/login - Loader login
  • POST /api/loader/heartbeat - Keep-alive heartbeat
  • GET /api/loader/ban-status/:id - Check ban status

Full API Documentation: http://localhost:3001/api/docs (Swagger UI)


πŸ”’ Security Features

Cryptography

  • RSA-4096 for key exchange
  • AES-256-GCM for payload encryption
  • HMAC-SHA256 for request signing
  • Bcrypt for password hashing (cost factor: 12)

Protection Mechanisms

  • Nonce-based Anti-Replay (Redis store)
  • Timestamp Validation (Β±5 minute window)
  • Session Binding (Device + IP + Time)
  • Rate Limiting (100 req/min per IP)
  • IP Reputation Scoring
  • Geo-location Anomaly Detection

C++ Loader Protection

  • Anti-Debugging (IsDebuggerPresent, PEB checks, timing attacks)
  • Anti-VM Detection (CPUID, registry, process scanning)
  • Memory Integrity Checks
  • Binary Hash Validation
  • Self-Checksum Verification

πŸ“š Documentation


πŸ§ͺ Testing

# Backend unit tests
cd backend
npm run test

# Backend E2E tests
npm run test:e2e

# Frontend tests
cd frontend
npm run test

🚒 Production Deployment

See DEPLOYMENT.md for complete production deployment guide including:

  • Server setup (Ubuntu)
  • SSL certificates (Let's Encrypt)
  • Nginx reverse proxy
  • Docker deployment
  • Database backups
  • Monitoring & logs
  • Security hardening

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments


πŸ“§ Support

For support, email support@example.com or open an issue on GitHub.


⚠️ Disclaimer

This software is provided for educational purposes. Ensure compliance with all applicable laws and regulations when implementing licensing systems.


Made with ❀️ by NAIX

About

A secure authentication system solution for handling user login, registration, and access control in modern applications.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors