This repository contains the code for The Barnes Foundation digital guide — Barnes Focus.
- NodeJS/Express for the server and API functionality
- React for the client-side interaction
- Configured for deployment on AWS Lambda
- PostgreSQL for caching artworks locally and persisting user session information
- Node v14.5.0
To develop this application locally, follow these steps
- Switch to the correct version of Node with
nvm useornvm use 14.5.0. - Run
npm cito install the needed node modules - Create a
.envfile and populate with values as specified by .env-template a. Make sure to populate the DATABASE_URL with the correct database credentials - Run
make init-devto initialize your local environment. This will
a. Compile the server code b. Create the required tables for your local database schema and create the database if one does not already exist c. Seed your local translations table with our stored translations data d. Run the ElasticSearch sync to retrieve artworks information and cache it locally - Run
npm run devto start the server. This will also compile and reload the server code following any changes to the code in the server directory - Run
npm run startto start the React code and hot reload
To deploy this application, you'll need to
- Configure an AWS Remote Database Service instance on the PostgreSQL platform. You'll need to create the schema and tables.
- Configure an ElasticSearch database that is populated with artwork information
- Sign up for Vuforia account and create a database
You will need to have serverless installed to deploy the application. To install, run npm install -g serverless
Once that's done, and you've correctly set your .env file, you can deploy using either of these two commands
-
make deploy_devUse this command to deploy to the development stage
-
make deploy_prodUse this command to deploy to the production stage
Behind the scenes these two commands:
- Compile and build the
srcandserverdirectories to thedistdirectory. - Rename your development
node_modulestodev_node_modulesas a means of saving them. - Install the node modules needed for production deployment.
- Deploy the application to the specified stage environment.
- Delete the production node modules and undoes the rename of your development modules.
Objects from special exhibitions can be added to the app by following these steps:
- Add a reference image for each object to Vuforia and use the prefix
SPEX_in the item name to denote that the object is part of a special exhibition, eg:SPEX_MOD-3-1-1. The only underscore in the item name should be the one separatingSPEX_and the items id. - Add content for each image in the "Focus" project in Hygraph (formerly GraphCMS) and create a
SpecialExhibitionObjectentry for each object with the object id equaling the item name in Vuforia removing "SPEX/", eg:MOD-3-1-1.