To run the website on your machine, make sure you have Node.js installed. Then inside this folder, run
npm install
npm start
And your server will be ready to go.
Certain environment variables need to be available for features to work. For convenience
you can do this in the .env
file at the root of your project.
MAILCHIMP_API_KEY=
MAILCHIMP_LIST_ID=
APPLICATION_URL=
TEAM_APPLICATION_URL=
STRIPE_PUBLISH_KEY=
STRIPE_PRIVATE_KEY=
GOOGLE_SHEETS_AUTH_EMAIL=
GOOGLE_SHEETS_AUTH_KEY=
GOOGLE_SHEETS_WIFI_SHEET_ID=
MYMLH_CLIENT_ID=
MYMLH_CLIENT_SECRET=
AUTH_SESSION_SECRET=
MAILGUN_API_KEY=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
S3_BUCKET=
PGHOST=
PGUSER=
PGDATABASE=
PGPASSWORD=
PGPORT=
SLACK_API_TOKEN=
APPLICATIONS_OPEN_STATUS=
PUSHER_KEY=
To use our database in development, you'll first need to start it. Make sure you have Docker installed. Then run
docker-compose up
And now you can connect to it on port 5432
psql --host=localhost --username=postgres
Before starting the app for the first time, you'll need to put the tables in the places:
npm run migrate
We are using the sequelize CLI to manage migrations. So to create your own:
npm run sequelize -- migration:create --name YOURMIGRATION
We run an API which authenticates admin users via tokens. Currently the only way to create tokens is through scripts. To create a user:
npm run hc-script -- create-admin --email [email protected] --name UserName
To then create a token for that user:
npm run hc-script -- create-token [email protected]
Once you have your token, you can use it to authenticate requests to the API in your HTTP headers:
Authorization: Bearer <<TOKEN GOES HERE >>
To send responses to applicants, you can use the respond
script:
npm run hc-script respond invite applications.json
You can either invite
or reject
.
applications.json
refers to an applications file, which can be generated with suggest-responses
.
npm run hc-script -- suggest-responses invite 50 applications.json
The use of this script requires a score augmentor function for any custom scoring logic. It is placed in src/js/hc-scripts/augment-score.js
.
It takes in a computed application object and returns an augmented score. The identity function (leaving the score unchanged) looks like this:
module.exports = ({ rating }) => rating;
It also makes use of a selection script stored in src/js/hc-scripts/choose-applicants.js
This takes a sorted list of applications, a result count limit and an inviteType
and returns a list of the suggested applications to invite/reject.
E.g. to just takes the top n in the sorted list:
module.exports = ( (sortedApplications, n, inviteType) => {
return sortedApplications.slice(0, n));
});
You can control whether or not applications are open using the APPLICATION_OPEN_STATUS environment variable. This takes a value of either
open
or closed
.
To send team allocations for ticketed hackers that have requested them, you must first suggest some:
npm run hc-script -- teams suggest teams.json
Then you can send them
npm run hc-script -- teams send teams.json
This uses Gulp. Install it globally, and then run to build styles and scripts.
npm install -g gulp
gulp build # Build the assets
gulp serve # Start the server, automatically build assets and reload the browser when changes are made
gulp watch # Watch for changes in assets and build automatically
gulp build --prod # Build production assets (or set NODE_ENV to production)
Want to run this in production? Hack Cambridge runs on Heroku so we recommend that. This application handles a lot of sensitive user data so you'll want to make sure https is implemented and enforced.