SlideShare a Scribd company logo
1 of 29
Henry Van Styn
<vanstyn@cpan.org>
The Perl Conference 2017
June 20, Washington, DC
www.rapidapp.info
rapi.io/blog
irc.perl.org - #rapidapp
Rapi::Blogmaximalist control, minimalist effort
@vanstyn
slides: rapi.io/tpc2017
About me
• Henry Van Styn (@vanstyn)
• Owner of IntelliTree Solutions, perl shop and consultancy
• Author/maintainer of RapidApp
• Catalyst and DBIx::Class contributor
• Given talks/demos of RapidApp for the past several years at The Perl
Conference
• This year I wanted to give a RapidApp demo of a
bigger, real-world app that’s real-world useful
• Married this with solving another of my long-time
unmet needs:
A real, modern perl blog platform…
Why another blog platform?
• Many reasons, a better mousetrap…
• RapidApp is already very well-suited to the problem domain
Biggest reason:
Fresh take on front-end APIs
(i.e. “themes”)
The problem with “themes”
• The word itself implies restrictiveness
‣ changing the appearance of something that is already defined
• Inventing concepts of “pages” and “sections” and “blocks” and layouts and on
and on and on that you have to adhere to
• URL end-points are predetermined, rendered HTML assembled in domain-
specific manner
• Have to learn platform-specific APIs to even get to “Hello world”
• Integrating and adapting custom HTML can be difficult and frustrating,
especially when working with designers
Rapi::Blog’s approach:
• Term chosen to give more emphasis than “theme”
• Is an ordinary, native HTML website/structure first and handles its own
business as much as possible
• Lives at the root of the site like the HTML wants
‣ This is the main blocker elsewhere
• Supports “opportunistic” templates
‣ But can still be static HTML, and just work
• The backend exposes APIs the scaffold can use, however it wants
“scaffolds”
Backend / Model
Template API
Basic Architecture:
‣ Public website structure
‣ Native HTML, CSS,
JavaScript, Images, etc
‣ HTML can include
template directives ‣ Database of ‘Posts’
‣ Taxonomies
‣ Relationships
‣ Business Logic
‣ Permissions
‣ Expose Blog-specific
template directives/methods
Scaffold
directory
Advanced
CRUD
Interfaces
RapidApp
Lets see it in action
• Start with a running site, go through the public-facing functionality -
browsing posts, pages, search, etc
• Go through the password-protected features - creating/editing posts,
comments, the new markdown editor, basic administration
• Browse the scaffold config and the templates and how they work
• Show how to create new sites with the rabl.pl create script
- demo -
How it works
• Rapi::Blog is a subclass of RapidApp::Builder
• Plack/PSGI app with very simple options:
my $app = Rapi::Blog->new({
site_path => $dir,
scaffold_path => "$dir/scaffold"
});
# Plack/PSGI app:
$app->to_app
Options
• site_path
• directory where the site lives - used for data persistence
• database files are created automatically for fresh sites
• scaffold_path
• the “document root” for the site
• serves literal/real paths from “/”
• defaults to ‘scaffold/’ inside the site_path directory
Scaffold
• Ordinary directory served at the root of the site
✴ img/foo.png served as /img/foo.png, home.html served as /home.html, and so on
• Merge/overlay with the Catalyst/RapidApp controller/module namespaces
automagically
• With no configuration it is a simple static website/folder
• Any of the files can function as templates (TT) and call directives and
accessors provided by the API
• scaffold.yml config file tells the backend how to use it
✴ such as which template to use to display posts
The scaffold tells the backend what
to do, not the other way around.
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
* which paths are static-only (no template directives) - mainly for performance
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
* paths which should not be served publicly (but can still be included from other templates)
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
* default file extension (lets ‘/foo’ work the same as ‘/foo.html’)
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
* page to serve for root (‘/’) request
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
* page to serve for HTTP/404 Not Found
scaffold.yml
static_paths : [ css/, js/, fonts/, img/ ]
private_paths : [ private/, scaffold.yml ]
default_ext : html
landing_page : recent_posts
not_found : private/404.html
view_wrappers:
- { path: post/, type: include, wrapper: private/post.html }
* special URL dispatch template wrappers to expose “Posts” …
scaffold.yml
view_wrappers:
- {
path: post/,
type: include,
wrapper: private/post.html
}
scaffold.yml
view_wrappers:
- {
path: post/,
type: include,
wrapper: private/post.html
}
Use this template (as a wrapper)
scaffold.yml
view_wrappers:
- {
path: post/,
type: include,
wrapper: private/post.html
}
Use this template (as a wrapper)
for requests starting with this
scaffold.yml
view_wrappers:
- {
path: post/,
type: include,
wrapper: private/post.html
}
Use this template (as a wrapper)
for requests starting with this
e.g. this is how /post/some-name.md renders ‘some-name.md’ from the database
Showing the demo code
• Browse the site dir
• Browse the scaffold files
• Show the scaffold.yml
• Show the app.psgi
Creating a new site is easy
rabl.pl create path/to/my-cool-blog
Easy setup with Docker
docker pull rapi/psgi
mkdir my-cool-blog
docker create -it 
--name=my-cool-blog --hostname=my-cool-blog 
-p 5001:5000 
-v $(pwd)/my-cool-blog:/opt/app 
rapi/psgi
docker start my-cool-blog
docker exec -it my-cool-blog bash
# run in the shell of the Docker container:
rabl.pl create /opt/app
app-restart && exit
Planned TBD Features
• Support multiple content formats
‣ Internals already support multiple formats and post-processors
• Expand Post database model + expose easier access to customize
• Add more prefabbed scaffolds with fancier features
• Better user auth features
‣ login via 3rd-party, self-signup w/ captcha, password reset, etc
• RSS feeds
Henry Van Styn
<vanstyn@cpan.org>
The Perl Conference 2017
June 20, Washington, DC
Questions?
@vanstyn
www.rapidapp.info
rapi.io/blog
irc.perl.org - #rapidapp
slides: rapi.io/tpc2017

