All Projects → Unthrottled → mongo-images

Unthrottled / mongo-images

Licence: MIT license
Ever wonder how you can create a full stack reactive application that also saves images? Well look no further! We've got Spring Webflux, Reactive Mongo Streams with GridFS, and Angular5!

Programming Languages

typescript
32286 projects
java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to mongo-images

kotlin-kafka-and-kafka-streams-examples
Kafka with KafkaReactor and Kafka Streams Examples in Kotlin
Stars: ✭ 33 (+175%)
Mutual labels:  reactor-core, reactive-streams, reactive-programming, webflux
Flutter validation login form bloc pattern rxdart
[Functional reactive programming (FRP)]💧 💧 💧 [Pure RxDart] Validation login form by using the BLoC pattern with RxDart - A new Flutter project featuring a faked authentication interface to demonstrate validation. Implemented with BloC pattern.
Stars: ✭ 45 (+275%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
Rx.Http
A reactive way to make HTTP Request in .NET Core 🚀
Stars: ✭ 62 (+416.67%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
Awesome Reactive Programming
A repository for sharing all the resources available on Reactive Programming and Reactive Systems
Stars: ✭ 163 (+1258.33%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
KotlinReactiveMS
An educational project to learn reactive programming with Spring 5 and Kotlin
Stars: ✭ 33 (+175%)
Mutual labels:  reactive-streams, reactive-programming, webflux
flutter-form-with-validation-BLOC
This form and validation functions are created by using the BLOC pattern with RxDart instead of using StatefulWidget
Stars: ✭ 63 (+425%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
Rxdownloader
- Reactive Extension Library for Android to download files
Stars: ✭ 40 (+233.33%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
webflux-streaming-demo
A tryout of reactive application using Spring 5 WebFlux and mongoDB, along with an overview article on reactive programming.
Stars: ✭ 96 (+700%)
Mutual labels:  reactive-streams, reactive-programming, webflux
Monix
Asynchronous, Reactive Programming for Scala and Scala.js.
Stars: ✭ 1,819 (+15058.33%)
Mutual labels:  reactivex, reactive-streams, reactive-programming
Reactiveui
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable state away from your user interfaces, express the idea around a feature in one readable place and improve the testability of your application.
Stars: ✭ 6,709 (+55808.33%)
Mutual labels:  reactivex, reactive-programming
RxJava-Codelab
Codelab project for demonstration of RxJava features
Stars: ✭ 44 (+266.67%)
Mutual labels:  reactivex, reactive-programming
Dynamicdata
Reactive collections based on Rx.Net
Stars: ✭ 1,083 (+8925%)
Mutual labels:  reactivex, reactive-programming
Awesome Rxjs
A collection of awesome RxJS resources
Stars: ✭ 314 (+2516.67%)
Mutual labels:  reactivex, reactive-programming
reactor-go
A golang implementation for reactive-streams.
Stars: ✭ 48 (+300%)
Mutual labels:  reactivex, reactive-streams
Reactive Ms Example
An educational project to learn reactive programming with Spring 5
Stars: ✭ 157 (+1208.33%)
Mutual labels:  reactive-streams, reactive-programming
Ayanami
🍭 A better way to react with state
Stars: ✭ 129 (+975%)
Mutual labels:  reactivex, reactive-programming
Rxjava2 Extras
Utilities for use with RxJava 2
Stars: ✭ 167 (+1291.67%)
Mutual labels:  reactivex, reactive-streams
tutorials
Code samples for tutorials blog
Stars: ✭ 49 (+308.33%)
Mutual labels:  reactor-core, webflux
Pharmacist
Builds observables from events.
Stars: ✭ 221 (+1741.67%)
Mutual labels:  reactivex, reactive-programming
Rsocket Rpc Java
Standard RSocket RPC Java Implementation
Stars: ✭ 126 (+950%)
Mutual labels:  reactive-streams, reactive-programming

Reactive NoSql Image Persistence


Have you bought into the whole Reactive Programming bit yet? Well, I have participated in consuming the "Reactive Flavor Aid" and there is one issue at the moment. Currently, there is a supreme lack of helpful documentation to assist in a seamless development experience. Fear not fellow reactive enthusiast, this post should help you save images in MongoDB utilizing reactive streams!

Recently, I wanted to create a project that is a full slice reactive application. Meaning that the code and communication between the Frontend, Backend, and Data Persistence Layers are reactive. When reactive is stated, the following can be assumed:

With all of this criterion set, here is the following application stack that I came up with:

At a high level, the project consists of a Spring Boot server. Which serves static content to the user, and provides a REST API to save, update, retrieve, and delete persisted images.

The images are stored in a Mongo database. The server takes advantage of GridFS which breaks the image binary into chunks which allows for storage of images greater than 16MB.

This all sounds straight forward, right? As it turns out, there is very little documentation and examples on how to do anything reactive!

Look no further said documentation!

Local Deployment (For the ambitious)

To run this project locally you will need the following goodies:

All you have to do is at the root of this repository run: docker-compose up -d

Boom! You are done.

What this does is starts a Mongo server. In addition to mounting the data location to dataDump in the root of this repository. So that when the Mongo server container gets removed, all of the data is saved.

In addition to the mongo server, it also spins up the Spring boot server, and binds the container port to the host port 80. So that mean you can open

http://localhost/

An get the index.html!

Local Development

If you want to make changes to any of this code, the unpackaged code exists in the web-content directory. Familiarity with Angular 5 is a plus.

There exists a docker compose file that will allow you to install your node modules locally (node_models).

All you have to do is run docker-compose -f docker-compose-build.yml up.

Once that is done, you are free to make changes! To move the changed code into the web server all you have to do is run,

docker-compose -f docker-compose-deploy.yml up and that should transpile all of the typscript, bundle it up, and move it to web-service/src/main/resources

Live action development!

docker-compose -f docker-compose-dev.yml up -d

will run the web server, mongo, and also serve the static web-content from browsersync.

The plus here is that you get live change updates, as the dev server will watch all web-content files for changes.

The dev server runs on http://localhost:3000.

Fun fact, if you make any changes to typscript files, you will have to recompile the code to get the changes to take hold.

You could create a script that has this as the command:

docker run --rm -v /home/alex/workspace/acari-landing/mong-images:/app alexsimons/nodebuild run compile

You will probably want to replace /home/alex/workspace with whatever you put the repository.

(Maybe I should create a compose file that does that....)

Web-Service

This directory contains a Webflux Spring Boot server. Which is configured to serve static web content, which was generated from the web-content directory.

The Mongo client and GridFS are from the reactive streams library.

Image binary is streamed chunked to the frontend, to avoid needing to keep the entire image in memory.

Form data sent to the server via the REST API is recieved as a Flux<Part>

Web-content

This directory holds all of the fun bits to serve end-user rendered html. It enables you to pick, view, upload, and delete images! GIFs, JPEGS, PNG, WebP, all work. However, SVGs and ICOs do not display.

Screenshot

Webpack 3

Webpack is currently configured with the following goodies:

  • Browsersync Server that runs on localhost:3000 (when you run npm run watch) with a proxy to redirect HTTP request to an intended destination.
  • It is set to create 3 files on build
    • app.[hash].js: which is all of the application code bundled together in a cache-busting hash post-fixed js file.
    • vendor.[hash].js: all of the vendor code wrapped up such as: angular5, bootstrap, rxjs, etc.
    • polyfills.[hash].js: all of the browser compatability stuff, I think....
  • It is set to expose jquery as the global variables $ and jQuery
  • It is set to load html templates post-fixed with htm into the javascript files (to avoid browser caching).
  • It has a sass build process.
  • All of the bundled files will be put into the index.html body when the node task build is run.

Bootstrap 4

Typescript Linting

Which is run by the command npm run lint

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].