scastiel / showhn-projects

A webapp to browse projects posted on Show HN.

Home Page:https://showhn-dashboard.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Show HN projects

A webapp to browse projects posted on Show HN. The application is available at showhn-dashboard.netlify.app, but you can also run it locally or on your own server if you want to. Note that you will need a Twitter and GitHub APIs access.

The project is composed of:

  • A backend containing a PostgreSQL database and a GraphQL API. It is handled by Nhost, which uses Hasura.
  • A Node.js application to scrap the projects (using HN, Twitter and GitHub APIs and some web scraping). The application provides serverless functions and CLI tools.
  • A React web application that connects to the GraphQL API to display the projects.

Running the backend

Option 1: Nhost account

Create a project on Nhost (they offer a 30-days free trial), and note:

  • the GraphQL API and backend URLs (on the Dashboard tab)
  • the admin secret (on the Hasura tab)

Copy the .env.example file to create .env, and replace the values in there.

Option 2: local Docker container

Copy the .env.example file to create .env, and replace the values in there. The default URLs (Nhost section) should be the right ones for your local installation.

Run yarn docker:start (it will use Docker-compose) to run the PostgreSQL database and Hasura GraphQL server locally.

The NHost console will be available at http://localhost:8080, the secret is the value of HASURA_GRAPHQL_ADMIN_SECRET in your .env file.

Final steps

  • Connect to the NHost console
  • Import the PostgreSQL dump in hasura_pg_dump.sql (Data tab, then SQL in the sidebar, copy-paste the file content)
  • Import the Hasura metatata in hasura_metadata.json (settings icon at top-right, then Import metadata)

Running the frontend

Run yarn web:run:dev.

Running the scrapper

In the scraper directory (cd scraper):

  • yarn run:dev src/cli/newest-scraper.ts: scraps the latest Show HN stories, i.e. the ones you can see on HN in the Show section.
  • yarn run:dev src/cli/update-stories-score.ts: updates all the stories score by refetching it from the HN API.
  • yarn run:dev src/cli/rescrap.ts: updates all stories existing in the database by rescraping them (useful in case the scraper was updated).

Work in progress 🏗

As you can see this README is very minimal. There is a lot of information to put in there. Don’t hesitate to ask me any information you need, while I’m working on improving this documentation.

About

A webapp to browse projects posted on Show HN.

https://showhn-dashboard.netlify.app/

License:GNU Affero General Public License v3.0


Languages

Language:TypeScript 92.3%Language:HTML 4.5%Language:JavaScript 1.5%Language:CSS 1.2%Language:Shell 0.5%