A Node.js application that crawls recipes from web sources and converts them to Jow-compatible format.
- Crawls recipes from supported web sources
- Matches ingredients with Jow's ingredient database
- Converts units and measurements
- Uploads images to Jow's CDN
- Preserves recipe metadata and instructions
- Node.js (v18 or higher)
- npm (v8 or higher)
- Valid API tokens (see Configuration)
git clone https://github.com/yourusername/web-to-jow-recipes.git
cd web-to-jow-recipes
pnpm install
Create a .env
file in the root directory by copying the .env.example
file.
Required environment variables:
Variable | Description |
---|---|
SOURCE_BASE_URL | Base URL for the source API where recipes are crawled from |
SOURCE_BEARER_TOKEN | Authentication token for accessing the source API |
SOURCE_IMG_BASE_URL | Base URL for accessing images from the source website |
JOW_BASE_URL | Base URL for Jow's API where recipes will be uploaded |
JOW_BEARER_TOKEN | Authentication token for accessing Jow's API |
pnpm build
pnpm start
POST /api/recipes/crawl
- Start recipe crawling from sourcePOST /api/recipes/sync
- Get already uploaded recipes and put them into filealready-processed-recipes.txt
DELETE /api/recipes
- Delete recipes uploaded to jow
Initiates the crawling process from the source website.
POST /api/recipes/crawl
Query Parameters:
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
page | integer | No | 1 | Starting page for the crawler |
Response:
{
"processed": 10, // Number of successfully processed recipes
"failed": 0, // Number of failed recipes
"errors": [] // Array of error messages (only present if failed > 0)
}
Error Response (500):
{
"error": "Error message description"
}
Retrieves all recipes that have been uploaded to Jow and saves their names to a file.
POST /api/recipes/sync
Response:
{
"message": "Recipes synced successfully"
}
Error Response (500):
{
"error": "Error message description"
}
Removes all recipes that were uploaded to Jow.
DELETE /api/recipes
Response:
{
"message": "Recipes deleted successfully"
}
Error Response (500):
{
"error": "Error message description"
}
Using curl:
# Start crawling from page 2
curl -X POST "http://localhost:3000/api/recipes/crawl?page=2"
# Sync processed recipes
curl -X POST "http://localhost:3000/api/recipes/sync"
# Delete all recipes
curl -X DELETE "http://localhost:3000/api/recipes"
Using JavaScript fetch:
// Start crawling
const response = await fetch('http://localhost:3000/api/recipes/crawl?page=1', {
method: 'POST',
});
const data = await response.json();
// Sync recipes
await fetch('http://localhost:3000/api/recipes/sync', {
method: 'POST',
});
// Delete recipes
await fetch('http://localhost:3000/api/recipes', {
method: 'DELETE',
});