Uplink vs server module

Just wanted to throw in my tuppence. The short version is that server modules are a lot simpler and easier to use, so if you’re not sure, you should start with server modules, then move code to the uplink only when you need to.

Server modules:

Advantages:

  • No setup necessary (they Just Work)
  • They are part of your app. For example:
    • Unified version control - server and client are saved together, rollback both at the same time, publish both at the same time, etc.
    • Autocomplete - because both server and client code are in the Anvil editor, it knows what you pass into (and return from) each server function. (Watch my talk at PyCon UK about how this works!)
    • Your server functions can share Modules with client code.

Disadvantages:

  • Only runs while you are calling a server function
  • CPU/memory/time limits

Uplink:

Advantages:

  • Your code can run anywhere (on an IoT device, in your data centre, even as part of another app)
  • You have complete control of the execution environment (install whatever modules you like, run it on whatever hardware you like)
  • You control what data touches Anvil’s infrastructure (eg if your Uplink can see sensitive data that must not be accessible outside your network, you can still perform non-sensitive queries over the Uplink. Of course, if you have requirements like these you should really be looking at an on-site Anvil installation.)

Disadvantages:

  • You are responsible for setting up the environment in which it runs, doing security updates, etc
  • You are responsible for making sure that your uplink code stays running 24/7 (devops-y stuff)
  • The code isn’t part of your Anvil app. (This means you are responsible for keeping your Uplink code in sync with your Anvil app, and doing your own version control, managing development & published environments, etc)
2 Likes