GithubHelp home page GithubHelp logo

smiklos / backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from branchtalk-io/backend

0.0 1.0 0.0 1.01 MB

Reddit-clone demonstrating how larger, DDD-based, event sourced, purely FP application could be implemented in Scala (if requirements would justify certain costs!).

License: GNU Affero General Public License v3.0

Makefile 0.33% Scala 99.23% Shell 0.07% PLpgSQL 0.37%

backend's Introduction

Branchtalk

Demo of how scalable implementation of Reddit-like service could be made in Scala to demonstrate some patterns and principles.

Goals and documentations are in docs directory. You can also start by looking at main and browsing code from there in your IDE.

License

AGPL - if I cannot make money out of it, nobody else will. (You know where to find me).

Status

Achieved virtually all intended functionality:

  • users domain, with simple permission system and GDPR (deleting users from DB, events' fields containing personal data are encrypted)
  • discussions domain, with ability to subscribe to channels, having non-linear discussions, sorting posts by newest, most popular, most controversial
  • commands are enqueued and then turned into events, events are projected into updates of SQL database (it would be possible to add other projections)
  • API is documented using automatically generated Swagger
  • all important parameters are configurable, users can decide whether they want to run or not API, users' domain projections or discussions' projections in each instance

Some small TODOs are left, a few things could be improved or refactored. Code could use some more documentation to explain design decisions and how utilities work.

Things that could be implemented:

  • OAuth2 support
  • full context search using ElasticSearch or Solr or similar
  • some notification system

Things that are missing if this was a real project, but are out of scope intended for example app:

  • reporting posts, comments and users to moderators
  • automatically detecting illegal content to remove it and block offenders
  • email validation

Development

Building and testing requires java installed. Then

./sbt

downloads and runs sbt shell.

To run integration tests or local env you need docker and make:

make dev-bg   # starts services in background
make dev-up   # starts services in terminal (I suggest a separate tab/window)

Then it is possible to run it tests:

sbt> it:test
make dev-down # shuts down services

Local testing

While in sbt with Docker started run

sbt:branchtalk> application/run --monolith

to start application in a fork. Ctrl+D to send shutdown signal.

OpenAPI will be available at:

http://localhost:8080/docs/index.html?url=/docs/swagger.json

Running locally without sbt

Build docker image:

sbt:branchtalk> application/docker:publishLocal

Once the image is published you can:

make local-bg # or
make local-up

(If it fails I suggest running make dev-down before running local env).

You can use Ctrl+D to gracefully shutdown service. Server will be available at http://localhost:8080 and Swagger at http://localhost:8080/docs/index.html?url=/docs/swagger.json .

backend's People

Contributors

mateuszkubuszok avatar

Watchers

 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.