Coder Social home page Coder Social logo

twitter-api-assignment's Introduction

twitter-api-assignment

Overview

This repository is for a programming assignment with the goal of connecting to the Twitter Streaming API and processing some basic statistics on the Tweets received. The code is written with C# targeting .NET 5. In addition to the goals outlined in the assignment, I had an additional design goal to utilize Clean Architecture principles as outlined in this image:

CA image

The solution is composed of the following projects, listed below along with a brief descriptions outlining the intended organization:

  • src
    • API
      • Vanacorps.TwitterClient.API: ASP.NET Core API project acting as the application host and exposing an API controller to retrieve the tweet report.
    • Core
      • Vanacorps.TwitterClient.Domain: Collection of important business entities written as POCOs. Per clean architecture guidance all dependencies point inward towards this project.
      • Vanacorps.TwitterClient.Application: Contains all business logic for the application, largely utilizing a basic CQRS pattern implementation. Also contains contracts to invert dependencies from outer layers such as the infrastructure and API.
    • Infrastructure
      • Vanacorps.TwitterClient.Persistence: Encapsulates concerns related to data persistence. Utilizes EF Core, currently configured to use an in-memory database.
      • Vanacorps.TwitterClient.HttpClient: Infrastructure project to encapsulate the HTTP client responsible for receiving tweets and placing them on a messaging queue. Utilizes MassTransit library as an abstraction around message sending, currently using an in-memory bus. Intended to be host-able separately from the app for scaling purposes.
      • Vanacorps.TwitterClient.TweetProcessor: Infrastructure project to encapsulate the processing required to receive tweets from a messaging queue, process them, and send them to the data store. Utilizes MassTransit library as an abstraction around message consuming, currently using an in-memory bus. Intended to be host-able separately from the app for scaling purposes.
  • test
    • Vanacorps.TwitterClient.Application.UnitTests: xUnit test project covering business logic in the application project.

Running locally

Prerequisites

The only requirements to run this application are the .NET 5 runtime/sdk and a Twitter API bearer token that is authorized to access the streaming API.

Before running the application, the bearer token must be configured as the BEARER_TOKEN environment variable - this can be done in Vanacorps.TwitterClient.API/Properties/launchSettings.json. Replace the text NOT_SET with the value of the token.

Running the application in Visual Studio or VS Code should launch an external browser window and issue at GET request to the single TweetReport endpoint. This will bring back an empty tweet report generated before the streaming client is initialized. Refreshing the page will get the latest data.

twitter-api-assignment's People

Watchers

JJ Vanacore avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.