Project Phoenix - From PHP to the Play Framework in 3 months
Jun. 26, 2014•0 likes
0 likes
Be the first to like this
Show More
•2,621 views
views
Total views
0
On Slideshare
0
From embeds
0
Number of embeds
0
Download to read offline
Report
Software
Technology
Education
This is an experience report about Project Phoenix, aiming at porting a platform to the Play Framework with Scala in the short time period of 3 months. The presentation was given at Devoxx UK 2014
@elmanu#playframework
Building the new platform
• Started with Anorm
• Too verbose
!
• Switched to Slick
• Plain SQL with neat string interpolation
• DSL for composing queries
@elmanu#playframework
Building the new platform
def fetchItemWithRelevanceSort(userId: Long, skip: Int, limit: Int)!
(implicit s: Session): List[Item] = {!
val q = for {!
i <- items if !i.deleted!
! && i.visible_on_profile!
! && i.user_id === userId!
} yield i!
!
q.sortBy(item => (item.selected.desc, item.created_on.desc))!
.drop(skip)!
.take(limit)!
.list!
!
}
val query = sql"""!
with invites_for_market as (!
select #$inviteSL, #$inviteMarketSL!
from invite i!
inner join invite_market im!
on i.id = im.invite_id!
and im.market_id = ${marketId.id}!
where i.art_type = ${artType.toString}!
and i.visibility_state = ${InviteVisibilityState.Public}!
and i.deleted = false!
order by i.submission_start desc, i.id desc!
limit $limit!
offset $skip!
)!
!
select ifm.*, #$localInviteSL!
from invites_for_market ifm!
inner join local_invite li!
on ifm.id = li.invite_id!
and li.completed = true!
order by ifm.submission_start desc, ifm.id asc!
"""!
val queryResults = query.as[(Invite, InviteMarket, LocalInvite)].list!
@elmanu#playframework
Building the new platform
• Recently open-sourced by Facebook
!
• Virtual DOM, fast
!
• Very easy to integrate in a page
(less invasive than Angular)
ReactJS
@elmanu#playframework
Building the new platform
• Build pipeline using gulp.js & bower
!
• Assets pipeline
• LESS compilation
• JS minification
• Upload assets to Cloudfront
• Integrates translations from Crowdin
• Washes the dishes
@elmanu#playframework
Data migration
• Akka to the rescue!
!
• Concurrent user migration
!
• Concurrent item migration
• Using Play’s WS library for async
calls to Youtube and friends
@elmanu#playframework
Summary & Future
• Play Framework does not get in the way
• Easy to deploy and operate
• Many, many integrations
!
• Many plans for the future
• Live activity feed
• Similarity search
!
• Talenthouse is hiring!