<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mykhailo Levytskyi</title>
    <description>The latest articles on DEV Community by Mykhailo Levytskyi (@mykhailo_levytskyi).</description>
    <link>https://dev.to/mykhailo_levytskyi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4127644%2F2d861f23-18e9-4602-9c29-09d0f8276eec.png</url>
      <title>DEV Community: Mykhailo Levytskyi</title>
      <link>https://dev.to/mykhailo_levytskyi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mykhailo_levytskyi"/>
    <language>en</language>
    <item>
      <title>Building PHP Ukraine with Laravel and PostgreSQL</title>
      <dc:creator>Mykhailo Levytskyi</dc:creator>
      <pubDate>Wed, 16 Sep 2026 09:08:16 +0000</pubDate>
      <link>https://dev.to/mykhailo_levytskyi/building-php-ukraine-with-laravel-postgresql-and-a-lot-of-small-decisions-347g</link>
      <guid>https://dev.to/mykhailo_levytskyi/building-php-ukraine-with-laravel-postgresql-and-a-lot-of-small-decisions-347g</guid>
      <description>&lt;p&gt;A couple of weeks ago I started building &lt;a href="https://phpukraine.com/" rel="noopener noreferrer"&gt;PHP Ukraine&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The initial idea was pretty simple.&lt;/p&gt;

&lt;p&gt;I wanted one place where PHP developers in Ukraine could find jobs, companies, interview questions, documentation and useful technical content.&lt;/p&gt;

&lt;p&gt;Then, as usual, the project started growing.&lt;/p&gt;

&lt;p&gt;I added job aggregation from several sources, classification, deduplication, salary normalization, search, employer tools, analytics, content processing and a few other things.&lt;/p&gt;

&lt;p&gt;The current stack is PHP 8.4, Laravel 13, PostgreSQL 17, Livewire, Filament and Docker with FrankenPHP.&lt;/p&gt;

&lt;p&gt;I want to show a few parts of the project that were interesting to build, including some decisions that changed while I was working on it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project structure
&lt;/h2&gt;

&lt;p&gt;I did not want everything to slowly end up inside one huge app/ folder.&lt;/p&gt;

&lt;p&gt;So most of the business code lives under src/.&lt;/p&gt;

&lt;p&gt;Right now there are separate contexts for Hiring, Content, ContentOps, Search, Analytics, Contact, Development and SEO.&lt;/p&gt;

&lt;p&gt;Most of them are split into Domain, Application and Infrastructure.&lt;/p&gt;

&lt;p&gt;Laravel still handles the framework side of things. Controllers, Livewire components, console commands, middleware and service providers stay in app/.&lt;/p&gt;

&lt;p&gt;Ports are connected to infrastructure implementations through service providers.&lt;/p&gt;

&lt;p&gt;I am not trying to turn the project into some kind of DDD showcase.&lt;/p&gt;

&lt;p&gt;I just wanted clear boundaries because I know how quickly a Laravel project can become a place where everything knows about everything.&lt;/p&gt;

&lt;p&gt;I also added architecture tests with Pest.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nf"&gt;arch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'domain layers stay framework-free'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="s1"&gt;'PhpUkraine\Hiring\Domain'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'PhpUkraine\ContentOps\Domain'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'PhpUkraine\Seo\Domain'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;not&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;toUse&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'Illuminate'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Livewire'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'App'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

&lt;span class="nf"&gt;arch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'the web layer never touches infrastructure directly'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="s1"&gt;'App\Http'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'App\Livewire'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;not&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;toUse&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
        &lt;span class="s1"&gt;'PhpUkraine\Hiring\Infrastructure'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="s1"&gt;'PhpUkraine\ContentOps\Infrastructure'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That way the architecture is not just something written in a markdown file. The tests actually complain if I break the boundaries.&lt;/p&gt;

&lt;h2&gt;
  
  
  Job aggregation
&lt;/h2&gt;

&lt;p&gt;The jobs section currently imports vacancies from Robota.ua, DOU and Djinni.&lt;/p&gt;

&lt;p&gt;Each source implements the same JobSource interface and returns normalized job objects. Robota.ua uses JSON API endpoints. DOU and Djinni are imported through RSS.&lt;/p&gt;

&lt;p&gt;Djinni is slightly different because the RSS feed does not contain enough information.&lt;/p&gt;

&lt;p&gt;For a new Djinni vacancy, the app can fetch the vacancy page and read the JobPosting JSON-LD to get things like employer, salary and expiration date.&lt;/p&gt;

