Building Distributed Systems and Workign with Flexible Data.
The system I will build in this repository will prepare us for a future where all democratic elections happen online on Twitter, of course. Our solution will collect and count votes by querying Twitter's streaming API for mentions of specific hash tags, and each component will be capable of horizontally scaling to meet demand.
The ideas discussed here are directly applicable to any system that needs true-scale capabilities.
$ cp setup_dist.sh setup.shAdd your twitter application keys in the setup.sh file and grant execution privileges
$ chmod +u setup.shStart the MongoDB server and nslookup and nsqd daemons.
$ docker-compose upNavigate to the counter folder and build and run it:
$ cd counter
$ go build -o counter
$ ./counterNavigate to the twittervotes folder and build and run it. Ensure that you have the appropriate environment variables set; otherwise, you will see errors when you run the program:
$ cd ../twittervotes
$ go build -o twittervotes
$ ./twittervotesNavigate to the api folder and build and run it:
cd ../api
go build -o api
./apiNavigate to the web folder and build and run it:
cd ../web
go build -o web
./webNow that everything is running, open a browser and head to http://localhost:8081/. Using the user interface, create a poll called Moods and input the options as happy,sad,fail,success. These are common enough words that we are likely to see some relevant activity on Twitter.
Once you have created your poll, you will be taken to the view page where you will start to see the results coming in. Wait for a few seconds and enjoy the UI updates in real time, showing real-time results:
- Improve frontend system.
- Add Vuejs dashboard
- Create SPA.