More Related Content

What's hot

The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
SPTechCon
 

What's hot (20)

Web Components v1
Web Components v1Web Components v1
Web Components v1
 
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
2/15/2012 - Wrapping Your Head Around the SharePoint Beast2/15/2012 - Wrapping Your Head Around the SharePoint Beast
2/15/2012 - Wrapping Your Head Around the SharePoint Beast
 
Modern development paradigms
Modern development paradigmsModern development paradigms
Modern development paradigms
 
HTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile appsHTML5 & CSS3 refresher for mobile apps
HTML5 & CSS3 refresher for mobile apps
 
Getting Started with Rails
Getting Started with RailsGetting Started with Rails
Getting Started with Rails
 
SPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have knownSPSDenver - SharePoint & jQuery - What I wish I would have known
SPSDenver - SharePoint & jQuery - What I wish I would have known
 
SharePoint Saturday St. Louis - SharePoint & jQuery
SharePoint Saturday St. Louis - SharePoint & jQuerySharePoint Saturday St. Louis - SharePoint & jQuery
SharePoint Saturday St. Louis - SharePoint & jQuery
 
tTecniche di sviluppo mobile per share point 2013 e office 365
tTecniche di sviluppo mobile per share point 2013 e office 365 tTecniche di sviluppo mobile per share point 2013 e office 365
tTecniche di sviluppo mobile per share point 2013 e office 365
 
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
The Magic Revealed: Four Real-World Examples of Using the Client Object Model...
 
Building a spa_in_30min
Building a spa_in_30minBuilding a spa_in_30min
Building a spa_in_30min
 
Angular or Backbone: Go Mobile!
Angular or Backbone: Go Mobile!Angular or Backbone: Go Mobile!
Angular or Backbone: Go Mobile!
 
Stencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrivedStencil the time for vanilla web components has arrived
Stencil the time for vanilla web components has arrived
 
Twig
TwigTwig
Twig
 
Bringing HTML5 alive in SharePoint
Bringing HTML5 alive in SharePointBringing HTML5 alive in SharePoint
Bringing HTML5 alive in SharePoint
 
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slidesKeep Your Code Organized! WordCamp Montreal 2013 Presentation slides
Keep Your Code Organized! WordCamp Montreal 2013 Presentation slides
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom Development
 
Java EE revisits design patterns
Java EE revisits design patterns Java EE revisits design patterns
Java EE revisits design patterns
 
Show Some Spine!
Show Some Spine!Show Some Spine!
Show Some Spine!
 
SharePoint & jQuery Guide - SPSTC 5/18/2013
SharePoint & jQuery Guide - SPSTC 5/18/2013 SharePoint & jQuery Guide - SPSTC 5/18/2013
SharePoint & jQuery Guide - SPSTC 5/18/2013
 
Next Generation Spring MVC with Spring Roo
Next Generation Spring MVC with Spring RooNext Generation Spring MVC with Spring Roo
Next Generation Spring MVC with Spring Roo
 

