-
Simplicity: it should be as easy as possible to get the site up and running for development. This is critical for a dorm website, where the people working on it will change every year or two.
-
Performance: because high performance makes a site much, much more enjoyable to use.
-
Install
yarn(version 1.22.x) -
In this directory, run
yarn installto install all the dependenceies. -
Run
cp server/.env.example server/.envto create an environment file, and fill in the relevant fields. -
Set up Prettier to format your code consistently and automatically. The Prettier VSCode extension does this very well.
Run yarn client and yarn server in separate terminals to start
developing.
yarn typecheck will run the TypeScript compiler for the frontend and
backend, and output any type errors.
yarn build:client will type-check, compile, and bundle the frontend
(everything in client/).
yarn build:server will type-check and compile the backend (everything in
server/).
yarn build will build the entire project.
Not finished yet. The current plan is to set up GitHub actions to automatically deploy the latest master if it passes type checks and tests, using deploy keys and Ansible.
Although Parcel is much faster and easier to configure than Webpack for
builds, it does not perform type checking. Therefore, we expect development on this project will
be done in an IDE that gives significant feedback when type errors occur (such as VSCode). This
gives us the speed of Parcel, and the development advantages of TypeScript. While running
yarn build:client performs type checking then uses Parcel to bundle the JavaScript, yarn dev
may continue to work even when type errors are present.
It's usually easiest to use something like pm2 to keep the process running
and easily manage it:
yarn global add pm2
yarn build:client # might take a full minute or so to run
pm2 start server/server.js
pm2 save # save configuration so pm2 can restart server.js on VM reboot