• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
project logo

artivilla

rss

newsletters im reading daily
Public
Like
rss
Home
Code
11
frontend
8
services
1
shared
1
.vtignore
MIGRATION.md
README.md
deno.json
C
feed.cron.ts
feeds.json
H
http.ts
test-domains.ts
Branches
1
Pull requests
Remixes
1
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
MIGRATION.md
Code
/
MIGRATION.md
Search
7/28/2025
Viewing readonly version of main branch: v122
View latest version
MIGRATION.md

Migration Guide

This document explains the changes made during the refactoring to follow Val Town's recommended project structure.

What Changed

🏗️ Project Structure

  • Before: Monolithic structure with mod.ts, pkg/, and build.ts
  • After: Clean separation with backend/, frontend/, and dedicated files

📁 File Changes

Removed Files

  • mod.ts - Replaced by backend/services/rss.ts
  • build.ts - Replaced by updateFeeds.cron.ts
  • pkg/mod.ts - Logic moved to backend/services/rss.ts
  • pkg/template.tsx - No longer needed (frontend handles rendering)

New Files

  • feeds.json - Feed configuration (extracted from hardcoded array)
  • backend/services/rss.ts - RSS processing service
  • updateFeeds.cron.ts - Scheduled feed updates
  • backend/README.md - Backend documentation

Modified Files

  • http.ts - Now uses Hono framework with proper routing
  • README.md - Updated with new structure and usage

🔧 Technical Changes

HTTP Handling

- // Old: Simple passthrough - export default function (req: Request) { - return tinyfeed.fetch(req); - } + // New: Hono-based routing with proper error handling + const app = new Hono(); + app.get("/api/data", async (c) => { ... }); + export default app.fetch;

Storage

- // Old: unstorage with Val Town driver - import valTownDriver from "https://esm.town/v/pomdtr/unstorage-driver/main.tsx"; - const storage = createStorage({ driver: valTownDriver({}) }); + // New: Direct blob storage + import { blob } from "https://esm.town/v/std/blob"; + await blob.setJSON("rss:app-data", data);

Configuration

- // Old: Hardcoded in mod.ts - feeds: [ - "https://blog.val.town/rss.xml", - "https://blog.railway.com/rss.xml", - // ... more feeds - ] + // New: External JSON configuration + // feeds.json + [ + "https://blog.val.town/rss.xml", + "https://blog.railway.com/rss.xml", + // ... more feeds + ]

Feed Updates

- // Old: Manual build trigger - // Run build.ts manually + // New: Automated cron job + // updateFeeds.cron.ts runs every 6 hours automatically

Benefits of New Structure

✅ Improved Maintainability

  • Clear separation of concerns
  • Backend services isolated from HTTP handling
  • Configuration externalized for easy updates

✅ Better Error Handling

  • Comprehensive error boundaries
  • Individual feed failures don't block others
  • Proper HTTP status codes and responses

✅ Val Town Best Practices

  • Uses Hono framework for HTTP handling
  • Proper static file serving with Val Town utilities
  • Follows recommended directory structure

✅ Enhanced Features

  • Automatic scheduled updates
  • Better API design
  • Improved logging and monitoring

Migration Steps Completed

  1. ✅ Created feeds.json with feed configuration
  2. ✅ Built backend/services/rss.ts with separated concerns
  3. ✅ Refactored http.ts to use Hono framework
  4. ✅ Created updateFeeds.cron.ts for automated updates
  5. ✅ Updated documentation and README
  6. ✅ Cleaned up old files

What You Need to Do

Immediate Actions

  1. Review feeds.json - Verify all your feeds are included
  2. Test the endpoints - Visit your app URL to ensure everything works
  3. Schedule the cron job - Set up updateFeeds.cron.ts to run every 6 hours

Optional Customizations

  1. Adjust cron frequency - Modify the schedule in updateFeeds.cron.ts
  2. Add more feeds - Simply edit feeds.json
  3. Customize UI - Modify React components in frontend/
  4. Add API features - Extend routes in http.ts

Troubleshooting

Common Issues

Data not loading?

  • Run updateFeeds.cron.ts manually to populate initial data
  • Check blob storage keys are prefixed with rss:

Feeds not updating?

  • Verify cron job is scheduled and running
  • Check console logs for feed fetch errors

Frontend not loading?

  • Ensure static file serving is working
  • Check that frontend/index.html exists

Getting Help

Check the following files for detailed information:

  • backend/README.md - Backend service documentation
  • README.md - Overall project documentation
  • Console logs during cron job execution

Performance Notes

  • Feeds are now fetched in parallel for better performance
  • Failed feeds don't block successful ones
  • Results are cached in blob storage between updates
  • Frontend loads data asynchronously for better UX

The refactoring is complete and your RSS aggregator now follows Val Town best practices while maintaining all existing functionality with improved reliability and maintainability.

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.