docs/02-architecture/02-fronts-architecture.md
Rendering a front requires fetching a lot of information from multiple sources (CAPI, Fronts config, Fronts collections). In order to avoid doing this gruelling work inline when a user request is received, all data necessary to render a front is prefetched and aggregated in a single location (S3).
In a nutshell:
It is not a user facing service, it processes events published to queues. There are 2 queues:
The cron job is very important since content for a front can be coming from CAPI and change without any update from the Fronts tool.
The level of priority of a front will impact how often the cron job would request its update:
In reaction to a new event published to the queues described above, Facia-press will:
s3://facia-tool-store/STAGE/frontsapi/config/config.json in the CMS Fronts account. This file is edited using the Configuration Tool. Ex: Editorial Fronts Configuration ToolExample of a front config:
...
"uk/business": {
"collections": [
"uk/business/regular-stories",
"uk/business/feature-stories",
"12554364-5a48-4e1a-a931-4dbcd144a12a",
"98257c5b-f7af-4238-994e-edfb17e3b16e",
"7aa73028-4e76-48d7-a44e-b62a15d36a65",
"uk/business/most-viewed/regular-stories",
"b5058768-e4a8-4e37-a61e-5f8e4df7f8fc"
],
"webTitle": "Economy",
"title": "Latest financial, market & economic news and analysis | Business",
"description": "Latest financial, market & economic news and analysis from The Guardian"
}
...
In the same file, here is an example of one collection config
"12554364-5a48-4e1a-a931-4dbcd144a12a": {
"displayName": "multimedia",
"type": "fixed/small/slow-I"
}
Note:
s3://facia-tool-store/STAGE/frontsapi/collection/COLLECTION/ID/collection.json in the CMS Fronts account. This file is edited using the Fronts ToolEach collection will contain the id and metadata for all their running stories that have been curated by editors using the Fronts tool.
For each story, Facia-Press also fetches content details via CAPI.
A collection can contain curated content (picked by editors using the Fronts tools) but can also be filled with stories coming from CAPI. This can be configured using the Fronts tools.
A treat is a link that can be shown on the website in the bottom left corner of a collection container.
This is an additional request to CAPI to fetch SEO and other metadata for the front page.
s3://aws-frontend-store/STAGE/frontsapi/pressed/live/FRONTS/fapi/pressed.v2.json in Frontend account)Note:
Two versions of a fronts data are being pressed: Live and Draft
As mentioned above, when Facia receives a request for a front, it:
fetches the "pressed" data from S3 (s3://aws-frontend-store/STAGE/frontsapi/pressed/live/FRONTS/fapi/pressed.v2.json in Frontend account)
renders the front.
Each front collection would be rendered into a container. A container is always full-width.
The collection type (ex: fixed/medium/slow-VI) will decide the type and layout of the container. See here and here
Each container is composed of slices (aka "rows"). Each Slice definition specifies columns info and css classname.
Each row contains cards.
A card displays the information of one story/content.
Here are the definitions of a few words and expressions related to fronts:
Snap: A way to include arbitrary content into a collection (rather than a story). A snap can be a link (often used to show an interactive on the front) or dynamic content (latest story for given tag).
Thrasher: A type of container that contains a single full-width element.
Dynamo:
A type of container often used to highlight a huge story. It's better known in the codebase as the dynamic/package collection type.
Groups: A way to further tweak the layout of a collection. Dynamic collections can have multiple groups (standard/snaps or huge/veryBig/big/standard). Depending on the group a story/content is in, the layout of the container will be slightly altered.