Similar to Rapi::Blog talk - TPC 2017

Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
Lauren Roth
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
Gavin Roy
 
Pluggable patterns
Pluggable patternsPluggable patterns
Pluggable patterns
Corey Oordt
 
Open Source Content Management Systems
Open Source Content Management SystemsOpen Source Content Management Systems
Open Source Content Management Systems
Matthew Turland
 
A Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbA Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rb
SmartLogic
 

Similar to Rapi::Blog talk - TPC 2017 (20)

Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8Top 8 Improvements in Drupal 8
Top 8 Improvements in Drupal 8
 
Knolx session
Knolx sessionKnolx session
Knolx session
 
Everything You Need to Know About the Top Changes in Drupal 8
Everything You Need to Know About the Top Changes in Drupal 8Everything You Need to Know About the Top Changes in Drupal 8
Everything You Need to Know About the Top Changes in Drupal 8
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
 
WordPress Theming 101
WordPress Theming 101WordPress Theming 101
WordPress Theming 101
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
SFScon 2020 - Nikola Milisavljevic - BASE - Python REST API framework
SFScon 2020 - Nikola Milisavljevic - BASE - Python REST API frameworkSFScon 2020 - Nikola Milisavljevic - BASE - Python REST API framework
SFScon 2020 - Nikola Milisavljevic - BASE - Python REST API framework
 
Pluggable patterns
Pluggable patternsPluggable patterns
Pluggable patterns
 
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2Writing a WordPress Theme - HighEdWeb 2013 #WRK2
Writing a WordPress Theme - HighEdWeb 2013 #WRK2
 
Lightweight web frameworks
Lightweight web frameworksLightweight web frameworks
Lightweight web frameworks
 
Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011Drupal Theme Development - DrupalCon Chicago 2011
Drupal Theme Development - DrupalCon Chicago 2011
 
Open Source Content Management Systems
Open Source Content Management SystemsOpen Source Content Management Systems
Open Source Content Management Systems
 
2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides2.28.17 Introducing DSpace 7 Webinar Slides
2.28.17 Introducing DSpace 7 Webinar Slides
 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
 
A Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbA Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rb
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017The Way to Theme Enlightenment 2017
The Way to Theme Enlightenment 2017
 
Implementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing CompanyImplementing a Symfony Based CMS in a Publishing Company
Implementing a Symfony Based CMS in a Publishing Company
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 

Recently uploaded (20)

Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

