HACKER Q&A
📣 rsp1984

How to setup own server hosting a service with API (and no front end)?


Hello HN, I'd like to use my own server to host a new service, accessible through an API, for an application (Win/Android/iOS) that I wrote and that already has users. No web frontend is necessary. Just the service that my app calls through an API.

So far I have relied on Google Cloud (App Engine, Cloud functions, etc..) to run these kinds of things but for the new service I find that Google Cloud is too limited. It also requires Mac computers with M1, running Monterey.

My question is: how do I get started setting up my own server(s)? I found numerous tutorials for setting up web servers but I don't need a website / frontend. Just the service with an API. I would also like to have some amount of scalability and protection against DDoS and similar attacks. Is this possible?


  👤 Nextgrid Accepted Answer ✓
An HTTP API is just a different kind of website; it serves machine-readable content instead of human-readable content, but other than that it's still an HTTP service and most resources for webservers would apply.

> It also requires Mac computers with M1, running Monterey.

Does the operation requiring macOS needs to be synchronous & instant or can it be asynchronous and respond within a few seconds/minutes?

I'd highly suggest decoupling the Mac-related part of the API into an asynchronous task, that way the actual API servers can be inexpensive Linux servers.


👤 onlywicked
The simplest option is start the service and then tunnel it using Cloudflare Tunnel [0] with your own domain.

With this you won't have to expose port to public internet, and fiddle with your firewall and router.

Then you can use Cloudflare DDoS protection and other offerings.

[0] https://developers.cloudflare.com/cloudflare-one/connections...


👤 speedgoose
You can rent a M1 at Hetzner or Scaleway. Even AWS if you want to help Jeff Bezos to pay his bills.

👤 yuppie_scum
AWS has M1 instances too.

How does Docker(and compatibles) handle M1? I’d recommend getting your app containerized as early as possible, that should improve the portability, operability and reliability stories.


👤 malf
What is the api? Storage heavy? Compute heavy? Why M1?