Introducing the SST + Tamagui Stack
A productivity and developer experience match made in heaven
Summary
This first article introduces a Github starter I've published here to bring together:
React JS Website
React Native Mobile App (with Expo)
Codesharing of web and mobile frontend components using Tamagui. Write once, deploy to HTML (web) and via React Native to iOS and Android.
Typesafe Graphql server and client for backend and frontend.
Deployment of the backend and infrastructure using SST (previously Serverless Stack) to include:
Serverless, scaleable NextJS Site deployment to AWS Cloudfront + Lambda
Apollo Graphql Server for the website (deployed the same origin to "/api/graphql") and a separate AWS API Gateway endpoint for the mobile app
Get started quick
- Clone the repo with:
git clone git@github.com:BenjaminWatts/sst-tamagui-starter.git
- Do installs with yarn:
yarn
- Fire-up the backend
yarn run dev
- Once complete, start the web app in development
cd packages/next && yarn run dev
- Start the mobile app using Expo (follow the instructions here) first.
cd packages/expo && yarn run start
Rationale
I've long advocated both Serverless (inc Infrastructure as code) as well as React/React-Native for Web and Mobile.
Building apps to a tight budget or timescale requires shortcuts and efficiencies, which this repo unlocks by:
Sharing frontend component code not just between iOS and Android (as React Native allows you to over native options), but between mobile and web.
Graphql to enforce type-safety between frontend and backend. This is a schema-first approach, and with the mono repo, the structure minimises the risk of communication errors between the front and backend.
SST, one-line build and deployment for backend code including the NextJS Webapp (mobile build still manual, I may create a complete pipeline in the future).
SST one-line dev environment setup, with hot code reloading lambda functions (i.e. business logic) from the developer's computer.
Over the coming the weeks, I'll do some deep dives into how each of these components works.