RAS GeoMetric: the problems I ran into building a plugin licensing platform
RAS GeoMetric is a platform for surveying and CAD plugins: licences, a file library, a Premium subscription, guides, a forum and a DWG/DXF viewer. In this post I'll cover what it's built with, which problems came up, and why each was solved the way it was.
Stack, and why
| Part | What | Why |
|---|---|---|
| Site | Next.js 16, React 19, TypeScript, next-intl | Server components, 4 languages: Uzbek (Latin and Cyrillic), Russian, English |
| API | Spring Boot 3.3, Java 21 | Solid for strict business logic (payments, licences, audit), and it's the stack I use at work |
| Sign-in | Keycloak + NextAuth | 2FA, Google sign-in, roles and sessions out of the box; no need to build them myself |
| Database | PostgreSQL 16 + Flyway | Versioned migrations; old ones are never edited |
| Files | SeaweedFS (S3) + ClamAV | Every uploaded file goes through an antivirus |
| Server | Oracle Cloud A1 VM (ARM) + Cloudflare tunnel | Enough power on the free tier, no inbound ports open |
The server didn't go smoothly, by the way: the setup script failed on its first run on a real Oracle VM.
I had forgotten the clamav-daemon package, and AppArmor wouldn't let ClamAV read its own config file.
None of that showed up on my own computer.
1. The tunnel dropped every time the computer went to sleep
At first the server ran on my computer and reached the internet through a Cloudflare quick tunnel. Whenever the computer slept or the internet dropped, the tunnel dropped too and came back with a new address. Every time, I had to change the Vercel variables and redeploy the site.
I switched to a permanent named tunnel: the hostnames never change, and it reconnects on its own. Later everything moved to an Oracle Cloud VM, and the tunnel stayed.
The reason is simple: not a single inbound port is open on the VM, because the server connects out to Cloudflare itself. Cloudflare takes care of HTTPS, caching and protection.
2. MinIO couldn't be installed
Problem. MinIO was the plan for file storage. But MinIO stopped publishing community binaries (the download URL
returns 410), and there was no Docker on my work computer.
Fix. SeaweedFS: it provides an S3 API and runs as a single binary.
Why it's a safe choice. The code talks to the standard S3 API. Moving to another S3 service wouldn't require any code changes.
3. Uploads and antivirus
Users upload files, so every file goes through ClamAV. Files are only served through signed URLs. The proxy allows reading and writing a single object, with no listing or deleting.
To prove an antivirus really works, you usually scan the EICAR test file. But Windows Defender kept catching it before ClamAV could. So I added my own harmless "canary" signature: on startup the script scans it to prove the antivirus works.
4. One rate limit shared by everyone
Problem. The site calls the API from inside the server (127.0.0.1). As a result, every visitor shared one
limit: a single busy user could block everyone else. On top of that, anyone calling the API directly could spoof
X-Forwarded-For and dodge the limit.
Fix. The site passes the visitor's real IP (Cloudflare's CF-Connecting-IP) along with a secret key. The API
only trusts that IP when the key is present. IPv6 addresses are counted per /64 network, otherwise one person
could rotate through endless addresses.
5. Google sign-in skipped 2FA
Problem. 2FA is mandatory for all staff. But in Keycloak's default flow, signing in with Google didn't ask for the one-time code.
Fix. A separate "post login" flow that runs after Google: if 2FA is set up, the code is required; if not, the step is skipped. Staff without 2FA are treated as regular users everywhere, and the admin panel shows a warning.
6. A new sign-in design nobody could see
I updated the design of the Keycloak sign-in page and deployed it, but the site still showed the old one.
There turned out to be two reasons. After a restart, Keycloak served a stale gzip copy of the files. And Cloudflare and browsers cache the file URL for 30 days, while that URL only changes when the Keycloak version itself does.
I made deploys clear the gzip cache and added a ?v=2 version number to the CSS/JS URLs. Deployed, and still the old
design: Cloudflare had already cached ?v=2 with the old content. Three minutes later a second commit went out with
?v=3, and only then did everything update. The rule now lives in the README: if a theme file changes, the version
number goes up.
7. The role was granted, but the API didn't notice for several minutes
Problem. The admin panel reads a user's sign-in history from Keycloak. Even after granting the right permission,
I kept getting 403 for several minutes. The cached token had been issued before the role was granted and didn't
know about it.
Fix. If the cached token is rejected, a fresh one is fetched and the request is retried once. If the fresh token is rejected too, an error comes back, so there's no endless loop. On 401/403 the request wasn't executed, so retrying is safe.
8. A mistyped computer code
A plugin licence is tied to a specific computer. Users type the computer code by hand and can get one character wrong. Then a key would be issued for a computer that doesn't exist.
Fix. The code is part of a SHA-256 hash of the computer's identifiers, encoded in Base32, and ends with a check character (Luhn mod 32), like a bank card number. A single wrong character fails the check, and swapped neighbouring characters are almost always caught too. Such a code gets no key.
9. Opening DWG files safely
DWG is a closed format that can't be read directly in a browser. The server converts it to DXF with LibreDWG. But parsing someone else's file is risky.
Fix. The converter runs inside a bubblewrap sandbox: no network, and only /usr (read-only) and the
request's folder are visible. It can't see any keys or the API process. If the sandbox doesn't work, DWG support is
switched off entirely. File size, time and concurrent requests are limited, and nothing is stored.
10. Deploys: git push only
On a push to main, GitHub Actions runs the tests first: unit tests and Testcontainers integration tests for the
API, TypeScript, ESLint and Playwright for the site. If everything's green, only the changed part is rebuilt on
the VM. A red test means no deploy, and the running version stays as it is.
The same tests catch small things too. For example, one block on the home page arrived late and pushed the cards down (CLS 0.128). I made an invisible copy hold its place until it arrives, and CLS dropped to 0.
Not done yet
- Online payments (Payme/Click/ATMOS), which need a registered legal entity. For now manual payment works: an order, admin confirmation, then an automatic licence and receipt.
- The C# plugin itself isn't written yet, but the licence check API is ready.
What I learned
Most of my lost time went into caching, not into anything complicated. Cloudflare, the browser, gzip inside Keycloak, a stale token: every time something "changed but didn't show up", the cause was one of them. Now the first thing I check is who might have cached the old version.
Second: everything worked on my own computer, and the real server found the setup bugs on its very first run. That's why git-push-only deploys with tests in CI are worth setting up as early as possible: a red test simply keeps a broken version off the server.