Author: HelloGitHub- CAI Wenxin

Everybody is good! Here is HelloGitHub launched “explain open source project” series, today to bring you a node.js based implementation of multiple platform open source project — ArtiPub (article publisher).

Introduce a,

It is well known that every time an article is posted to a platform, it increases the chance that it will be seen by more people. So content creators not only need to write high-quality articles, but also manually distribute them to different platforms. This synchronization is not a simple copy and paste, need to re-typesetting, uploading images, etc., very time-consuming and cumbersome.

HelloGitHub understands your pain, so today brings a free open source article automatic distribution management platform — ArtiPub, it can help content creators will write good articles automatically published to nuggets, SegmentFault, CSDN, Zhihu, open Source China and other technical communities, Get more exposure and attention while disseminating technical content. It can not only complete the online editing and synchronization of files, but also the function of data statistics, it is simply a necessary magic device for content creation!

Project address: github.com/crawlab-tea…

Let’s follow this article to learn about the advantages and features of ArtiPub, then follow the steps to use it, and finally let you go from manual synchronization to automatic synchronization.

1.1 security

There are already many platforms in the market that require users to upload their account information, such as cookies or account passwords, to the server of the other party, which is not secure. Because once the platform has a problem, their account information will be leaked. While I believe that platforms do not manipulate users’ accounts in a malicious way, it is important to avoid the risk that your account privacy will be compromised and your property on the platform may be damaged. ArtiPub does not require users to upload account information, all account information is stored in the user’s own local or server database, so as to avoid this security risk.

1.2 the Chrome plug-ins

ArtiPub has a Chrome plug-in, which can easily obtain user login information (Cookie), and then inject the Cookie into the Chromium browser operated by Puppeteer, the browser can normally log in to the website for publishing operations.

1.3 Supported Platforms

  • The Denver nuggets
  • SegmentFault
  • CSDN
  • Jane’s book
  • zhihu
  • Open source in China
  • Today’s headline
  • Blog garden

1.4 Supported Installation modes

ArtiPub installation is simple, provides a variety of installation methods, can be installed using a key, installation generally only 5 minutes.

  • Docker
  • Npm
  • The source code

Considering that the audience for this project may include non-programmers, this article will demonstrate the most convenient way to install Docker.

Second, the installation

2.1 Docker

To prepare

  1. Docker installation documentation
  2. Docker-compose container orchestration installation documentation

Step 1 Run the command in the project root directory

The docker-compose up command creates an image and container from the docker-compose. Yaml file.

cd ArtiPub
docker-compose up
Copy the code

Step 2 Start the container

Step 3 successful

Go to http://localhost:8000

Three, use,

3.1 the login

As mentioned above, ArtiPub is to obtain cookies through Chrome plug-in, so you also need to install Chrome plug-in, plug-in download and installation method author wrote in the login assistant menu.

3.2 release

After publishing, it takes a little bit of time and within about 1 minute, you can see that it has been synchronized to all the selected platforms.

Iv. Technology stack

4.1 the front

  • The React framework
  • The UI is based on Ant Design Pro developed by Alibaba

4.2 the back-end

  • Based on Node.js, written using TS
  • Express is used for the Web framework
  • The crawler function is based on Puppeteer (an automated testing tool developed by Google)
  • The mainstream NoSQL database Mongodb is used to record articles and cookie information

4.3 Project Structure

.├ ─ service.json // Start file including route registration The database connection ├ ─ ─ backend ├ ─ ─ the config ├ ─ ─ extensions │ └ ─ ─ the SRC │ └ ─ ─ popup ├ ─ ─ lib ├ ─ ─ models / / database model ├ ─ ─ nginx / / nginx configuration ├ ─ ─ Public │ └ ─ ─ the ICONS ├ ─ ─ routes / / equivalent to the controller in MVC ├ ─ ─ spiders / / crawler related functions │ └ ─ ─ the import └ ─ ─ the SRC ├ ─ ─ assets │ └ ─ ─ img ├ ─ ─ │ ├─ Authorized │ ├─ CopyBlock │ ├─ GlobalHeader │ ├─ HeaderDropdown │ ├─ NoticeIcon │ ├ ─ ─ PageLoading │ ├ ─ ─ SelectLang │ └ ─ ─ SettingDrawer ├ ─ ─ data ├ ─ ─ e2e │ └ ─ ─ __mocks__ ├ ─ ─ layouts ├ ─ ─ locales │ ├ ─ ─ En - US │ ├ ─ ─ pt - BR │ ├ ─ ─ useful - CN │ └ ─ ─ useful - TW ├ ─ ─ models ├ ─ ─ pages │ ├ ─ ─ ArticleEdit │ ├ ─ ─ ArticleList │ ├ ─ ─ Demo │ ├ ─ ─ Environment │ ├─ Helper │ ├── bass │ ├── services ├─Copy the code

Although the front and back end code is not split into two repositories, it is in front and back split mode, using Nginx as a reverse proxy. The back-end has changed slightly from the traditional MVC pattern, but the main controllers, Models, and services still exist (with different names).

Here is a schematic diagram of ArtiPub’s architecture:

Five, the last

ArtiPub itself is not a very complicated project, but it contains a lot of interesting features and ideas, such as obtaining users’ cookies on various platforms through Chrome plugin to solve the problem of authorization when users have too many accounts. Publishing is also done through Puppeteer, an automated tool. Through the study of ArtiPub source code can learn in addition to Node.js a lot of technology, and the use of these technologies is also very rich.

I hope you like the ArtiPub recommended today. I also hope you can read the Clone project after reading the article. If you feel good, you can follow the “HelloGitHub” public account and receive the first update. Yo ~ love you