&lt;p&gt;The sync process is roughly:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Fetch jobs from the source&lt;/li&gt;
&lt;li&gt;Ignore employers I do not want on the platform&lt;/li&gt;
&lt;li&gt;Ignore jobs that are clearly not PHP jobs&lt;/li&gt;
&lt;li&gt;Update an existing job if the source reference already exists&lt;/li&gt;
&lt;li&gt;Check whether the same job already exists from another source&lt;/li&gt;
&lt;li&gt;Fetch extra details if needed&lt;/li&gt;
&lt;li&gt;Create a new job&lt;/li&gt;
&lt;li&gt;Mark jobs that disappeared from the source as stale&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The main sync runs every hour. Deduplication, expiration, salary exchange rates and market snapshots run separately.&lt;/p&gt;

&lt;p&gt;I prefer this over one huge command that tries to do everything.&lt;/p&gt;

&lt;p&gt;It also makes it much easier to understand what failed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Classification without AI
&lt;/h2&gt;

&lt;p&gt;One thing I could have done was send every job through an LLM.&lt;/p&gt;

&lt;p&gt;I did not.&lt;/p&gt;

&lt;p&gt;The classifier is just rules.&lt;/p&gt;

&lt;p&gt;It tries to detect framework, seniority, city, work format, employment type, English level, salary and technology tags.&lt;/p&gt;

&lt;p&gt;For example, salary parsing understands things like:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;$3000-4000&lt;br&gt;
from $2500&lt;br&gt;
up to €4000&lt;br&gt;
80k UAH&lt;br&gt;
3k USD&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The original salary stays in its original currency, but I also normalize it to USD for filtering and sorting. Exchange rates come from the National Bank of Ukraine.&lt;/p&gt;

&lt;p&gt;For this particular task, normal rules are just easier.&lt;/p&gt;

&lt;p&gt;They are cheap, deterministic and easy to debug.&lt;/p&gt;

&lt;p&gt;AI is useful in other parts of the project, but I do not see a reason to use it where a parser does the job better.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deduplication across job boards
&lt;/h2&gt;

&lt;p&gt;The same job can appear on DOU, Djinni and another source at the same time.&lt;/p&gt;

&lt;p&gt;I did not want users to see the same vacancy three times.&lt;/p&gt;

&lt;p&gt;So jobs get a fingerprint based mainly on the company name and title.&lt;/p&gt;

&lt;p&gt;The simplified version looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$company&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PlainText&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;normalizeKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$companyName&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nv"&gt;$company&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;preg_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s1"&gt;'/\b(llc|ltd|inc|тов|фоп|group|company)\b/u'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nv"&gt;$company&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nv"&gt;$company&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$cleanTitle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;str_ireplace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;self&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;NOISE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$title&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nv"&gt;$cleanTitle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PlainText&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;normalizeKey&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$cleanTitle&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$company&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'|'&lt;/span&gt; &lt;span class="mf"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$cleanTitle&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stuff like (remote), urgent, legal company suffixes and similar noise is removed before comparison.&lt;/p&gt;

&lt;p&gt;If the same vacancy is found on another source, I keep one primary record and attach the additional source URLs to it.&lt;/p&gt;

&lt;p&gt;If the same board republishes the vacancy under a new ID, that is handled separately.&lt;/p&gt;

&lt;p&gt;This part was more annoying than I expected.&lt;/p&gt;

&lt;p&gt;Company names are messy. Job titles are messy. Every board formats things differently.&lt;/p&gt;

&lt;p&gt;But simple normalization already solves a surprising amount of it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Search
&lt;/h2&gt;

&lt;p&gt;I originally planned to use PostgreSQL full-text search.&lt;/p&gt;

&lt;p&gt;The database even has a generated tsvector column and a GIN index.&lt;/p&gt;

&lt;p&gt;And then I did not use it.&lt;/p&gt;

&lt;p&gt;The current search just runs normalized LOWER(...) LIKE conditions over a small set of columns.&lt;/p&gt;

&lt;p&gt;The main reason is Ukrainian content.&lt;/p&gt;

&lt;p&gt;PostgreSQL does not ship with a Ukrainian full-text dictionary, and for the current amount of data, simple search is fast enough and behaves exactly how I expect.&lt;/p&gt;

&lt;p&gt;So yes, I currently have a full-text search column and a GIN index sitting in the database while the actual search uses LIKE.&lt;/p&gt;

&lt;p&gt;And for now, that is completely fine.&lt;/p&gt;

&lt;p&gt;Search also supports a few simple operators.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;тип:вакансії Laravel&lt;br&gt;
"$3000+"&lt;br&gt;
"Senior PHP"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Salary conditions apply only to jobs, quoted phrases are kept together, and section filters can narrow the results.&lt;/p&gt;

&lt;p&gt;I will probably revisit search later when the dataset gets bigger.&lt;/p&gt;

&lt;p&gt;Right now I would rather keep it boring and predictable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tests
&lt;/h2&gt;

&lt;p&gt;The project has roughly 340 automated tests at the moment.&lt;/p&gt;

