first
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.
index.ts
https://gthmbri--6fbab68632e711f0b23a569c3dd06744.web.val.run
This application scrapes tweets and other metrics from Twitter/X API, stores them in a SQLite database, and displays them in a web interface.
- Fetches tweets and metrics from Twitter/X API
- Stores data in SQLite database
- Periodically updates data using a cron job
- Displays tweets and metrics in a web interface
- Provides filtering and sorting options
├── backend/
│ ├── database/
│ │ ├── migrations.ts # Schema definitions
│ │ └── queries.ts # DB query functions
│ ├── services/
│ │ └── twitter.ts # Twitter API integration
│ ├── routes/
│ │ ├── api.ts # API routes
│ │ └── static.ts # Static file serving
│ ├── cron.ts # Cron job for data fetching
│ └── index.ts # Main entry point
├── frontend/
│ ├── components/
│ │ ├── TweetList.js # Tweet list component
│ │ └── MetricsChart.js # Metrics visualization
│ ├── index.html # Main HTML template
│ ├── app.js # Frontend JS entry point
│ └── style.css # Custom styles
└── shared/
└── types.ts # Shared types and interfaces
-
Set up the following environment variables in Val Town:
TWITTER_API_KEY
- Your Twitter/X API keyTWITTER_API_SECRET
- Your Twitter/X API secretTWITTER_BEARER_TOKEN
- Your Twitter/X bearer token
-
Deploy the application on Val Town
- Access the web interface to view tweets and metrics
- The data is automatically updated via a cron job
- Use the API endpoints to access the data programmatically