Skip to content

Commit c1b84ac

Browse files
committed
Refactor — Renamed “client” & “server” → “frontend” & “backend”
1 parent b537ada commit c1b84ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+91
-92
lines changed

.gitignore

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ typings/
5858
.env
5959

6060
# Ignore record image cache
61-
/client/static/images/records/record*
62-
/client/static/images/books/book*
63-
/client/static/images/board-games/boardgame*
64-
/server/config.json
65-
/replacement-art
61+
/frontend/static/images/records/record*
62+
/frontend/static/images/books/book*
63+
/frontend/static/images/board-games/boardgame*
64+
/backend/config.json
6665
/fix
6766
package-lock.json

INSTALL.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Since this is a development environment, there's no need to setup Nginx, Shelf c
2121
* If you don't already have `pm2` for node process management installed, do so with `npm install pm2 -g`
2222
* (Optional) Should you wish Shelf to automatically start on startup, see [this short guide](http://pm2.keymetrics.io/docs/usage/startup/) or execute `pm2 startup` to let `pm2` handle the settings for you.
2323
* Shelf uses MongoDB to manage its data. When starting the MongoDB server, it expects permissions to create a DB at `/var/lib/mongo`. If this location is not desired or if you have a MongoDB server already running for other projects, update the `MONGO_DB` variable in `admin/init.sh` to your desired path.
24-
* Edit `server/config.json` with your Discogs, Goodreads, and/or BoardGameGeek information. Shelf uses these services to display your library. See the ["Setup"](https://github.com/barrowclift/shelf/blob/master/README.md#setup) section of the [README](https://github.com/barrowclift/shelf/blob/master/README.md) for more information.
25-
* Finally, continue editing `server/config.json`, replacing all instances of `$PLACEHOLDER` with the appropriate information
24+
* Edit `backend/config.json` with your Discogs, Goodreads, and/or BoardGameGeek information. Shelf uses these services to display your library. See the ["Setup"](https://github.com/barrowclift/shelf/blob/master/README.md#setup) section of the [README](https://github.com/barrowclift/shelf/blob/master/README.md) for more information.
25+
* Finally, continue editing `backend/config.json`, replacing all instances of `$PLACEHOLDER` with the appropriate information
2626

2727
To spin up Shelf, execute `./start.sh`. Be sure to check the `logs/` directory to see if there are any errors.
2828

@@ -74,8 +74,8 @@ Additionally, when using a reverse proxy with Node, Nginx requires SELinux to be
7474
* Clone the repository (`git clone git@github.com:barrowclift/shelf.git`)
7575
* In the cloned repo, `npm install`
7676
* Shelf uses MongoDB to manage its data. When starting the MongoDB server, it expects permissions to create a DB at `/var/lib/mongo`. If this location is not desired or if you have a MongoDB server already running for other projects, update the `MONGO_DB` variable in `admin/init.sh` to your desired path.
77-
* Edit `server/config.json` with your Discogs information. To generate a Discogs token, navigate to [this link](https://www.discogs.com/settings/developers) and click the "Generate new token" button.
78-
* Edit `server/config.json` with your Discogs, Goodreads, and/or BoardGameGeek information. Shelf uses these services to display your library. See the ["Setup"](https://github.com/barrowclift/shelf/blob/master/README.md#setup) section of the [README](https://github.com/barrowclift/shelf/blob/master/README.md) for more information.
79-
* Finally, continue editing `server/config.json`, replacing all instances of `$PLACEHOLDER` with the appropriate information.
77+
* Edit `backend/config.json` with your Discogs information. To generate a Discogs token, navigate to [this link](https://www.discogs.com/settings/developers) and click the "Generate new token" button.
78+
* Edit `backend/config.json` with your Discogs, Goodreads, and/or BoardGameGeek information. Shelf uses these services to display your library. See the ["Setup"](https://github.com/barrowclift/shelf/blob/master/README.md#setup) section of the [README](https://github.com/barrowclift/shelf/blob/master/README.md) for more information.
79+
* Finally, continue editing `backend/config.json`, replacing all instances of `$PLACEHOLDER` with the appropriate information.
8080

8181
To spin up Shelf, execute `./start.sh`. Be sure to check the `logs/` directory to see if there are any errors.

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<a href="#">
2-
<img height="50" src="https://raw.githubusercontent.com/barrowclift/shelf/master/client/static/images/logo/shelf.png" />
2+
<img height="50" src="https://raw.githubusercontent.com/barrowclift/shelf/master/frontend/static/images/logo/shelf.png" />
33
</a>
44

55
### *Beautifully display your library on the Internet*
@@ -61,7 +61,7 @@ Since [Discogs](https://www.discogs.com), [Goodreads](https://www.goodreads.com)
6161

6262
## How do I sync my Discogs account with Shelf to display my records?
6363

64-
You will need to make the following changes to Shelf's properties file at `server/resources/shelf.properties`:
64+
You will need to make the following changes to Shelf's properties file at `backend/resources/shelf.properties`:
6565

6666
1. Set your Discogs username in `discogs.user.id`.
6767
2. You'll need to generate a [Discogs](https://www.discogs.com) personal access token, which you can do at [the following link](https://www.discogs.com/settings/developers). Copy and paste that token in `discogs.user.token`.
@@ -70,7 +70,7 @@ Note that only records in your collection will be fetched for your Shelf collect
7070

7171
## How do I sync my Goodreads account with Shelf to display my books?
7272

73-
You will need to make the following changes to Shelf's properties file at `server/resources/shelf.properties`:
73+
You will need to make the following changes to Shelf's properties file at `backend/resources/shelf.properties`:
7474

7575
1. You'll need to identify your [Goodreads](https://www.goodreads.com) user ID. To do so, log into [Goodreads](https://www.goodreads.com) and navigate to your profile. In your browser's URL, you will see a number preceding your account's name. Take _just_ that number set it in `goodreads.user.id`.
7676
2. You'll need to generate an API key and secret at [the following link](https://www.goodreads.com/api/keys). Set the key in `goodreads.user.key` and the secret in `goodreads.user.token`. Additionally, set the public address where your Shelf instance will reside in the Callback URL.
@@ -79,7 +79,7 @@ Note that only owned books in your "Read" bookshelf will be fetched for your She
7979

8080
## How do I sync my BoardGameGeek account with Shelf to display my games?
8181

82-
You will need to make the following changes to Shelf's properties file at `server/resources/shelf.properties`:
82+
You will need to make the following changes to Shelf's properties file at `backend/resources/shelf.properties`:
8383

8484
1. Set your [BoardGameGeek](https://boardgamegeek.com) username in `boardgamegeek.user.id`.
8585

@@ -91,7 +91,7 @@ As mentioned above, if you want to add new items to Shelf, you must add them to
9191

9292
## What if I only want to display a particular collection, like board games?
9393

94-
By default, records, books, and board games are all displayed in Shelf's menu. However, you can easily disable them via the following properties in `server/resources/shelf.properties`:
94+
By default, records, books, and board games are all displayed in Shelf's menu. However, you can easily disable them via the following properties in `backend/resources/shelf.properties`:
9595

9696
```
9797
boardgame.shelf.enabled=true
@@ -103,7 +103,7 @@ book.shelf.enabled=true
103103

104104
Shelf is a webapp built with [Node.js](https://nodejs.org/en/), [MongoDB](https://www.mongodb.com), and [Vue.js](https://vuejs.org). For the complete list of third-party libraries and tools used, please see Shelf's [Acknowledgements page](https://shelf.barrowclift.me/acknowledgements).
105105

106-
Shelf is run server-side from a single entry point, `server/main.js`, which is started or stopped via `./start.sh` or `./stop.sh`, respectively. Since these bash scripts are powered by [pm2](https://pm2.io/runtime/), Shelf's process can alternatively be managed with [pm2](https://pm2.io/runtime/) directly, if you wish. Books, records, and board games are managed independently in their own, modular directories, so adding new external data sources or media types is a breeze.
106+
Shelf is run server-side from a single entry point, `admin/main.js`, which is started or stopped via `admin/start.sh` or `admin/stop.sh`, respectively. Since these bash scripts are powered by [pm2](https://pm2.io/runtime/), Shelf's process can alternatively be managed with [pm2](https://pm2.io/runtime/) directly, if you wish. Books, records, and board games are managed independently in their own, modular directories, so adding new external data sources or media types is a breeze.
107107

108108
Client-side, Shelf leverages [Liquid](https://shopify.github.io/liquid/) for its HTML templates.
109109

admin/cleanLogs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export ADMIN_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
44
source "${ADMIN_DIR}"/init.sh
55

66
rm "${LOGS_DIR}"/mongodb.log 2> /dev/null
7-
rm "${LOGS_DIR}"/server.log 2> /dev/null
7+
rm "${LOGS_DIR}"/backend.log 2> /dev/null
88
rm "${LOGS_DIR}"/clean-mongodb.log 2> /dev/null
99

1010
echo "Log directory cleaned"

admin/init.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ export YELLOW='\033[0;33m'
66
export GREEN='\033[0;32m'
77

88
export REPO=$(dirname "${ADMIN_DIR}")
9-
export CLIENT_STATIC_DIR="${REPO}"/client/static
10-
export CLIENT_LIQUID_DIR="${REPO}"/client/liquid
11-
export SERVER_DIR="${REPO}"/server
12-
export RECORD_IMAGE_CACHE_DIR="${CLIENT_STATIC_DIR}"/images/records
13-
export BOARD_GAME_IMAGE_CACHE_DIR="${CLIENT_STATIC_DIR}"/images/board-games
14-
export BOOK_IMAGE_CACHE_DIR="${CLIENT_STATIC_DIR}"/images/books
9+
export FRONTEND_STATIC_DIR="${REPO}"/frontend/static
10+
export FRONTEND_LIQUID_DIR="${REPO}"/frontend/liquid
11+
export BACKEND_DIR="${REPO}"/backend
12+
export RECORD_IMAGE_CACHE_DIR="${FRONTEND_STATIC_DIR}"/images/records
13+
export BOARD_GAME_IMAGE_CACHE_DIR="${FRONTEND_STATIC_DIR}"/images/board-games
14+
export BOOK_IMAGE_CACHE_DIR="${FRONTEND_STATIC_DIR}"/images/books
1515
export LOGS_DIR="${REPO}"/logs
1616
export MONGO_DB=/var/lib/mongo
1717

server/main.js renamed to admin/main.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
// External
66
let path = require("path");
77
// Local
8-
let BoardGameFetcher = require("./boardGames/Fetcher");
9-
let BookFetcher = require("./books/Fetcher");
10-
let CachedMongoClient = require("./db/CachedMongoClient");
11-
let Logger = require("./common/Logger");
12-
let paths = require("./common/paths");
13-
let RecordFetcher = require("./records/Fetcher");
14-
let Server = require("./Server");
15-
let PropertyManager = require("./common/PropertyManager");
8+
let BoardGameFetcher = require("../backend/boardGames/Fetcher");
9+
let BookFetcher = require("../backend/books/Fetcher");
10+
let CachedMongoClient = require("../backend/db/CachedMongoClient");
11+
let Logger = require("../backend/common/Logger");
12+
let paths = require("../backend/common/paths");
13+
let RecordFetcher = require("../backend/records/Fetcher");
14+
let Server = require("../backend/Server");
15+
let PropertyManager = require("../backend/common/PropertyManager");
1616

1717

1818
// CONSTANTS
@@ -30,7 +30,7 @@ let bookFetcher = null;
3030
let server = null;
3131

3232
const log = new Logger(CLASS_NAME);
33-
let propertiesFileName = path.join(paths.SERVER_RESOURCES_DIRECTORY_PATH, "shelf.properties");
33+
let propertiesFileName = path.join(paths.BACKEND_RESOURCES_DIRECTORY_PATH, "shelf.properties");
3434

3535

3636
// STARTUP

admin/mongoShim.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ let request = require("request-promise");
99
let socketIo = require("socket.io-client");
1010
// Local
1111
const SHELF_ROOT_DIRECTORY_PATH = path.join(__dirname, "..");
12-
let CachedMongoClient = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "server/db/CachedMongoClient"));
13-
let PropertyManager = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "server/common/PropertyManager"));
14-
let socketCodes = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "server/common/socketCodes"));
15-
let util = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "server/common/util"));
12+
let CachedMongoClient = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "backend/db/CachedMongoClient"));
13+
let PropertyManager = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "backend/common/PropertyManager"));
14+
let socketCodes = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "backend/common/socketCodes"));
15+
let util = require(path.join(SHELF_ROOT_DIRECTORY_PATH, "backend/common/util"));
1616

1717

1818
// CONSTANTS
1919
// ---------
20-
const PROPERTIES_FILE_NAME = path.join(SHELF_ROOT_DIRECTORY_PATH, "server/resources/shelf.properties");
20+
const PROPERTIES_FILE_NAME = path.join(SHELF_ROOT_DIRECTORY_PATH, "backend/resources/shelf.properties");
2121

2222

2323
// GLOBALS

admin/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ -n "$HAS_SERVICE_COMMAND" ]; then
1414
MONGODB_SERVICE_RUNNING=$(systemctl status mongod | grep 'is running\|active (running)')
1515
fi
1616
fi
17-
SHELF_RUNNING=$(ps -ef | grep "node ""${SERVER_DIR}" | grep -v grep)
17+
SHELF_RUNNING=$(ps -ef | grep "node ""${BACKEND_DIR}" | grep -v grep)
1818

1919
# If all necessary ingredients are running successfully, nothing to do
2020
if [ -n "$SHELF_RUNNING" ] && { [ -n "$MONGODB_NOHUP_RUNNING" ] || [ -n "$MONGODB_SERVICE_RUNNING" ]; }; then

admin/startServer.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ if [ ! -d "$LOGS_DIR" ]; then
77
mkdir "$LOGS_DIR";
88
fi
99

10-
SERVER_RUNNING=$(ps -ef | grep "node ""${SERVER_DIR}" | grep -v grep)
10+
SERVER_RUNNING=$(ps -ef | grep "node ""${ADMIN_DIR}" | grep -v grep)
1111

1212
if [ -n "$SERVER_RUNNING" ]; then
1313
echo -e "Server already running"
1414
else
1515
if [ "$USE_PM2" = true ] ; then
16-
pm2 --log "${LOGS_DIR}"/server.log --name shelf --silent start "${SERVER_DIR}"/main.js
16+
pm2 --log "${LOGS_DIR}"/backend.log --name shelf --silent start "${ADMIN_DIR}"/main.js
1717
else
18-
nohup node "${SERVER_DIR}"/main.js > "$LOGS_DIR"/server.log 2>&1 &
18+
nohup node "${ADMIN_DIR}"/main.js > "$LOGS_DIR"/backend.log 2>&1 &
1919
fi
2020

2121
SUCCESS=$?

admin/stop.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ -n "$HAS_SERVICE_COMMAND" ]; then
1414
MONGODB_SERVICE_RUNNING=$(systemctl status mongod | grep 'is running\|active (running)')
1515
fi
1616
fi
17-
SERVER_RUNNING=$(ps -ef | grep "node ""${SERVER_DIR}" | grep -v grep)
17+
SERVER_RUNNING=$(ps -ef | grep "node ""${BACKEND_DIR}" | grep -v grep)
1818

1919
# If all necessary ingredients aren't running, then there's nothing to stop
2020
if [ -z "$SERVER_RUNNING" ] && { [ -z "$MONGODB_NOHUP_RUNNING" ] && [ -z "$MONGODB_SERVICE_RUNNING" ]; }; then

0 commit comments

Comments
 (0)