Rapi::Blog talk - TPC 2017

  • 1. Henry Van Styn <vanstyn@cpan.org> The Perl Conference 2017 June 20, Washington, DC www.rapidapp.info rapi.io/blog irc.perl.org - #rapidapp Rapi::Blogmaximalist control, minimalist effort @vanstyn slides: rapi.io/tpc2017
  • 2.
  • 3. About me • Henry Van Styn (@vanstyn) • Owner of IntelliTree Solutions, perl shop and consultancy • Author/maintainer of RapidApp • Catalyst and DBIx::Class contributor • Given talks/demos of RapidApp for the past several years at The Perl Conference
  • 4. • This year I wanted to give a RapidApp demo of a bigger, real-world app that’s real-world useful • Married this with solving another of my long-time unmet needs: A real, modern perl blog platform…
  • 5. Why another blog platform? • Many reasons, a better mousetrap… • RapidApp is already very well-suited to the problem domain Biggest reason: Fresh take on front-end APIs (i.e. “themes”)
  • 6. The problem with “themes” • The word itself implies restrictiveness ‣ changing the appearance of something that is already defined • Inventing concepts of “pages” and “sections” and “blocks” and layouts and on and on and on that you have to adhere to • URL end-points are predetermined, rendered HTML assembled in domain- specific manner • Have to learn platform-specific APIs to even get to “Hello world” • Integrating and adapting custom HTML can be difficult and frustrating, especially when working with designers
  • 7. Rapi::Blog’s approach: • Term chosen to give more emphasis than “theme” • Is an ordinary, native HTML website/structure first and handles its own business as much as possible • Lives at the root of the site like the HTML wants ‣ This is the main blocker elsewhere • Supports “opportunistic” templates ‣ But can still be static HTML, and just work • The backend exposes APIs the scaffold can use, however it wants “scaffolds”
  • 8. Backend / Model Template API Basic Architecture: ‣ Public website structure ‣ Native HTML, CSS, JavaScript, Images, etc ‣ HTML can include template directives ‣ Database of ‘Posts’ ‣ Taxonomies ‣ Relationships ‣ Business Logic ‣ Permissions ‣ Expose Blog-specific template directives/methods Scaffold directory Advanced CRUD Interfaces RapidApp
  • 9. Lets see it in action • Start with a running site, go through the public-facing functionality - browsing posts, pages, search, etc • Go through the password-protected features - creating/editing posts, comments, the new markdown editor, basic administration • Browse the scaffold config and the templates and how they work • Show how to create new sites with the rabl.pl create script - demo -
  • 10. How it works • Rapi::Blog is a subclass of RapidApp::Builder • Plack/PSGI app with very simple options: my $app = Rapi::Blog->new({ site_path => $dir, scaffold_path => "$dir/scaffold" }); # Plack/PSGI app: $app->to_app
  • 11. Options • site_path • directory where the site lives - used for data persistence • database files are created automatically for fresh sites • scaffold_path • the “document root” for the site • serves literal/real paths from “/” • defaults to ‘scaffold/’ inside the site_path directory
  • 12. Scaffold • Ordinary directory served at the root of the site ✴ img/foo.png served as /img/foo.png, home.html served as /home.html, and so on • Merge/overlay with the Catalyst/RapidApp controller/module namespaces automagically • With no configuration it is a simple static website/folder • Any of the files can function as templates (TT) and call directives and accessors provided by the API • scaffold.yml config file tells the backend how to use it ✴ such as which template to use to display posts
  • 13. The scaffold tells the backend what to do, not the other way around.
  • 14. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html }
  • 15. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html } * which paths are static-only (no template directives) - mainly for performance
  • 16. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html } * paths which should not be served publicly (but can still be included from other templates)
  • 17. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html } * default file extension (lets ‘/foo’ work the same as ‘/foo.html’)
  • 18. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html } * page to serve for root (‘/’) request
  • 19. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html } * page to serve for HTTP/404 Not Found
  • 20. scaffold.yml static_paths : [ css/, js/, fonts/, img/ ] private_paths : [ private/, scaffold.yml ] default_ext : html landing_page : recent_posts not_found : private/404.html view_wrappers: - { path: post/, type: include, wrapper: private/post.html } * special URL dispatch template wrappers to expose “Posts” …
  • 21. scaffold.yml view_wrappers: - { path: post/, type: include, wrapper: private/post.html }
  • 22. scaffold.yml view_wrappers: - { path: post/, type: include, wrapper: private/post.html } Use this template (as a wrapper)
  • 23. scaffold.yml view_wrappers: - { path: post/, type: include, wrapper: private/post.html } Use this template (as a wrapper) for requests starting with this
  • 24. scaffold.yml view_wrappers: - { path: post/, type: include, wrapper: private/post.html } Use this template (as a wrapper) for requests starting with this e.g. this is how /post/some-name.md renders ‘some-name.md’ from the database
  • 25. Showing the demo code • Browse the site dir • Browse the scaffold files • Show the scaffold.yml • Show the app.psgi
  • 26. Creating a new site is easy rabl.pl create path/to/my-cool-blog
  • 27. Easy setup with Docker docker pull rapi/psgi mkdir my-cool-blog docker create -it --name=my-cool-blog --hostname=my-cool-blog -p 5001:5000 -v $(pwd)/my-cool-blog:/opt/app rapi/psgi docker start my-cool-blog docker exec -it my-cool-blog bash # run in the shell of the Docker container: rabl.pl create /opt/app app-restart && exit
  • 28. Planned TBD Features • Support multiple content formats ‣ Internals already support multiple formats and post-processors • Expand Post database model + expose easier access to customize • Add more prefabbed scaffolds with fancier features • Better user auth features ‣ login via 3rd-party, self-signup w/ captcha, password reset, etc • RSS feeds
  • 29. Henry Van Styn <vanstyn@cpan.org> The Perl Conference 2017 June 20, Washington, DC Questions? @vanstyn www.rapidapp.info rapi.io/blog irc.perl.org - #rapidapp slides: rapi.io/tpc2017

Editor's Notes

  1. Going to talk about the open-source, RapidApp web framework Which has been an in-house platform that we’ve been developing internally for 5 years. Just started open-sourcing within the past year. which is an extension to Catalyst that focuses on building database-driven apps faster than ever.
  2. Going to talk about the open-source, RapidApp web framework Which has been an in-house platform that we’ve been developing internally for 5 years. Just started open-sourcing within the past year. which is an extension to Catalyst that focuses on building database-driven apps faster than ever.