Artalk Documentation
repository·master·Indexed 25 days ago
https://github.com/artalkjs/artalkA self-hosted, feature-rich comment system consisting of a lightweight Vanilla JS client and a high-performance Golang-powered server. Documentation covers Docker deployment, client integration, and a comprehensive plugin ecosystem including the @artalk/plugin-kit for development, eslint-plugin-artalk for linting, and official plugins for authentication, KaTeX, and lightbox.
What's inside Artalk
- Artalk is a self-hosted comment system. It provides a complete solution for managing comments on your website or application.
Overview of Artalk features
masterArtalk is a lightweight, feature-rich comment system. Key capabilities include:
- Frontend: ~40KB Vanilla JS, sidebar management, social login, Markdown support, emoticons (OwO compatible), LaTeX support, night mode, and image lightbox.
- Backend: High-performance Golang server, email/push notifications, captcha, comment moderation (spam/content detection), image uploading (custom/image bed support), and multi-site management.
- Management: Admin dashboard, comment voting, sorting, pinning, search, and data migration/backup.
- Extensibility: Plugin system and OpenAPI-formatted API documentation.
Overview of Artalk Development Resources
masterArtalk provides several entry points for developers depending on whether you are integrating the comment system, building plugins, or working on the backend.
- Frontend Integration: Guides for embedding Artalk in blogs or frameworks, using the Frontend API, listening to Frontend Events, and configuring the frontend.
- Plugin Development: Documentation for building plugins and integrating them with Vite.
- Backend Development: Access to HTTP API documentation, environment variable configuration, and backend configuration files.
- Contribution: For setting up a local development environment to contribute to the core project, refer to the Developer Contribution Guide.
Overview of Artalk commenting system
masterArtalk is a lightweight, feature-rich commenting system designed for easy deployment and integration into blogs, websites, or web applications.
Architecture
- Frontend: Built with TypeScript (Vanilla JS), it is lightweight (~40KB gzipped) and free of redundant dependencies.
- Backend: Rewritten in Golang (Artalk v2), it is cross-platform, compact, and designed for rapid deployment.
Key Capabilities
Artalk provides a wide range of features including:
- User Engagement: Markdown support, emoji packs (compatible with OwO), LaTeX formula parsing, and comment voting (upvote/downvote).
- Management: A sidebar for quick management, multi-site isolation, admin dashboards, and comment moderation (spam interception and content detection).
- User Experience: Auto-save to prevent data loss, auto-fill user info via browser caching, night mode, and image lightbox integration.
- Notifications: Email notifications and various push methods.
- Extensibility: Support for extension plugins and OpenAPI-formatted API documentation.
Overview of Artalk
masterArtalk is an intuitive and feature-rich comment system designed for immediate integration into any blog, website, or web application. It consists of a lightweight Vanilla JS client (~40KB) and a high-performance Golang server.
Key characteristics:
- Client: Framework-agnostic, pure Vanilla JS.
- Server: Efficient, lightweight, and cross-platform via Golang.
- Deployment: Supports one-click deployment via Docker.
- Privacy: Open-source and self-hostable, prioritizing user privacy.
Artalk Docker platform compatibility
masterThe official Docker images currently only support the following architectures:
x86arm64
If you require a different architecture, you must use the Binary Deployment method instead of Docker.
Nested Import of Emoticon Resources
masterArtalk supports nested imports, allowing a remote emoticon JSON file to point to other emoticon resources. This is useful for managing large or modular emoticon sets.
A remote file (e.g.,
emoticons.json) can contain an array that mixes URLs and data objects:Understand the Artrans data format
masterArtalk uses a persistent data storage standard called Artrans (Artran + Artrans).
- An Artran is a single comment data object.
- Artrans is a JSON array containing multiple Artran objects.
This format is used for all data migrations, backups, and imports within Artalk.
{ "id": "123", "rid": "233", "content": "Hello Artalk", "ua": "Artalk/6.6", "ip": "233.233.233.233", "created_at": "2021-10-28 20:50:15 +0800", "updated_at": "2021-10-28 20:50:15 +0800", "is_collapsed": "false", "is_pending": "false", "vote_up": "666", "vote_down": "0", "nick": "qwqcode", "email": "qwqcode@github.com", "link": "https://qwqaq.com", "password": "", "badge_name": "Administrator", "badge_color": "#FF716D", "page_key": "https://artalk.js.org/guide/transfer.html", "page_title": "Data Migration", "page_admin_only": "false", "site_name": "Artalk", "site_urls": "http://localhost:3000/demo/,https://artalk.js.org" }Supported Emoticon Formats
masterArtalk supports two primary formats for emoticon data files:
- OwO Format: An open-source format compatible with the OwO JS plugin. You can use existing OwO JSON resources directly by providing their URL.
- Artalk Standard Format: A native JSON/JS array format that allows you to define groups of emoticons. Each group must specify a
name, atype('emoticon'for text or'image'for images), and anitemsarray containingkeyandvalpairs.
[ { name: 'Emoji', type: 'emoticon', // Text type items: [ { key: 'Hi', val: '|´・ω・)ノ' }, { key: 'Happy', val: 'ヾ(≧∇≦*)ゝ' }, ], }, { name: 'Funny', type: 'image', // Image type items: [ { key: 'Original Funny', val: '<Image URL>', }, ], }, ]Bind Page Views and Comment Counts to HTML elements
masterYou can display statistics anywhere on your page by using specific CSS selectors and the
data-page-keyattribute.pvEl: The selector for the element that displays Page Views (Default:'.artalk-pv-count').countEl: The selector for the element that displays Comment Counts (Default:'.artalk-comment-count').statPageKeyAttr: The attribute name used to specify the page key (Default:'data-page-key').
Usage Example: To show the comment count for a specific page, use:
<span class="artalk-comment-count" data-page-key="/t/1.html"></span>How Account Merging works
masterIf a user logs in and Artalk detects multiple accounts with different usernames but the same email address, an Account Merging Tool will appear.
Users can choose to keep one specific username. Once selected, all comments and data associated with that email address are merged into the retained account. The original duplicate accounts are deleted, and the username on all associated comments is updated to the retained username.
How relative paths are resolved
masterWhen a relative path is provided in
pageKey, Artalk resolves it by combining the site URL (configured in the Artalk Dashboard) with the relative path.For example, if the site URL is
https://set-example-site-url.xxxand thepageKeyis/relative-path/xx.html, the resolved URL will behttps://set-example-site-url.xxx/relative-path/xx.html.These resolved URLs are used for:
- Email notifications (links to reply to comments)
- Sidebar (quick jumps to specific comments)
- Dashboard (page management and opening pages)
- Fetching page titles and other metadata