Skip to content

MehguViewer/MehguViewer.Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MehguViewer Logo

MehguViewer Logo MehguViewer.Core MehguViewer Logo

The Reference Implementation of the MehguViewer Core Node.

CI Build Artifacts License

MehguViewer.Core is the high-performance, self-hostable server component of the MehguViewer Ecosystem. It handles content management, media streaming, and user progress tracking with an integrated web-based admin interface.


πŸš€ Quick Start

Download & Run (Easiest Way)

  1. Download the latest release for your platform from GitHub Actions β†’ Build Artifacts
  2. Extract the downloaded archive
  3. Run the executable:
    # Linux/macOS
    ./MehguViewer.Core
    
    # Windows
    .\MehguViewer.Core.exe
  4. Open your browser to http://localhost:6230

That's it! The application includes everything needed - no additional setup required.


πŸ“‹ System Requirements

  • Operating System: Linux, macOS, or Windows
  • Memory: 512MB RAM minimum (1GB recommended)
  • Storage: 100MB for application + storage for your content
  • Network: Internet connection for initial setup (optional)

πŸ—οΈ Architecture

This repository implements the Core API defined in MehguViewer.Proto.

Component Technology Description
Backend API ASP.NET Core 9 (.NET 9) High-performance REST API with Native AOT compilation
Database Embedded PostgreSQL Zero-configuration database (with memory fallback)
Admin Interface Blazor WebAssembly Integrated web dashboard for management
Authentication JWT + JWKS Stateless validation of tokens from Auth Server
File Serving Native HTTP Direct streaming of media assets

✨ Key Features

  • πŸš€ Instant Startup: Native AOT compilation for sub-second startup times
  • πŸ’Ύ Flexible Storage: File-based JSON persistence with PostgreSQL support
  • πŸ–₯️ Integrated Admin Panel: Built-in Blazor WebAssembly dashboard
  • πŸ”’ Secure by Design: Role-based access control (Admin, Uploader, User)
  • πŸ“š Universal Content: Supports Manga, Anime, and Novels with URN addressing
  • 🏷️ Rich Taxonomy: Authors, Scanlators, Groups, Tags, and Content Warnings
  • 🌍 Localization Support: Multi-language series with localized versions
  • ⚑ Dual Delivery Modes: Proxy mode for security, CDN mode for performance
  • 🐳 Container Ready: Optimized Docker images with multi-stage builds
  • πŸ”§ Self-Contained: Single executable with no external dependencies

πŸ› οΈ Development

Prerequisites

Project Structure

MehguViewer.Core/
β”œβ”€β”€ MehguViewer.Core.csproj          # Main ASP.NET Core application
β”œβ”€β”€ Program.cs                       # Application entry point
β”œβ”€β”€ appsettings.json                 # Configuration settings
β”œβ”€β”€ Dockerfile                       # Container build definition
β”‚
β”œβ”€β”€ MehguViewer.Core.UI/             # Blazor WebAssembly admin interface
β”‚   β”œβ”€β”€ Pages/                       # Routable pages (Series, Users, Settings, etc.)
β”‚   β”œβ”€β”€ Components/                  # Reusable UI components and dialogs
β”‚   β”œβ”€β”€ Layout/                      # Application layouts
β”‚   β”œβ”€β”€ Services/                    # Client-side services (ApiService, Auth)
β”‚   β”œβ”€β”€ wwwroot/                     # Static web assets
β”‚   └── README.md                    # UI documentation
β”‚
β”œβ”€β”€ MehguViewer.Core.Shared/         # Shared domain models and DTOs
β”‚   β”œβ”€β”€ Domain.cs                    # Public API models (Series, Units, etc.)
β”‚   β”œβ”€β”€ AdminModels.cs               # Admin-specific models (Users, Jobs)
β”‚   β”œβ”€β”€ Problem.cs                   # RFC 7807 error handling
β”‚   └── README.md                    # Shared models documentation
β”‚
β”œβ”€β”€ Endpoints/                       # API endpoint definitions
β”‚   β”œβ”€β”€ SeriesEndpoints.cs           # Series CRUD operations
β”‚   β”œβ”€β”€ UserEndpoints.cs             # User management
β”‚   β”œβ”€β”€ SystemEndpoints.cs           # System and taxonomy endpoints
β”‚   └── ...                          # Additional endpoint groups
β”‚
β”œβ”€β”€ Services/                        # Business logic and background services
β”‚   β”œβ”€β”€ FileBasedSeriesService.cs    # File-based series storage
β”‚   β”œβ”€β”€ ImageProcessingService.cs    # Image variant generation
β”‚   β”œβ”€β”€ AuthService.cs               # Authentication logic
β”‚   └── ...                          # Additional services
β”‚
β”œβ”€β”€ Infrastructures/                 # Data access layer
β”‚   β”œβ”€β”€ IRepository.cs               # Repository interface
β”‚   β”œβ”€β”€ MemoryRepository.cs          # In-memory implementation
β”‚   β”œβ”€β”€ PostgresRepository.cs        # PostgreSQL implementation
β”‚   └── DynamicRepository.cs         # Dynamic repository selection
β”‚
β”œβ”€β”€ Middlewares/                     # Custom ASP.NET Core middleware
β”‚   β”œβ”€β”€ JwtMiddleware.cs             # JWT validation
β”‚   β”œβ”€β”€ RateLimitingMiddleware.cs    # Rate limiting
β”‚   └── ServerTimingMiddleware.cs    # Performance tracking
β”‚
β”œβ”€β”€ Tests/                           # Comprehensive test suite
β”‚   β”œβ”€β”€ Endpoints/                   # Endpoint tests
β”‚   β”œβ”€β”€ Services/                    # Service tests
β”‚   β”œβ”€β”€ Infrastructures/             # Repository tests
β”‚   β”œβ”€β”€ Integrations/                # Integration tests
β”‚   β”œβ”€β”€ Unit/                        # Unit tests
β”‚   └── README.md                    # Testing documentation
β”‚
β”œβ”€β”€ Public/                          # Static assets and branding
β”‚   β”œβ”€β”€ logo-light.png              # Light theme logo
β”‚   β”œβ”€β”€ logo-dark.png               # Dark theme logo
β”‚   └── thumbnail.png               # Application thumbnail
β”‚
└── data/                            # Runtime data (auto-created)
    β”œβ”€β”€ series/                      # Series JSON files
    β”œβ”€β”€ covers/                      # Cover images
    └── users/                       # User data

