A self hosted file hosting and sharing app with light and dark modes. Written in React, using a Node.js back end.
- Clone this repo
- Install Node
- Install Python
- npm install
- create database
- install Nginx
- configure Nginx
- use pm2 to keep it running 7.1 set to run on startup
- setup domain
- setup ssl
- create a back end .env file using this template in the root directory:
# The port you want the api to run on.
PORT=5001
#A secret key used for signing user sessions with JWT. This is just an example, use something else.
TOKEN_SECRET="secret-jwt-token"
#A registration secret new users will need to create accounts. Again, this is just an example, use something else
REGISTER_SECRET="secret-register-token"
#Add your environment, development or production.
NODE_ENV="production"
- create a client side .env using this template in the /client directory.
# The port you want to serve the application from.
PORT=5002
# The port your api is running on. This should match your back end .env.
REACT_APP_SERVER_PORT=5001
# The API URL you have setup if connecting from outside your network.
REACT_APP_API="api.yourdomain.com"
- run 'npm run build' in the apps root directory. This should install and build the back end and front end with all their dependancies.
npm run build
- migrate the database to the latest version with 'npx db-migrate up -e production'
px db-migrate up -e production
Adding Database Migration:
npx db-migrate create add-whatever with —sql
Then add the sql to make the change to the up file followed by:
npx db-migrate up or npx db-migrate up -e production
Get into the database locally Your database name should be development.db if in development or production.db if in production.
sqlite3 development.db