Looking for code examples: Scala/Play + REST API + Slick/PostgreSQL + React frontend

1,031 views
Skip to first unread message

J. Ro

unread,
Jan 15, 2016, 2:37:13 PM1/15/16
to play-framework
Greetings everyone,

Newbie looking for some code examples to review before embarking on my project.

I am beginning a web application which will incorporate Scala/Play, Slick/PostgreSQL, and principally expose REST/JSON APIs to a web application (considering using React).  I am familiar with getting a REST API up and running using Django REST framework, but Scala & Play are new to me (along with FP approaches). That being said, I have now read several books on Scala & Play, so am on my way to getting up to speed. Bit by bit.

Before starting the initial code for my project, I would like to review some existing code which implements this type of functionality, as most of the ecosystem is unfamiliar to me - and I don't want to reinvent the wheel... poorly. 

Can anyone recommend (1) a well-thought out, and generally vetted Activator template or (2) more preferably a decently mature GitHub project incorporating the above technologies & approaches. Any examples - even those which are close/related - would be enormously helpful. As you can imagine, even with Activator templates, there are lots to choose from, but from a beginner's perspective, difficult to evaluate which is appropriate to start from, or to "crib" from when planning the project. I have seen some vanilla ones which are quite basic, and some complex ones with the kitchen sink. I was thinking an actual project would be useful to see, in addition to a "starting" template.
-----

Background on the project, for those interested (and, so I can use less abstract examples when discussing later):

It's a CRUD web application, to generally show the implementation status of various products & features across a large group of web sites and applications. Looks a bit like a feature-comparison chart, with some additional grouping & metadata — Mostly the data will be presented as client-side dynamic tables (sortable, filterable) populated from JSON data from the Play-provided REST endpoints. The datastore would be PostgreSQL (probably 10-15 interrelated tables), likely using Slick. I have most of the databases already modeled on a development database. 

Some of the models involved would be:
- Company (about 50-100) --> Business Units (3-5 per company) --> Applications/Sites (5-10 per business unit)
- Vendor (30-50) --> Product Suite (2-5 per vendor) --> Products (2-5 per suite)  --> Features (5-10 per product)

An example of data shown in a dynamic table would be the following: 
* Products & features (grouped by product & product suite) available to a company (Columns of table)
* List of applications/sites in table rows (grouped by business unit) (Rows of the table)
* The individual cells would visually indicate enablement status (e.g. gray/blank = "not implemented", green = "successfully enabled"; yellow = "partially implemented", orange = "implemented, but with issues", red = "implemented, but broken", etc)
* Filters/search - client-side checkboxes or a search field, where the user the client side rapidly narrow down to an individual application or product
* Data:  (1) a JSON blob showing all products available to the company (allowing the client-side to iterate through it); (2) a big JSON blog containing each application/site for a company, and within each application/site, would be a listing of all products/features enabled for that site, along with the implementation status. 

The first swing will be getting the backend up and running (the data & APIs). The next swing will be the actual client code itself. While outside the scope of this discussion group, if anyone has examples of React-powered dynamic tables, using structured data from a REST API, I would be thankful for any good examples shared of that too.

Many thanks,
Jonathan



Jochen

unread,
Jan 17, 2016, 10:28:53 AM1/17/16
to play-framework
You can take a look at this: 

It is a play2.3/slick project with restfull api used by a react client. Using Mysql instead of Postgres though.


Christian Schmitt

unread,
Jan 17, 2016, 11:29:01 AM1/17/16
to play-framework
If you are unfamiliar with the ecosystem you shouldn't use it for a project that will be used in production.

J. Ro

unread,
Jan 18, 2016, 3:42:35 PM1/18/16
to play-framework
  • Jochen - Thank you for sharing. Your project is very helpful. This is going to be a huge help.
  • Christian - Completely agreed. This project is an internal tool I will be building & learning on. When more mature (e.g. after validation and usage from internal people), I will work towards a more vetted, production-ready release.

Manuel Bernhardt

unread,
Jan 18, 2016, 5:09:14 PM1/18/16
to play-fr...@googlegroups.com
You could have a look at the code for chapter 7 here: https://github.com/manuelbernhardt/reactive-web-applications

It doesn't feature Slick, but does feature PostgreSQL with jOOQ and should give you a sense of how to get things working. Chapter 8 also shows UI (with Scala.js amongst others)

Cheers,

Manuel

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/2800b148-209c-4695-bd09-bdc601e871cb%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

tho...@cream-touch.com

unread,
Feb 9, 2016, 3:54:17 AM2/9/16
to play-framework
Hi !

I'm looking for exactly the same thing.

I feel like Play Framework documentation is too complexe, incomplete or obsolete.
Same for Slick.

I'm trying to refactor a Play 1.x JPA MySQL API into Play 2.5.x with Slick 3.x and I'm making baby steps.

I managed to generate the Tables with Slick CodeGen and am trying to understand how I can extend the entities to add extra logic into my models classes.

If you find any modern Play/Slick implementation, please provide link.

Thank you.

Good luck for your project !

PS:
I love ReactJS/Redux and will also build a frontend with these soon.
I've used Angular 1.x during 1 year and I've experienced the limitations of this framework.
Reply all
Reply to author
Forward
0 new messages