Public
Like
1
twitterCompetitorMonitoring
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.
api.ts
https://jamiedubs--cd4e981834ee11f095e59e149126039e.web.val.run
This Val Town project tracks tweets mentioning competitor URLs and visualizes the data in charts.
├── main.tsx (cron) # Hourly cron job to collect tweet data
├── api.ts (http) # HTTP API and static file server
├── db.ts # Database operations and schema
├── utils/
│ └── competitors.ts # Competitor configuration utilities
└── views/
├── index.html # Main HTML template
└── charts.js # Chart rendering JavaScript
TWITTER_BEARER_TOKEN
: Your Twitter API bearer token for searching tweets
-
COMPETITORS
: Comma-separated list of competitor hostnames to track (default:val.town
)Examples:
val.town
(default)val.town,poe.com,shapes.inc
poe.com,character.ai,pi.ai,coze.com,gumloop.com,n8n.io
Here are some popular competitors you might want to track:
val.town,poe.com,character.ai,pi.ai,coze.com,gumloop.com,n8n.io,shapes.inc,manus.im,genspark.ai
- Cron Job (
main.tsx
): Runs hourly to search Twitter for mentions of competitor URLs and stores the results in a database. - Database (
db.ts
): Uses SQLite to store tweet data and provides functions to query the data. - Web Interface (
api.ts
): Serves the HTML page and provides API endpoints for chart data. - Views (
views/
): Contains the HTML template and JavaScript for rendering charts.
- Set up the
TWITTER_BEARER_TOKEN
environment variable with your Twitter API bearer token. - Optionally set the
COMPETITORS
environment variable with your list of competitors to track. - The cron job will automatically run every hour to collect data.
- Visit the HTTP endpoint to view the charts showing tweet counts.
- Tracks tweets mentioning competitor URLs
- Configurable competitor list via environment variables
- Avoids double-counting tweets by storing unique tweet IDs
- Visualizes data in daily trend charts and total count charts
- Automatically updates as new data is collected
- Separated HTML/CSS/JS from API logic for better maintainability