tCMS2 : Why? ======== * Disintermediation from Aggregators * A platform for building my business (and clients) Note: You may be asking yourself why anyone would write a CMS in 2020. Well, I looked around and nothing really did what I wanted save for some closed-source walled gardens. And none of those did everything. So, I decided to do all of it. All of what? Well, I am an ambitious chap, as you will come to realize. Go over the parallells between disney+ and the death of the record labels Note that as a little guy contractor webmaster you want your clients' sites to actually enable them to succeed Note that all SAAS products I could build need these features & website anyways
tCMS2 : How? ============= * Working with starman (powerword: getppid) and mod_proxy * If you aren't using XSlate yet, you should * Getting my mojo working (just the minimum please!) - Mojo::File * Handling Mime Types with Plack::Mime * The unreasonable effectiveness of a bogus data model * Theming and layouts Note: After looking into Dancer, Mojo and the PSGI spec itself, it seemed like much of the sugar they provided didn't save me much code or time. However, there were key parts which were clutch, which I'll go over for y'all.
Starman & PSGI: Care and feeding of your prefork webserver * Be sure to specify `-M$MODULE` on deps to save on startup time when in production * use `getppid()` to get the parent PID to `kill -HUP` for reloads of things like configuration grabbed during BEGIN * Don't forget to `Encode::encode_utf8()` response bodies if you use a UTF8 doctype declaration Note: I can think of a certain web application near and dear to many of our hearts that could be improved by adoption of such. I have not yet tuned the max-requests per worker, nor max workers to get a general feel for what you can get away with. This is "coming soon" (see issue #94 on the tracker) Show the makefile and so forth here
XSlate Simplified PSGI renderer

                    sub _render ($template, $vars, @headers) {

                        my $processor = Text::Xslate->new(
                            path   => 'www/templates',
                            header => ['header.tx'],
                            footer => ['footer.tx'],
                        );

                        my $h = join("\n",@headers);

                        my $body = $processor->render($template,$vars);
                        return [$vars->{code}, [$h], [encode_utf8($body)]];
                    }
                
template.tx (tx cause I'm a TEXAN yee haw)

                    <: $title :>
                
Note: The $vars here are just a hashref, keys become variable names in the template. It works a lot like PHP in practice with the default syntax, and is actually fast as a templater unlike Template Toolkit. It even has a compatibility mode for Template Toolkit templates (TTerse)
How templates actually look in practice -- modular body.tx

                    : include common_thing.tx;
                    : inculde other_thing.tx;
                    ...
                
Filtering

                    
                    <: $var_with_entities | mark_raw :>
                
Note: Show post.tx, mbengine.tx, and then one of the post form templates themselves, which also include. This all works fast thanks to the compiled virtual machine model (think LLVM).
Mojo Magic Mimesis - Mojo::File & Plack::Mime

                    # Getting file extensions properly is notoriously difficult
                    my $mf = Mojo::File->new($path);
                    my $ext = '.'.$mf->extname();
                    # So is translating extensions into mimetypes
                    my $mimetype = Plack::MIME->mime_type($ext) if $ext;
                    ...
                
Note: A lot of times with mod_proxy type setups, you can passthrough to files on disk. I wanted to be able to stream content in the future, so having more tight-grained control may be the answer here. It certainly makes developing without a webserver and deployment simpler in any case (no need to define a docroot).
Trog::Data::DUMMY ================= don't bother with the details - Started with just a hashref - Ended up with a JSON Blob - Generalized this into blob-per-post for FlatFile - Made fast with good ol' fashioned indexing in sqlite Note: Thought about IO::AIO at first. Shoulda reached for the god algorithm first. If not, the plan is to use elasticsearch, but otherwise there's a pure JS lucene engine I can apply to the flat file model. Show off the data model modules at this point
Simple themes and all the standard web layouts * Custom Routing Available * Overrides for (almost) all stock components/styles possible Note: Show themes/teodesian.net/Routes.pm Go over the templates implementing the page layout and how it does holy grail, floating header/footer and is responsive
tCMS2 : What's Next? ============== * Presentation data - reveal.js is pretty amazing * Elasticsearch, Git data model * Data model granularity per data type * Multiple auth backends * Monetization features (unlisted, paywall posts) * Threads & Commenting * Scheduled Streaming Video and Audio
Presentations are easy with reveal.js, all I need is to store each section, and some meta

                        <div class="reveal">
                        <div class="slides">
                        <section
                            data-markdown
                            data-background-image="giver.jpg"
                            data-separator-notes="^Note:">
                            CONTENT!!!
                            ==========
                            * BULLET POINTS!!!
                            * OMG
                            Note:
                            Press "S" key for speakers notes
                        </section>
                        </div>
                        </div>
                    
Note: There's a tad bit more to it than this, but nothing that can't be templated. The primary complication is building a multi-step interface for adding slides.
Data Models - Want to enable search on existing data models using lunr.js - If this isn't fast enough, use a "real" search engine - Have a git based data model to build a TMS - Granular data type choice based on content type (performance) - Seamless migration between types Note: One mega-pattern I've seen in the industry is that: a) Most problems are actually just document management b) We then try and use relational tech to manage documents, which is generally better done with search engines Using S3 for the flat file model also sounds fun
Auth Models & Engagement - Existing model bone simple sqlite session db - Want users from other sources (LDAP/Oauth) as consumers/commenters - Unlisted/Private and monetized posts needs fleshing out - Improve SEO measures Note: Go over main business models (SEO affiliate marketing, derp shipping, etc) and how it's about building authority in search engines Building engagement is part of that Purpose is to build an audience / mailing list which has highest advert ROI I want to make doing all this easy
Streaming A/V & Scheduled posts - Scheduled posts are public, but private until doomsday - PSGI streaming functionality is straightforward (return callback instead of data) - OBS integration the actual "hard part" Note: Go over how public/private/unlisted works, how we might make this work Show that section of the PSGI spec, should be EZ to modify _serve to stream content OBS work essentially would be to talk to tCMS upload backends
Maximum SELLOUT ========================== * Github (with sponsorship!) - https://github.com/Troglodyne-Internet-Widgets/tCMS * troglodyne.net: https://www.paypal.com/paypalme/troglodyne Note: Subscribe to my onlyfans, lol