Vincent Ritter

← back to projects

Sublime Ads

A privacy focused ad management service for your apps, websites and others.

Sublime Ads is a platform to allow you to manage and serve your very own ads in your own apps, on your websites, or other services using a simple API, or a lightweight drop-in JS script. You are in complete control on what you want to show, and how.

Everything is in one place and is easy to manage, no need to write your own custom solution. On top, Sublime Ads is privacy conscious to you and your users. Only taps/clicks will be registered for served ads and nothing else (can also be disabled per ad). I also don't use any tracking for the web application and other things, just like the internet is supposed to be.

Launched early 2021 as an MVP product to satisfy my very own needs as a developer with multiple apps and sites.

Visit the website here.

Project posts JSON/RSS Feed...

12 hours of Sublime Ads dev between Friday night and now. My brain is fried 🤯. Setting the stage for next week. Now two days off.

Sublime Ads: Stat changes, bug fixes and new servers.

Hey there.

I've been busy the last few days to get a few needed things out the way for Sublime Ads, my ad management platform for apps, websites and other things. Here’s what’s new:

Stat filters are now saved

Your stats (the graphs) have settings for the day range and which view you have selected ("views" or "taps"). In the past that data was saved with the browser data in local storage. So when you used the same browser, it would have picked up which setting you have selected.

No more. Now these settings are saved across your device and are loaded automatically every time you make a change.

I thought this was nice and gives you a more consistent experience across devices.

This opens the door for a few more things I'd like to add at some stage... nothing like planning ahead.

Bug fixes

Ah yes, always there are bugs. Whilst there were a few I fixed, the most notable ones are image lazy loading related.

  • Fixes an issue with the profile image always trying to reload in a lazy way, on each navigation. Now I am just using a background image so you don't get this flash.
  • Ad images in a category create or edit screen didn't lazy load and looked blurry. This is now fixed.
  • Various other lazy loading tweaks across ads, like in the header area when viewing an ad.

New servers

This one took some time to get right, and yes there was some downtime... and I apologise if that has caused any troubles for you. Anyone using the Embed API was not affected by any downtime. However, I kept everything to a super minimum.

Migration is now fully complete and it allows me to sleep at night without problems. Namely I can easily create servers on the fly and scale where needed without headaches of managing this.

For anyone interested I am now using Cloud66 to manage the Sublime Ads servers. Another nice thing is that, in a way, these are now managed by Cloud66, including database backup strategies - which is a big win for the platform!

It is a little bit expensive but the peace of mind is comforting and worth it in my eyes.

If you find anything that isn't working anymore, let me know.

With the above changes I also took time to upgrade the version of Ruby to keep up with the security updates.

Anyway, this is it. Happy with the way it came together this week, and look forward adding a few more things in the coming week.

✌️❤️

Migrated Sublime Ads to a new server infrastructure using Cloud66. Took 6 hours to deal with encryption issues, but all working well now. Don’t think there was any downtime (most ads are served via the edge locations).

REALLY HAPPY now. Stepping it up ✌️❤️

Sublime Ads is currently not resolving API keys or redirect links. Working on it.

Update: Now working again… sorry about that!

I’ve been working on tweaks to Sublime Ads in the past few months. But never really blogged about them. Little things here and there. Also updated the homepage a little — going to be doing more here. Incremental changes feel good.

Another mistake I made with Sublime Ads, which is a bit of a head scratcher, is my choice of encryption method. There is nothing wrong with it… the only problem is managing keys as it’s file based. Never noticed they had a ENV option also… damn.

Hmmm. Small obstacle encountered. Need to revisit my asset pipeline for Sublime Ads. I tried and failed… but I think I just need to start from absolute beginning and then transplant. 😭

Working on something new for Sublime Ads 👀

Tweaked the wording on every single email that Sublime Ads sends. Took some time. Also tweaked the mailer template a little. Took out those horrid tables.

Doing gradual improvements and feature implementation the next few weeks.

1 year since launch anniversary coming up!

In preparation of a few changes, I made a few tweaks to Sublime Ads.

It was mainly updates to some of the packages (and all that good stuff). I’ve taken the opportunity to upgrade Tailwind also (was using version 1… now we are using version 2 — and yes, I know, version 3 is the hotness). Colours look a little different so let me know if anything seems off.

Not done yet though! This was just a minor little thing before I actually do the bigger work.

I’ll tweak the styles as I go too.

Sublime Ads - New Edge API and super mega fast embeds.

In the last few weeks I was looking at a way to improve the API for Sublime Ads. Namely I wanted to concentrate on the most commonly used endpoints which are the "random" API and the "embed" API.

They are basically, at their core, the same thing. The only difference being that one requires an API key, and the other not.

Around 2 weeks ago I made a few changes on how I'm handling "usage" on Sublime Ads which basically limits the free accounts to a certain amount of API calls. Calling the API would, each time, check if you are within the usage allowance (plus some other bits).

I tidied this up and managed to move it further up the code, so that I would only have to call one piece of code once (to check if the API key is valid and if the call is within the usage allowance)... instead of doing it three times for different parts. This dramatically improved speed by around 100ms in production... and yes... I know... dramatic. The joys of learning and improving!

