# Preferred tech stack

## Software/web development and hosting

### General

| Task                                                              | Preferred tool                                                                   | Pros                                                                                                                                                                                                                                                                                 | Cons                                                                                                                                                                                                                                                 |
| ----------------------------------------------------------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Static site hosting                                               | <ul><li>Netlify</li><li>Vercel</li><li>Github Pages</li><li>CloudFlare</li></ul> | <ul><li>Free for most of our needs and usage levels</li><li>Run whatever front-end and even some back-end build scripts you tell it to</li><li>We have a Netlify team account for open source non-commercial projects</li><li>Fundamentally these are CDNs for low latency</li></ul> | <ul><li>Technically locked in though practically moving to Docker hosted on Virtual Servers is possible if platform specific features (Netlify Functions, Vercel Sourced Images) not used.</li><li>Not all have South African data centres</li></ul> |
| Virtual servers                                                   | <ul><li>AWS EC2</li><li>Hetzner Cloud</li></ul>                                  | <ul><li>Quick to spin up right-sized instances</li><li>AWS EC2 Free Tier is capable</li></ul>                                                                                                                                                                                        | <ul><li>Managing server operating systems</li><li>Cost</li></ul>                                                                                                                                                                                     |
| Database hosting                                                  | <ul><li>AWS RDS</li><li>Supabase</li></ul>                                       | <ul><li>No need to wonder or worry about backups</li><li>We have a server that handles our load</li><li>It's the same cost and less stress than managing the server and ops ourselves</li></ul>                                                                                      | <ul><li>Still costly</li><li>End Of Life version support very expensive</li></ul>                                                                                                                                                                    |
| Domain Registration                                               | <ul><li>Domains.co.za</li><li>CloudFlare</li></ul>                               | <ul><li>Domains.co.za is local, lots of our domains already there</li><li>CloudFlare built in DNS, security, proxy etc. very capable</li></ul>                                                                                                                                       |                                                                                                                                                                                                                                                      |
| DNS                                                               | <ul><li>Cloudflare</li></ul>                                                     | <ul><li>Supports apex domain aliases</li><li>DDoS, anti-scraping, and "bot" protection</li><li>Free Pro features for worthy projects</li><li>South African data centre</li></ul>                                                                                                     |                                                                                                                                                                                                                                                      |
| Configuration management                                          | [Ansible](https://github.com/OpenUpSA/ansible-config/)                           | <ul><li>One authoritative representation of how an app should currently be deployed. Deploying additional instances is trivial</li></ul>                                                                                                                                             | <ul><li>It only works if we keep it up to date</li></ul>                                                                                                                                                                                             |
| Secrets management (for things needed when we deploy apps)        | <ul><li>Bitwarden</li></ul>                                                      | <ul><li>Usable UI</li></ul>                                                                                                                                                                                                                                                          | <ul><li>Not free</li></ul>                                                                                                                                                                                                                           |
| Running apps on servers                                           | <ul><li>Dokku</li></ul>                                                          | <ul><li>Standardised configuration storage</li><li>Automated HTTP proxy to docker containers</li><li>Seamless deploy with smoke tests</li><li>Easy TLS</li></ul>                                                                                                                     | <ul><li>Not suitable for every situation, e.g it doesn't have a notion of dependencies between apps. Docker Networks solves this better than Docker Links though.</li></ul>                                                                          |
| Databases that accept writes at runtime                           | <ul><li>PostgreSQL</li></ul>                                                     | <ul><li>Open Source</li><li>Performant</li><li>Under active development</li><li>Has JSONB field types where optional nested fields can be indexed</li></ul>                                                                                                                          | <ul><li>Not cheap to host</li></ul>                                                                                                                                                                                                                  |
| Databases that accept writes at data-loading events               | <ul><li>SQLite</li></ul>                                                         | <ul><li>Cheap to host</li></ul>                                                                                                                                                                                                                                                      | <ul><li>Multi-user performance</li></ul>                                                                                                                                                                                                             |
| Website monitoring                                                | <ul><li>UpTimeRobot</li></ul>                                                    | <ul><li>Most affordable, does the job</li></ul>                                                                                                                                                                                                                                      | <ul><li>Not many global locations</li></ul>                                                                                                                                                                                                          |
| Error alerting                                                    | <ul><li>sentry.io</li></ul>                                                      | <ul><li>Very helpful request and error data capture/presentation,</li></ul><ul><li>Aggregating many instances of the same error (as opposed to 1000 emails of the same issue)</li></ul><ul><li>Open Source sponsorship for team account</li></ul>                                    |                                                                                                                                                                                                                                                      |
| Application Performance Monitoring (APM)                          | <ul><li>sentry.io</li></ul>                                                      |                                                                                                                                                                                                                                                                                      |                                                                                                                                                                                                                                                      |
| Port monitoring (notifications when a new port opens on a server) | <ul><li>hackertarget.com</li></ul>                                               | <ul><li>Diff of open ports via email makes it really easy to spot changes and decide if they thought be open or not.</li></ul>                                                                                                                                                       |                                                                                                                                                                                                                                                      |

### Software/web development stack

Please discuss deviations from our standard stack options in [#technology-advice-grp](https://openupsa.slack.com/archives/CBL958RME).

See _**Tech to try**_ in our [Tech Infrastructure backlog](https://trello.com/b/3lVjXyzc/tech-infrastructure) for exploring alternatives to these.

| Name                                 | Components                             | Good for                                                                                                      | Bad for                            | Dev costs                                                               | Running costs                                             |
| ------------------------------------ | -------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------------------------- | ----------------------------------------------------------------------- | --------------------------------------------------------- |
| Webflow static site, webflow-hosted  | Webflow                                | Visually appealing sites                                                                                      | Frequent content edits             | Webflow designer time                                                   | $12/m annual; $15/m monthly                               |
| Webflow static site, static-hosted   | Webflow, static hosting                | Visually appealing sites, free hosting                                                                        | Frequent content edits             | Webflow designer time                                                   | Free - updates require developer to redeploy (30 minutes) |
| Webflow CMS                          | Webflow                                | Visually appealing sites, easy content management                                                             | more than 2000 data items          | Webflow designer time                                                   | $16/m annual; $20/m monthly                               |
| Webflow frontend as Django templates | Webflow, Django                        | Visually appealing sites, social-sharing metadata, thousands to millions of data items                        | Hosting has an operations overhead | Webflow designer time, Django developer time, Javascript developer time | \~$5 per month + hosting operations                       |
| Webflow frontend as Single Page App  | Webflow, API backend (probably Django) | Visually appealing sites, independence of frontend and backend developer, thousands to millions of data items | Hosting has an operations overhead | Webflow designer time, Django developer time, Javascript developer time | \~$5 per month + hosting operations                       |

### Django apps

Our preferred way to structure and use django apps is documented and templated using our [Django Cookiecutter](https://github.com/OpenUpSA/cookiecutter-django-dokku)
