Serverless + Searchable HN Who's Hiring Posts
- HN Hired grabs the latest HN who's hiring post and presents everything with a searchable material ui experience.
- The app utilizes Next.js to run serverless via AWS Lambda; both the client and server exist within a function which eases cross-origin opaque resource retrieval restrictions.
- A manually curated list of trends are matched with a cursory regexp to give a loose ranking in the left sidebar.
- Fuse.js provides very fast client fuzzy searching for anything in the comments.
- Material UI components enrich the presentation with autocomplete, search chips, and a simple responsive layout.
- Clone this repo and run
yarnto install the project dependencies.
yarn devto start the local server and visit
http://localhost:3000to run the app.
- If you're unfamiliar with
Next.jsthe file system is the main API. Anything within
pages/ends up having a corresponding route. With this application there is a single file, index.js, which is the entry point.
Serverless deployment can be tricky but there are some wonderful tools available to bring everything together and make it possible. I opted to use Claudia.js - here's some important steps to make everything happen:
- Setup the necessary AWS credentials. See here under
Configuring access credentials.
- Change your
.aws/credentialsso that there is a profile for claudia:
$ cat ~/.aws/credentials [claudia] aws_access_key_id = abc aws_secret_access_key = 123
- Build the project with
- Create an AWS Lambda function and deploy it:
claudia create --region us-west-1 --handler lambda.handler --deploy-proxy-api --profile claudia --memory 1280 # If there are issues with the path to the bin you can either install claudia as a global package or simply just specify the full path to the respective bin, `node_modules/.bin/claudia`.
- Any subsequent deploys should run