Table of Contents
KaluKaveri
(Note that you can replace yarn
with npm
if you want to use npm, but that is not 100% guaranteed to work).
Installation
The instructions assume that you can use a search engine to lookup how to do certain things that are outside the scope of this ugide.
- Clone this repository and make sure that you've got nodejs and yarn installed.
- Get a Google service account, get it's json file, and make a spreadsheet according to the template below. Save the json file as
backend/secret.json
. - Configure variables (Mainly settings.json files and .env.local file). Also configure the lists under
src/lists
. (Tools has an example csv to itemlist converter in js if you want to automate such things). - OPTIONALLY, modify some of the frontend source code to your liking.
- Install dependencies:
yarn install
. - Setup a reverse proxy with https. You can get a free https certificate from LetsEncrypt. Use the port from the backend config file.
Spreadsheet
The top row (title row) should have the following items in it in the following order (choose Finnish or Enbglish):
- Aikaleima / Timestamp
- Sähköpostiosoite / Email
- Tilaajan nimi / Orderer
- Nimike / Item name
- Kalusteenryhmä / Item group
- Määrä / Amount
- Yksikkö / Units
- Kuljetusaika / Delivery time
- Kustannuspaikka / Accounting location
- Osasto / Department
- Tilinumero / Account number
- Hinta / Price
- Viite&Lisätietoja / Reference&details
Usage
Run yarn start
to build the frontend and then start the backend. The backend servers the frontend as a static website, but it also has /token
and /save
. (The single use token is used to stop replay attacks).
If you want to only rebuild the frontend, run yarn build
.
Developing
Run yarn run dev
to start the developement server. It's expected that you won't be able to connect to the backend, but that's fine. If you need to test it out, I recommend running the backend on a different port than the frontend dev server, and setting up the frontend to connect to that port.
That way, you'll have live reload in the frontend whilst having the backend enabled.
For all the other scripts, look under package.json
.
Please note that you need to reset the service worker cache every time you want to update the frontend whilst you have it deployed.
So go into public/sw.js
, and just change the const CACHE = "vX"
to a higher number by 1 or something.