Skip to content
← Back to portfolio

Project case study · Web system

CYexpat

A Cyprus relocation and tax platform built with static-first Astro on Cloudflare. It includes React tax tools, PDF guides delivered by email, and an Anthropic-powered content pipeline.

AstroTypeScriptCloudflare WorkersReactTailwind CSSMDXAnthropic SDKPlaywrightVitest
CYexpat

The idea

CYexpat is a Cyprus relocation and tax-advisory platform. Its localized service pages cover Non-Dom status, Yellow Slip applications, company incorporation, VAT/TIN registration, accounting, and relocation coordination. The site also has an article collection and dedicated tax tools.

I wanted visitors to be able to act on their research. They can use a Cyprus-specific tool, receive a guide by email, or submit a consultation request after reading the content. Each option has its own page and API flow instead of ending at a static call to action.

The build

The current build is static-first. Astro generates the localized pages and content at build time, while React islands hydrate the three interactive tools in the browser. The site uses Astro’s Cloudflare adapter with static output. API routes handle consultation registration and lead-magnet delivery.

The repository began as a Next.js build in May 2023. It was dormant from late 2023 into early 2026, then I rebuilt it with Astro 6 and Cloudflare in March 2026. Its 198 commits span both the original 2023 build and the 2026 rebuild, with a long gap between them.

Key features

Three interactive tax tools

A personal tax calendar, a company tax calendar, and a tax calculator are exposed as separate localized routes. The calendar islands filter Cyprus deadline data by profile, while the calculator computes annual and monthly take-home pay. Each tool pairs its interactive React surface with a branded PDF guide behind an email-capture flow.

The lead-magnet endpoint resolves the PDF, subject, and copy from the selected tool and locale. It validates the email with Zod, then uses Resend to deliver the guide. Visitors can get a planning document before deciding whether to talk to the team.

Consultation flow and rate limiting

The consultation and PDF flows are deliberately separate. Consultation requests use server-side schema validation, require a Cloudflare Turnstile token, verify it against Cloudflare’s site-verification endpoint, and send the structured request through Resend.

PDF submissions validate the email and optional source/locale values, then use a Cloudflare KV counter keyed by client IP. The implementation allows three lead-magnet requests in a one-hour window before it returns a rate-limit response. It can also send an internal lead notification with the requested PDF. KV handles rate limiting here, not application state.

Content in three languages

Service pages, tools, and article content are available in English, Spanish, and German. The same lead-magnet resolver selects localized PDF URLs, subjects, and email copy where variants exist, with a defined fallback for the non-dom guide.

Build-time AI with a quality gate

The project also ships a real AI-assisted content workflow. Typed JSON briefs define the slug, keyword, outline, data points, internal links, and FAQs; a TypeScript generator uses the Anthropic SDK with Claude Opus 4.6 to generate the English MDX body, then translates it into German and Spanish and serializes the frontmatter and FAQ data.

A separate quality gate checks the required frontmatter, enforces a 1,200-word minimum and at least five internal links, and looks for FAQ data and placeholder text before running the Astro build. The AI runs at build time inside a publishing workflow with explicit checks. The visitor-facing site does not contain a runtime chatbot.

Architecture

Frontend: Astro 6 with static output, Tailwind CSS, MDX content, and React 19 islands for the interactive tools.

Infrastructure: The Cloudflare Workers adapter serves the static-first site and dynamic API routes. It has nodejs_compat enabled and custom-domain routes for cyexpat.com and www.cyexpat.com.

Integrations: Resend delivers email, Cloudflare Turnstile protects the consultation form, and PostHog initializes only after analytics consent.

Testing: Playwright provides end-to-end tests alongside Vitest unit tests, including dedicated coverage for the lead-magnet selection logic.

Have a project in mind?

Tell me what you're working on and where you need help.