In this post 6 sections
Hadath Cinema runs as its own Cloudflare Worker, named hadath-cinema, with its own D1 database. It is not part of the Worker that serves the Hadath events guide. This post sets out why I split them and what the split costs.
Key Takeaways
- Traffic, CPU, deploys and failures on the film site cannot reach the events guide, and the reverse is also true.
- The two products have different shapes: the events guide is mostly reads of researched data, while the film site takes writes from visitors.
- The cost is some duplicated code, two deploys and two admin surfaces.
- Public pages are cached at the edge for 60 seconds, so a new review reaches other visitors within a minute and the reviewer sees it at once.
- The film site sits on a subdomain,
cinema.hadath.live, which is a choice with its own SEO trade-off.
The reason: a blast radius
The events guide at hadath.live serves 32 country sites from one Worker. It is the product with a reputation to protect, because a wrong or missing page there is a wrong date for someone planning a trip.
A review site is different. It takes input from the public, which means comment floods, odd traffic spikes when a series trends, and the occasional bad deploy while the product is young. Putting that on the same Worker would have tied the two together. If a film page ever ran hot, an event page would feel it.
Separate Workers and separate databases mean a problem on one is a problem on one.
Why D1 for the data
The film site stores titles, people, ratings, reviews, comments and helpful votes. That is relational data with many small writes, which suits a SQL database better than the key-value store the events guide uses for its automatic event list. D1 gives migrations I can version, queries I can inspect and a single place to recompute every score.
Five numbered migrations build the schema, from the first tables to external reviews, platforms, ranking signals and people. Local development keeps its own database, so a test review never reaches production.
What runs on a schedule
A Cron Trigger runs every six hours. It recomputes every score, and it can refresh titles from the movie database when a key is set. Pages are automatic: insert a title and /review/movies/{slug} exists, with schema, a sitemap entry and a generated poster until a real one arrives.
Slugs are made from the title, and a collision adds the year and then a number. Anything not lower case, or with a trailing slash, redirects to the canonical address with a 301, so one page has one URL.
What the separation costs
I want to be plain about this, because "microservices" is easy to sell and has real costs here.
- Duplicated code. The header, footer and brand tokens exist in both projects. A change to the Hadath look means two edits.
- Two deploys and two admin surfaces. I can ship the film site without touching the events guide, which is the point, but it is also two things to remember.
- A subdomain. Putting the film site at
cinema.hadath.liverather than a folder on the main site is a trade-off. It keeps the Worker separate and the sitemaps clean, but search engines may not treat the two as one pool of authority. I made the call on operations, not on any proof that it ranks better, and I will watch how the site is indexed. The same reasoning, and the same uncertainty, is in one subdomain per country.
Would I do it again
Yes, for a product that takes writes from the public next to a product that must stay accurate. For a read-only site I would not split. The test is whether one of them can fail in a way the other cannot afford.
The abuse controls that make public writes safe are in reviews without accounts. The product itself is introduced in the launch post, and the whole build is in the case study.
Found this useful? Pass it on.