Host this site on Vercel yourself.
This website is made to be hosted on Vercel. That makes it easy if you want to deploy it yourself! This guide leads you through all the steps of deploying the website and API through Vercel.
Requirements
- Node.js 20 or later.
- Hack Club AI API key. (https://ai.hackclub.com, only for people under 18)
- Groq API key (https://groq.com).
.env
Use the .env.example as a reference. Add environmental labels through the official Vercel dashboard. If you want your key leaked, you can also just put them publicly on GitHub. (dont sue me if it goes wrong tho)
| Variable | Purpose |
|---|---|
| HACK_CLUB_AI_API_KEY | Used to search for news. |
| GROQ_API_KEY | AI provider for generating summaries. |
| GROQ_MODEL | Optional. The name of the model you want to use. |
| GROQ_TEMPERATURE | Optional. Generation temperature. |
| NEWS_SUBJECTS | Optional. List of what subjects there should be news about. Default: Technology, Business, Science, Health, Climate, Sports, Entertainment, and AI. |
| CRON_SECRET | Optional. Bearer secret checked by the scheduled refresh endpoint. |
| BLOB_READ_WRITE_TOKEN | Needed to store the news when hosting on Vercel. |
| USE_BLOB_STORAGE | Set this to true when using blob storage outside of Vercel. |
| REFRESH_INTERVAL_HOURS | Optional. Defines how long it takes untill the next refresh. |
Deploy to Vercel
- Add the environmental labels in Vercel
- Make a blob storage thing so your data gets saved every refresh.
- Deploy the project.
- Try using /api/health and /api/news after the first refresh.
Local
Make a .env following the example from .env.example. Then, run npm install and npm run dev