Introduction to the

This project uses next. Js, Nest. js and MySQL to build a complete front and back end separation project from 0 to 1. Among them, next. Js is used to render foreground page and background management system through the server, Nest. Js is used to provide restful API interface, and TypeOrM is used to operate MySQL data.

link

  • Making the source code
  • The front desk page
  • Management system: Support visitor registration, also can use the account:wipi wipi123456

The function point

  • Article creation, release, update, and corresponding label, classification management
  • The article search
  • Page creation, publishing, and updating
  • Comments on the management
  • Email notification
  • System Access Statistics (IP + User-Agent)
  • User Management (Administrator, visitor)
  • File upload (upload to Alicoss)
  • Dynamic SEO, title, Logo, Favicon Settings, etc
  • The use of vscodemonacoAs article, page editor, supportMarkdowngrammar

More functions, welcome to visit the system for experience.

preview

Local boot

  • Install dependencies

Install MySQL first. Docker is recommended.

docker run -d --restart=always --name wipi-mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql
Copy the code
  • Clone this project.
git clone --depth=1 https://github.com/fantasticit/wipi.git your-project-name
Copy the code

Then install the project Node dependencies.

lerna bootstrap
Copy the code
  • Start the project
lerna run dev
Copy the code

Front page address: http://localhost:3000. Background management address: http://localhost:3001. Service interface address: http://localhost:4000.

After the initial startup, the default administrator user is admin and the password is admin (you can change the password in the server/ SRC /config file). [PS] If the server configuration fails to start, check whether the MySQL configuration is correct. The configuration file is in server/ SRC /config.

Project deployment

You can use PM2 to deploy on the server. You can view the deploy.sh file. The details are as follows:


node -v
npm -v

npm config set registry http://registry.npmjs.org

npm install pm2 -g
npm i -g @nestjs/cli
npm i -g lerna

lerna bootstrap
lerna run build
lerna run pm2

pm2 startup
pm2 save
Copy the code

Nginx configuration

Proxy_set_header x-real-ip $remote_addr; In this way, the server obtains the real IP address.

Upstream wipi_client {server 127.0.0.1:3000; keepalive 64; }# HTTP -> HTTPS redirectionserver { listen 80; Server_name domain; rewrite ^(.*)$ https://$hostThe $1permanent; } server { listen 443 ssl; Server_name domain; Ssl_certificate Directory where the certificate is stored. Ssl_certificate_key Directory for storing the certificate. Location / {proxy_http_version 1.1; proxy_set_header Upgrade$http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header Host $host;
    proxy_set_header X-Nginx-Proxy true;
    proxy_cache_bypass $http_upgrade;
    proxy_pass http://wipi_client; # Reverse proxy
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}Copy the code

data

  • Next. Js source: github.com/vercel/next…
  • Next.js documentation: nextjs.org/
  • Nest. js source: github.com/nestjs/nest
  • Nest. js documentation: nestjs.com/

Use search engines when you have a problem.