Giter VIP home page Giter VIP logo

sch3lp / scrambledeggs Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 871 KB

Breakable Toy project in which I'm learning about Kotlin, Elm, CQRS and EventSourcing. And where I'm running an experiment in which I value E2E tests over unit tests.

License: GNU General Public License v3.0

Kotlin 64.24% Elm 27.72% HTML 0.86% CSS 7.18%
kotlin cqrs-es elm-lang springboot livecoding hobby-project breakable-toy

scrambledeggs's Introduction

Scrambled.gg

A project to get Diabotical players to play more Diabotical, by offering a website to host a Ladder, with a custom points system.

Built in Kotlin, and Elm.

Check the LiveCoding With Sch3lp Twitch Channel to see how it's going, or watch the past episodes on YouTube to see how it went.

Experiments I'm running

Valuing E2E tests over unit tests

With E2E I mean integration tests that hit my REST endpoints, and verify both rdbms and eventstore for correctness.

Hypothesis:

  • I might refactor much faster this way.
  • Running E2E tests is not that much slower than running integration tests + unit tests.

Observations:

  • I miss unit tests on my domain sometimes, so I started writing those.
  • Refactoring is easier most of the time, but running the tests does take longer.
  • Using types properly (aka Lean on the compiler) is a must.
  • I miss integration/framework tests when I don't know enough about a library/framework. For example, I usually finish my refactoring quite easily and then get failing scenario tests because I did something that JDBI doesn't like. JDBI framework tests on my DAO's would give me faster feedback.
  • Had to provide my own JWT stubbing impl, which was both fun and not fun. Normally I would write JWT -> User mgmt stuff in unit tests and then just use basic auth in scenario tests.

Contributing

Read about the design decisions in the Captain's Log.

Unsure which GitMoji to use when committing? Look over here.

Developing locally

Starting the backend:

Navigate to ScrambledApplication and run it via IntelliJ IDEA; or run ./gradlew bootRun

Starting the frontend (for development):

cd ui
npm install
npm start

The script behind npm start is the following:

elm-live src/main/elm/Main.elm --open -d src/main/resources --start-page=index.html --proxy-host=http://localhost:8080/api --proxy-prefix=/api -- --output=src/main/resources/main.js

elm-live: an npm package that runs a compile + server cycle so we can do hot-reloading at dev time.
--open: Opens a browser after successfully running the elm-live command
-d src/main/resources: Set the base-dir from where to serve from to src/main/resources (which contains our index.html and style.css)
--start-page=index.html: So that the elm-main doesn't accidentally override our index.html
--proxy-host=http://localhost:8080/api: Forward requests that are hit with the --proxy-prefix parameter to this exact address
--proxy-prefix=/api: When requests that contain this string are hit, the webserver should forward these requests to the --proxy-host parameter.
--src/main/resources/main.js: Make sure that the dist is built in the same directory as we're serving from (see -d).

Todo

  • ScenarioTests that run against the REST API
  • Get a runnable/demoable application again (starting up ScrambledApplication requires a r2dbc url)
  • How to do projections? From which class/responsible thing do we initiate it?
  • EventSourcing: what's out there? Or do we DIY it with Postgres?
  • Try to use elm-ui (and/or elm-css, dunno what it's called nowadays)
  • Do some proper error handling
  • Actually parse the JSON instead of passing a string
  • Find a better way to develop the UI locally, because gradlew :ui:build is too tedious/slow (no hot-reloading)
  • Make an initial Elm page that calls the rest api
  • Make an initial rest controller
  • Make sure we can run the SpringBoot app from an executable jar
  • Make sure elm-make's build result is served via SpringBoot
  • Make sure we can run elm-make from Gradle
  • Make sure we can run a SpringBoot app
  • Create gradle modules

scrambledeggs's People

Contributors

laurensdc avatar sch3lp avatar

Stargazers

 avatar

Watchers

 avatar  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.