What is one of the central ideas of Jaroa?
The frontend never directly touches the WordPress database.
That’s one of the central ideas of Jaroa.
2. What have we built so far and what is the current architecture status?
We have built Quite a lot, actually.
First: the frontend exists – let’s take a look at the app directory (which will change over time)
We have:
frontend/
├── app/
├── config/
├── views/
├── public/
└── composer.json
Now, go inside the “app” directory, and the important application pieces are:
app/
├── Api/
├── Controllers/
├── Routing/
├── Services/
├── Application.php
└── View.php
That’s already beginning to look like a proper application architecture.
3. The front door: public/index.php
This is where a browser request enters Jaroa.
Very simply:
Browser
↓
public/index.php
↓
Application
It loads Composer, loads configuration, creates the application and starts it.
So index.php is basically:
“Welcome! Let me wake up Jaroa.”
4. Application.php is the conductor
Application.php brings the important pieces together.
It creates:
ApiClient
PostService
AppService
Router
Controllers
and registers routes.
For example:
/
goes to:
HomeController
and:
/articles/{slug}
goes to:
ArticleController
So Application is currently saying:
“When somebody knocks on this door, send them to this person.”
5. Router
Our Router understands URLs.
For example:
/articles/my-post
becomes:
slug = my-post
The Router doesn’t fetch the article.
It doesn’t know anything about WordPress.
It simply says:
“This URL belongs to ArticleController.”
That’s good separation.
6. Controllers
We currently have:
HomeController
ArticleController
Think of controllers as waiters.
The HomeController says:
“Someone wants the homepage. I’ll ask for the latest posts and applications.”
The ArticleController says:
“Someone wants this particular article. I’ll ask for it.”
They shouldn’t know how WordPress stores the data.
7. Services
We have:
PostService
AppService
These are the people who know what information we need.
For example:
PostService
↓
latest posts
↓
find article
↓
search posts
The controller doesn’t need to know the API URL.
It simply says:
"PostService, please give me this article."
That’s a very useful separation.
8. ApiClient
Then we have:
ApiClient
This is the actual messenger.
It talks to:
https://backend.ddev.site/wp-json/fullstack/v1
and receives JSON.
So our chain is:
Controller
↓
Service
↓
ApiClient
↓
HTTPS
↓
WordPress API
The frontend never directly touches the WordPress database.
That’s one of the central ideas of Jaroa.