Documentation:

Building & Running

# Clone the repository
git clone https://github.com/MehguViewer/MehguViewer.Core.git
cd MehguViewer.Core

# Restore dependencies
dotnet restore

# Run in development mode (with hot reload)
dotnet watch run

# Or run normally
dotnet run

The application will be available at:

  • Admin Dashboard: http://localhost:6230
  • API Endpoints: http://localhost:6230/api/v1/...

Configuration

The application uses sensible defaults and can be configured through the web interface. For advanced scenarios, create an appsettings.json file:

{
  "EmbeddedPostgres": {
    "Enabled": true,
    "FallbackToMemory": true
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information"
    }
  }
}

Testing

# Run all tests
dotnet test

# Run with coverage
dotnet test /p:CollectCoverage=true

# Run specific category
dotnet test --filter "Category=Integration"

🐳 Docker Deployment

Build and run with Docker:

# Build the optimized image
docker build -t mehguviewer-core .

# Run the container
docker run -p 6230:6230 \
  -v /path/to/your/content:/app/content \
  -v mehguviewer-data:/app/data \
  mehguviewer-core

Docker Compose Example

version: '3.8'
services:
  mehguviewer:
    image: mehguviewer-core
    ports:
      - "6230:6230"
    volumes:
      - ./content:/app/content
      - mehguviewer-data:/app/data
    restart: unless-stopped

πŸ”§ API Reference

The Core API follows the OpenAPI specification defined in MehguViewer.Proto.

Key Endpoints

Endpoint Description
GET /api/v1/series List all series
POST /api/v1/series Create a new series (Admin/Uploader)
GET /api/v1/series/{id} Get series details
PUT /api/v1/series/{id} Update series (Owner or Admin)
DELETE /api/v1/series/{id} Delete series (Owner or Admin)
GET /api/v1/system/taxonomy Get all authors, scanlators, groups, tags
GET /api/v1/assets/{urn} Stream media assets
GET /.well-known/mehgu-node Node metadata

Authorization

  • Admin: Full access to all series and system settings
  • Uploader: Can create series and edit/delete their own series
  • User: Read-only access to series and personal library

πŸ“Š Monitoring & Logs

The application provides comprehensive logging and monitoring:

  • Application Logs: Available in console output and through /api/v1/system/logs
  • Health Checks: Built-in health endpoints for monitoring
  • Performance Metrics: Server timing headers and response compression
  • Database Status: Automatic fallback to memory storage if PostgreSQL fails

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes and add tests
  4. Run tests: dotnet test
  5. Submit a pull request

Development Guidelines

  • Follow the MehguViewer.Proto specifications
  • Use URN-based identifiers for all resources
  • Implement proper error handling with RFC 7807 Problem Details
  • Add integration tests for new endpoints
  • Update documentation for API changes

πŸ“„ License

This project is licensed under the terms specified in the LICENSE file.


πŸ™‹ Support


Built with ❀️ using .NET 9 and Blazor WebAssembly
MehguViewer.Core Β© 2025

About

MehguViewer.Core is the high-performance, self-hostable server component of the MehguViewer Ecosystem. It handles content management, media streaming, and user progress tracking with an integrated web-based admin interface.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors