A fancy ShareX server with a dashboard made with NextJS and NestJS.
Go to file
renzynx a6a1963046 delete renovate 2022-04-22 10:15:06 +07:00
.github/workflows added TODO.md 2022-04-06 10:52:08 +07:00
server revert package.json 2022-04-22 10:13:55 +07:00
web revert package.json 2022-04-22 10:13:55 +07:00
LICENSE added TODO.md 2022-04-06 10:52:08 +07:00
README.md add support for sharex and a lot of improvements 2022-04-02 15:10:03 +07:00
TODO.md bump deps 2022-04-06 11:28:01 +07:00
install.sh add support for sharex and a lot of improvements 2022-04-02 15:10:03 +07:00

README.md

# Previews

preview preview preview preview

Install Guide

git clone https://github.com/renzynx/bliss.git && cd bliss/server
yarn install
cp .env.example .env

The .env should look like this

MYSQL_URL="example: mysql://user:password@host:port/database"

REDIS_URL="example: redis://user:password@host:port"

this can be anything you want
SESSION_SECRET="secret key for signing cookies: keyboard cat"

for cors stuff, your frontend url do not include https or http here, example: www.your-host.com, DO NOT include http:// or https://
DOMAIN=""

this should be your server url, example: api.your-host.com, DO NOT include http:// or https://
CDN_URL=""

Set to true if you use https
SECURE="false"

The port you wanted your server to start on
PORT=

Next we need to compile typescript to javascript and migrate the database

yarn build
yarn migrate

Now you need to run the setup and create the first admin user

yarn setup

And now we should ready to start the server. You can use pm2 to get the server to run in the background. If you don't have pm2 installed

npm install -g pm2

We can start the server with this command

pm2 start "yarn start" -n bliss-backend

We need to change directory to the frontend folder.

cd ../web

We also need to fill out the .env here

cp .env.example .env

The .env should look like this

This time you need to include https:// or http:// at the start of the url.
Example: https://api.renzynx.space
NEXT_PUBLIC_API_URL=""

Now we compile typescript to javascript

yarn build

And start the frontend Nextjs default start at port 3000, but you can use this command to use whatever port you want

pm2 start "yarn next start -p PORTHERE" -n bliss-frontend

Important step

You must enter your backend domain in next.config.js or its not gonna work You can get more details about that here: https://nextjs.org/docs/messages/next-image-unconfigured-host

Nginx SSL Setup

This setup is performed on a ubuntu machine.

nano /etc/nginx/sites-available/backend

Copy and paste the config below to it and save

Remember to change the port to the port server or frontend running from

upstream backend {
    server 127.0.0.1:42069;
}

server {
    listen 80;
    listen [::]:80;

    server_name your.domain.com

    client_max_body_size 100M;
    client_body_timeout 600s;

     location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://backend;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
nano /etc/nginx/sites-available/frontend
upstream frontend {
    server 127.0.0.1:6969;
}

server {
    listen 80;
    listen [::]:80;

    server_name your.domain.com

    client_max_body_size 100M;
    client_body_timeout 600s;

     location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass http://backend;
        proxy_redirect off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

To setup ssl you need to have certbot installed on your system

Install certbot

sudo apt install certbot python3-certbot-nginx
certbot --nginx -d api.foo.bar
certbot --nginx -d foo.bar