-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This is the portal app for Cal Hacks 5.0.
- Node.js (^10.16.3)
- NPM (^6.11.3)
git clone [email protected]:calhacks/portal.git
Run npm install
or npm i
in the repo directory.
Ask an existing tech team member to send you the environment variables. Create a new file named .env
in the repo's root directory, and paste the environment variables there.
The app requires the following environment variables:
-
DB_USER
: a MySQL username -
DB_PASSWD
: a MySQL password -
DB_NAME
: the name of the database -
DB_HOST
: the hostname of the database -
SENDGRID_APIKEY
: a valid SendGrid API key -
NODE_ENV
: 'production', 'development', etc. (optional) -
PORT
: required for production, otherwise useless
NOTE: It looks like Sequelize isn't playing well with MySQL 8's secure authentication protocol. The fix is to switch to legacy authentication (easy to configure with the MySQL prefPane on Mac); branches dev
and feature/error-handling
are up-to-date with this change.
Run ./scripts/dev.sh
to start running the application on your machine; it will start running on localhost:8000
.
We have a CI/CD pipeline in place that will autodeploy the application on push to master
. To deploy manually...
- SSH into the DigitalOcean droplet
cd portal/
git pull
yarn build
NOTE: There is no need to yarn start
as the existing server will reload upon changes to the built files. If the server hasn't started, you can start it in a tmux session:
tmux -s new production
yarn start
- Ctrl-B + d (to detach from the tmux session)
The routes and their handlers are described in src/router/routes.js
.
-
/
: A link to a homepage, if necessary. It could also just redirect to/login
. -
/login
: A login page. User needs to input email and password. -
/signup
: A signup page. User needs to give their first name, last name, email and password. -
/logout
: Ends the user's login session. -
/dashboard
: The user's dashboard. It links to the application questions; there's also a separate tab for choosing/creating a team. -
/application
: Application questions. They auto-fill with information that the user has entered.
For a user to sign up, they need to verify their email. When they sign up they'll get an email that takes them to https://2018.calhacks.io/verify?code=XXXXXX
. Replacing https://2018.calhacks.io
with http://localhost:8000
will run the email verification locally so your test user can login.
In order to standardize authentication and email verification checks throughout the app, some routes have associated policies that run as middleware, to make sure unauthenticated/unverified users can't access any dashboard, application, or team pages. The routes and policies are described in src/policies/index.js
.
The current ones are:
-
authenticateUser(roles)
: make sure a user is signed in as one of the roles inroles
before allowing them to visit the route. -
emailVerify
: make sure a user has verified their email before allowing them to visit the route.
There's still a lot to be done:
- Styling pages ✅
- Post-acceptance stuff (RSVP, travel reimbursement, and logistics) ❗
- Sponsor portal/admin portal
- Deploying to
werewolves
properly ✅ - Setting up automatic deployment from
master
anddev
✅ - Testing app ✅