However, I was still not happy about it. Whilst the API (embed & random) was super quick near my servers, it quickly became slow anywhere outside of the region. Yes, it is still quite fast, and I think most people wouldn't care, but it wasn't enough for me.

On top of that, I had a 20 minute outage this past week... rudely it happened as I was getting up for our morning routine for school. This was my first major outage. There was a minor one earlier this year, but it was DNS related - and I can't do anything about that.

Granted this was not a lot... but that was 20 minutes that also could have affected everyone else relying on the API endpoints.

This got me thinking that I need to work on some sort of backup plan, perhaps have a fallback server with a load balancer in front to distribute as needed... or in my case I could use Cloudflare's Load Balancing option also (as I am using them already for DNS and other things like static pages).

Over the past few months I got interested in their Workers offering... which basically gives me on edge computing without having to own servers, nor worry about having multiple servers dotted across the globe. This is called "serverless" if anyone is interested.

But it was all a little over my head, and I couldn't invest any time in looking into it. So instead, I continued to work on the Teams feature, which I teased and also shipped a few extra bits and bobs.

Anyway... the 20 minute downtime...

I sat down and started working on something with Workers and I was immediately sold! Not only was it super easy to develop with (it's just Javascript) but it was also immensely fast and reliable. On top of that, I had an option for edge storage too... which means every request was fast around the globe.

A few days later, and a lot of tweaking, I rewrote the embed and random API to use the edge network.

The results are mind-blowing for me...

Here is the normal embed API endpoint, with an average 430ms response time. This was around 600ms a few days before (before my API tweaks above).

As you can see, it's pretty fast close to home... but anywhere outside of that it gets pretty slow... quickly. Southern hemisphere (you know who you are) is really at a loss with nearly 1 second to get a response. This is not great.

Now let's compare the same thing, but using the edge API.

🤯

As you can see, we're getting a similar response times across the globe just like at home. Yes, the east few check servers still have slightly higher response times, but they are heaps better!

I couldn't be happier with the result!

To be honest, I was super close of not even looking at this solution, and rather concentrate on provisioning a new server, but I am glad I did!

Whilst I don't want to go into a more in-depth take on this, in this post, I do want to share how it gets enabled for embeds.

Embeds on edge

All accounts will be able to use the edge API simply by just using the embed script on their site... which means everything is working with the new edge locations as we speak. You don't need to enable it. It's an automatic process.

When you first request an embed on your site, it will check with the Sublime Ads server and return an ad for you (to display on your website). This request will have some small latency attached (but nothing more than what you've been used to already).

What happens next is that Sublime Ads will enable your edge updates and pass the relevant data to the edge location storage... we do it after the initial request because I want to make sure you're actually using it. This all happens in the background and you don't have to do anything extra. In fact, if you're using embeds right now... I know that you're already using the edge locations 😋

During testing I found that it takes around 5 - 60 seconds for edge data to become available/update. So please bear with it initially if it's your first time.

In addition to that, all updates, new ads or categories, all trigger an update to the edge. This also works for scheduled ads and works as before.

Again, you have to make zero changes to enable this. The embed script has been updated to use the new url (which actually is near identical to what it was - thank you Cloudflare - I'll write about how that works in the coming week).

So... to recap...

Embeds are super fast now! Not "scary" fast, but super duper mega fast.

Oh... and if there is downtime on the main server... they'll keep working regardless.

Embed images

With everything so fast, I saw that images were not cached... so they took some time to load. No more! They are now cached so they load extra fast across Cloudflare's network.

I'm hoping for more improvements for images over the coming months.

What about the API?

Ah yes, with the above I have been working on a new API to replace the current one for some parts of it.

I'll announce more soon, but for now we already have embeds sorted and there will also be updates to the "random" API that you're used to. In fact, it's already working in my dev environment but not quite ready for production.

I don't want to migrate the full API over to using Cloudflare Workers... I'd rather have some highly available things like embeds running through there. So this is a happy balance for me.

I'll be updating the documentation soon.

Conclusion

I'm super happy with where it's at now and I can see myself relying much more on "serverless" down the line for many other things.

For now I am happy to have done this to provide the best possible reliability and service for everyone using Sublime Ads.

More posts soon about this very topic and hope to have a few more features before the end of year.

I’ve been working on an "edge" API for Sublime Ads over the past few days, using Cloudflare Workers. Happy so far with how it’s going.

As an example, the random API response times are around 400ms currently:

Compare that to the "Edge" of around 190ms.

🤤

Not ready yet, but have been making good progress with the team functionality for Sublime Ads.

This shows when it’s enabled and you have an account selected that isn’t yours.

Spent the morning to try and figure out if I can get custom domains to work with Sublime Ads… and it works 🥳. Happy with that. More a "enterprise" thing once it rolls out. Limited to my Gluon account for now (for promoted content).

Made a few tweaks to the date picker on Sublime Ads this evening/night.

I’ll probably redesign it at some stage and also add a custom date picker (where you can choose the dates).

Happy with this though.