Case study

Twitter-Engine

View as

Twitter-Engine is a monolithic application designed to mimic Twitter's core features, including user authentication and real-time updates. Built using F# and the Suave framework, it offers a seamless experience for users to post tweets and follow others.

Architecture

The architecture of Twitter-Engine is designed as a monolith, which simplifies deployment and management. It effectively integrates both API and user interface components on a single server, ensuring reliability and ease of use.

Stack

The choice of F# and the Suave framework reflects a commitment to leveraging mature technologies that enhance development efficiency. This tech stack supports robust RESTful services, allowing for a responsive user experience while maintaining high standards of code quality.

Deep dive

The application employs a WebSocket connection for real-time updates, enhancing user engagement by providing instant feedback on actions like tweet posting. This approach ensures that users receive timely notifications without the need for constant page refreshes.

Twitter-Engine is a monolithic application developed in F#, utilizing the Suave framework for RESTful services. The architecture supports both API and UI functionalities on a single server, implementing real-time updates through WebSocket connections.

Architecture

Twitter-Engine follows a monolithic architecture that implements a RESTful pattern. The application handles both API and UI functionalities within a single server environment, utilizing POST and GET requests for its REST API and WebSocket connections for real-time updates.

Stack

Twitter-Engine is built using F# and incorporates several libraries such as Akka.FSharp for actor-based concurrency, DotNetty for networking, and Newtonsoft.Json for JSON handling. This combination facilitates efficient handling of real-time updates and user interactions.

Deep dive

In Twitter-Engine, the integration of WebSocket for real-time updates presents a significant engineering challenge, requiring careful management of state and concurrency. The use of Akka.FSharp allows for effective handling of asynchronous events, while the Suave framework streamlines the development of RESTful services. The application consists of 51 files, all written in F#, reflecting a focused and cohesive codebase.

Guided tour

  1. 01

    Twitter Engine: Mimicking Twitter Features

    Twitter Engine is an application that replicates core Twitter functionalities, allowing users to register, log in, tweet, and follow others. It provides real-time updates through WebSocket and a REST API for seamless client-server interaction.

    • Mimics Twitter features
  2. 02

    Serverless Event-Driven Architecture

    The architecture is serverless and event-driven, utilizing WebSocket for real-time communication and REST API for client interactions. Actors manage requests and responses efficiently.

    • Uses WebSocket for real-time updates
  3. 03

    Key Implementation in Program.fs

    The Program.fs file contains the main application logic, including the setup for the REST API and WebSocket connections. This file showcases the developer's approach to handling requests and managing real-time updates.

    Program.fs

    // Main entry point
    [<EntryPoint>]
    let main argv =
        // Setup server and routes
        startWebServer defaultConfig app
        0
  4. 04

    No CI Tests Configured

    Currently, there are no continuous integration tests configured for this project. Testing is manual and relies on running the application in an IDE.

    • !No CI workflows present
  5. 05

    No CI/CD Workflows Configured

    There are no CI/CD workflows configured for deployment in this project. The application is intended to be run locally from an IDE.

    • !No deployment workflows present
  6. 06

    Try It Locally

    To run the application, clone the repository and open the UI.html file in a web browser after starting the server in an IDE.

    git clone https://github.com/shashankcm95/Twitter-Engine
Architecture
graph TD;
    A[Client] -->|WebSocket| B[Server];
    A -->|REST API| C[API Endpoints];
    C -->|Handles Requests| D[Actors];
    D -->|Push Updates| A;

Diagram source rendered with mermaid.js.

Built with
  • F#
  • The application is written in F#.
  • The application uses the Suave framework.
  • The application uses the Akka.FSharp library.
  • The application uses the DotNetty library.
  • The application uses the Newtonsoft.Json library.

Verified facts

  • The application is written in F#.from README
    Evidence
    The code is written in FSharp and uses F# actors.

    Source: README

  • The application uses the Suave framework.from README
    Evidence
    I was able to achieve the rest services required as a part of this project using the package 'suave.io'.

    Source: README

  • The application uses the Akka.FSharp library.from code
    Evidence
    Akka.FSharp

    Source: dependencies

  • The application uses the DotNetty library.from code
    Evidence
    DotNetty

    Source: dependencies

  • The application uses the Newtonsoft.Json library.from code
    Evidence
    Newtonsoft.Json

    Source: dependencies

  • The application is built using Jetbrains Rider.from README
    Evidence
    I have used Jetbrains Rider v 2020.3

    Source: README

  • The architecture type of the application is monolith.from code
    Evidence
    type: 'monolith'

    Source: architecture

  • The application follows a RESTful architecture pattern.from code
    Evidence
    pattern: 'RESTful'

    Source: architecture

View repository ↗