This repository contains a complete web application that roughly implements the Twecoll command line utility at https://github.com/jdevoo/twecoll. An AngularDart-based frontend served from Firebase Hosting manages the UI, while an App Engine Go service manages the backend. It makes full use of Firebase Authentication, Storage, and the Firestore to do this.
Install the relevant development tools:
- Google Go
- AngularDart
- Google Cloud SDK
- Firebase CLI
- Git of course.
Now provision cloud resources for it:
- Create a Google Cloud project. Note the Project ID.
- Link it to Firebase.
- Create a Twitter developer account and application. It should permit login.
Inside the Firebase Console activate Firebase Authentication for Twitter. Paste the OAuth redirect endpoint into your Twitter application configuration. Similarly paste the Twitter login credentials into the appropriate boxes in Firebase.
Enable Firestore and Storage.
Clone this repository:
git clone https://github.com/Techbert08/twitterweb.git twitterweb
Inside the app code, make the following adjustments:
- Inside
backend/constants.go, add the Cloud project ID, the Twitter Key and the Twitter Secret from before. - Inside
frontend/web/main.dart, fill in the Firebase credentials from "Project Settings->Add Firebase to your web app" in the Firebase Console. Ensure theapiEndpointis set, too.
Run the following:
cd twitterweb/backend
gcloud app deploy app.yaml cron.yaml
cd ../frontend
gsutil cors set cors.json gs://${PROJECTID}.appspot.com
pub get
webdev build
firebase deploy
The application should appear at https://${PROJECTID}.firebaseapp.com
From there log in with a Twitter account, and input a handle to start fetching. Twitter is rate-limited to 15 queries every 15 minutes, so a background task fetches one handle per minute until complete. A download link is offered when done.
The backend code in Go should probably be a Cloud Function, but at present those aren't available in Go. If that happens the application can fit entirely inside Firebase tooling.