Prerequisites
Before you begin, make sure you have:- Node.js 20+ installed on your machine
- An Upstash account with a Redis database (upstash.com)
- A Google Safe Browsing API key from the Google Cloud Console
Setup
Configure environment variables
Create a
You can find
.env file in the project root and add the following variables:.env
| Variable | Description |
|---|---|
UPSTASH_REDIS_REST_URL | The REST URL for your Upstash Redis database |
UPSTASH_REDIS_REST_TOKEN | The authentication token for your Upstash Redis database |
GOOGLE_SAFE_API_KEY | Your Google Safe Browsing API key |
UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN on your database page in the Upstash Console.Start the server
The server listens on port 4000 by default. To use a different port, set the
PORT environment variable (e.g., PORT=8080).Make your first check
With the server running, send a You should receive a response like this:
POST request to /api/check with the URL you want to analyze:| Field | Type | Description |
|---|---|---|
url | string | The URL that was analyzed |
score | number | Risk score from 0 to 100 |
verdict | string | "safe", "suspicious", or "phishing" |
reasons | string[] | List of reasons that contributed to the score |
executionTimeMs | object | Time taken by each checker in milliseconds |