&lt;p&gt;There are unit tests, feature tests, Livewire tests and architecture tests.&lt;/p&gt;

&lt;p&gt;A lot of the tests cover things that are easy to break quietly.&lt;/p&gt;

&lt;p&gt;Salary parsing, job classification, source imports, deduplication, authentication, employer and developer cabinets, content APIs and HTTP pages.&lt;/p&gt;

&lt;p&gt;PHPStan and Larastan run at level 8.&lt;/p&gt;

&lt;p&gt;Before deployment, I run Pest and PHPStan locally.&lt;/p&gt;

&lt;p&gt;If either fails, deployment stops.&lt;/p&gt;

&lt;p&gt;There is no GitHub Actions setup at the moment.&lt;/p&gt;

&lt;p&gt;Deployment is intentionally simple.&lt;/p&gt;

&lt;p&gt;The code is pushed to a bare Git repository on the server. A post-receive hook checks it out, and Docker Compose rebuilds the application. Migrations run when the container starts.&lt;/p&gt;

&lt;p&gt;It is not fancy, but it works.&lt;/p&gt;

&lt;p&gt;I can always make it more complicated later if there is a real reason.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production setup
&lt;/h2&gt;

&lt;p&gt;The application runs with FrankenPHP and PostgreSQL 17.&lt;/p&gt;

&lt;p&gt;There is a separate scheduler container for Laravel's scheduler. Static files are served with compression and long cache headers. Cloudflare sits in front of the server.&lt;/p&gt;

&lt;p&gt;Backups are also simple.&lt;/p&gt;

&lt;p&gt;A daily cron runs pg_dump, compresses the result and keeps 14 days of backups on the server.&lt;/p&gt;

&lt;p&gt;Again, nothing exciting.&lt;/p&gt;

&lt;p&gt;But I like having boring infrastructure that I understand.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI content processing
&lt;/h2&gt;

&lt;p&gt;There is one part where AI actually makes sense.&lt;/p&gt;

&lt;p&gt;The production server creates content tasks, but it does not call an LLM API directly.&lt;/p&gt;

&lt;p&gt;A local worker leases tasks through an API, runs Claude CLI, then sends the result back to the server.&lt;/p&gt;

&lt;p&gt;The lease is protected with database locking and expires after 30 minutes.&lt;/p&gt;

&lt;p&gt;Each task can be attempted a limited number of times.&lt;/p&gt;

&lt;p&gt;Returned HTML is sanitized before it is saved.&lt;/p&gt;

&lt;p&gt;I like this setup because the production server does not need model API keys and the AI-related work can stay outside the main application runtime.&lt;/p&gt;

&lt;p&gt;It is still experimental, but it works pretty well.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other things that appeared along the way
&lt;/h2&gt;

&lt;p&gt;The project started as a jobs platform, but now it also has salary statistics, market snapshots, SEO landing pages, first-party analytics, employer applications, documentation and interview questions.&lt;/p&gt;

&lt;p&gt;Employer applications use optimistic locking.&lt;/p&gt;

&lt;p&gt;If two updates try to modify the same application version, one of them fails instead of silently overwriting the other.&lt;/p&gt;

&lt;p&gt;Application history is stored separately as append-only events.&lt;/p&gt;

&lt;p&gt;There is also first-party analytics without a persistent tracking cookie.&lt;/p&gt;

&lt;p&gt;The visitor ID is derived from date, IP and user agent, so it rotates every day.&lt;/p&gt;

&lt;p&gt;I did not plan most of this when I started.&lt;/p&gt;

&lt;p&gt;It just grew naturally from the product.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current state
&lt;/h2&gt;

&lt;p&gt;The first commit was on September 2.&lt;/p&gt;

&lt;p&gt;At the time I collected these notes, the repository had around 400 commits.&lt;/p&gt;

&lt;p&gt;That is probably more about how I work than anything else.&lt;/p&gt;

&lt;p&gt;I prefer small commits and short feedback loops.&lt;/p&gt;

&lt;p&gt;There is still a lot I want to improve.&lt;/p&gt;

&lt;p&gt;Search will probably change again.&lt;/p&gt;

&lt;p&gt;The employer side is still evolving.&lt;/p&gt;

&lt;p&gt;The content tooling is still experimental.&lt;/p&gt;

&lt;p&gt;There are parts of the architecture I already know I will simplify.&lt;/p&gt;

&lt;p&gt;But the main thing works.&lt;/p&gt;

&lt;p&gt;And I am pretty happy with the direction so far.&lt;/p&gt;

&lt;p&gt;If you work with Laravel, job aggregation, search or similar data-heavy applications, I would be interested to hear how you would approach some of these parts.&lt;/p&gt;

&lt;p&gt;Live project:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://phpukraine.com" rel="noopener noreferrer"&gt;https://phpukraine.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>laravel</category>
      <category>postgres</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
