back home
thumbnail

Stack 2023 - review the old way

#Application requirements

Let's start by defining what an application usually needs so the idea can start and step into the real world. Not even going into the long-term project that grows.

  • API data endpoints
  • user sessions, authentication, and authorization
  • queues/background workers
  • application UI, usually SPA
  • homepage/application presentation page (for not logged users)
  • about page
  • blog posts
  • news
  • subscription managing
  • SEO, robots.txt, and sitemap.xml
  • other website-related pages and promotions like landing pages, mailings, etc
  • deployment (and rollback)
  • backups
  • database
  • persistent storage
  • in-memory caching (Redis etc.)
  • (sending) mails
  • servers/hosting
  • (local) development environment
  • staging environment
  • production environment
  • code versioning

#How have things been done till now, and what needs an upgrade in 2023

#servers, deployment, hosting, and hosted environments

I got away from self-hosted servers a while ago and let it all be managed by Laravel Forge, as it helped me remove most of the self-managed LAMP stack from the previous stack and also added some new ideas I wanted to implement. In the end, it is a fantastic tool that helped me grow to the next level as a freelancer, but with time, it has become (just) an automation of managing LAMP stack servers. Therefore, I am still promoting it as an excellent tool for beginners, freelancers, small project teams, and smaller projects. But I need more now.

Review of current/old flow:

Pros:

  • simple push to deploy
  • servers are managed by Forge
  • security auto-update services
  • adding (buying) servers thru the dashboard
  • letsencrypt automation
  • repository (branch) based deploy integration

Cons:

  • site setup overhead and missing auto-setup for some services (e.g., wrong Postgres port)
  • hard to edit/manage project-specific Nginx config and some other services
  • setting up multiple environments for the same project (stg, dev, ...)
  • no scaling / single server application limitation
  • risks of no proper backup or failover
  • no zero-downtime deploys
  • limitation to the shared database and redis services (be careful with redis db ids)
  • no resource management / buying a dedicated server upfront based on predictions
  • production includes services that are there just for the build time
  • semi-solution for tests and build process
  • no automatic solution for moving the application to another server
  • deploy the whole application no matter how small of a change needed

Conclusion: the whole stack needs to change

#users, sessions, authentication, authorization, API endpoints

I have been sticking with the Laravel framework ecosystem for managing backend stuff for the past couple of years. It guided me well into the topics and patterns I now understand are a must for every larger project. I liked the idea of Lumen, but I still used it as a monolith.

Review of current/old flow:

Pros:

  • great suggested patterns for growing as a developer on larger projects
  • solves most application topics (workers, router, validation, ...)
  • Test Driven Development of APIs
  • I know it inside out / source code is my primary documentation
  • fast-developing

Cons:

  • cookie-based sessions (used it because of less security overhead as the browser took care of storing it properly)
  • hard to target and handle needed performance improvements and monitoring in larger teams with lots of codebase and new features
  • monitoring of applications, database, queues, ...
  • low performance (not using proper approaches like octane etc.)

Conclusion: partial upgrades are needed, but sticking with the stack

#frontend framework, spa, blades, compiling assets, CSS framework, auth pages

I was switching my primary stack back when Laravel was version 5.6. When vue version 2 was the default language in the starter project, it seemed a natural next step from the jQuery world. I've tried angular, ember, and some other frameworks at the time, but vue felt the most natural way of doing things. For the CSS, there was bulma, bootstrap, and materializecss. SPA application was served thru url root html output from Laravel blades, and compiling was done thru Laravel mix. Everything is already bundled from the Laravel starting project.

Review of current/old flow:

Pros:

  • it all came out of the box, easy to start
  • known approaches
  • all in one project/stack / single repository
  • fast mockup using CSS frameworks

Cons:

  • mixing things from blades to vue is a mess
  • its hard to maintain/define the proper long-term structure of the app
  • vue SPA inbound to Laravel loading things
  • mixing Laravel rendering for some things and others in SPA is a mess
  • hard to customize or add additional functionalities with CSS frameworks
  • CSS frameworks usually require js logic out of the box

Conclusion: the whole stack needs to change

#webpage specific pages, blog, news, SEO

Using the same stack for web pages as I do for the applications is a nightmare. You can choose between having another stack, like WordPress, or developing new cms as part of your application. As I want to avoid ending up with multiple stacks just to make it look nice, I will focus on finding a better solution that will bring the website and application parts together.

Review of current/old flow:

Pros:

  • (none found)

Cons:

  • can solve (some) things by having a separate website-specific solution / new stack
  • can solve (some) things by developing or including package dependency features needed for websites
  • SEO / no proper html output for robots without javascript
  • dual development to make the experience between website and application as smooth as possible
  • maintenance of multiple systems
  • hard to onboard developers onto the project
  • ... (this can go on forever)

Conclusion: the whole stack needs to change

#local environment

Using docker-compose as part of the project, being project specific, was a go-to tool for some time. Note: I have tried using valet with local npm (nvm), database, etc., but did not like that my system is full of services with multiple versions, etc. Startup scripts started to fail with upgrades or needed changes. Even a bigger mess that took much more time with new machines etc.

Review of current/old flow:

Pros:

  • trust in the quick setup of the project environment
  • encapsulated services required for a project
  • good simulation and testing environment for production requirements

Cons:

  • copy-paste from one project to another / no proper boilerplate from which to initialize
  • manually editing hosts file for project-specific domains
  • wildcard subdomains manual setup
  • using a secure connection locally
  • performance issues with the local filesystem
  • running only a single instance / project at the time

Conclusion: some improvements wanted

#expectations for the new stack

  • independent parts / each part of the application can be quickly replaced with a better solution
  • best SEO practices
  • scalability
  • portability
  • result-oriented / quick start with the new app
  • long-term maintainability

Conclusion: let's do this shit

Till next time, stay sexy and hydrated.

Stack 2023 - going cheaper fail
Stack 2023 - going cheaper fail
A-Frame Cabin - review
A-Frame Cabin - review
Stack 2023 - kubernetes with Rancher
Stack 2023 - kubernetes with Rancher
Volkswagen T2 Camper Van - review
Volkswagen T2 Camper Van - review
Laracon EU Lisbon 2023
Laracon EU Lisbon 2023
Stack 2023 - review the old way
Stack 2023 - review the old way
Self calling resolve function with return type hint
Self calling resolve function with return type hint
harry-potter-express - Hogwarts™ Express
harry-potter-express - Hogwarts™ Express
Volkswagen T2 Camper Van - pending
Volkswagen T2 Camper Van - pending
Snowboarding again - on the slopes
Snowboarding again - on the slopes
Snowboarding again - a gift to me
Snowboarding again - a gift to me
PhpStorm UI 2023
PhpStorm UI 2023