Tamagui with Supabase, Expo, Next.js, Solito and Jotai

Overview

Tamagui + Supabase + Solito + Next + Expo Monorepo

⚡️ Instant clone & deploy

Deploy with Vercel

🔦 About

This monorepo is a starter todo app, built using Supabase + Expo + Next.js + Tamagui + Solito, adapted from the Tamagui starter (npx create-tamagui-app@latest).

Tamagui is a universal design system for React Native & Web built by @natebirdman.

Many thanks to @FernandoTheRojo for the Solito starter monorepo which this was initally forked from. Check out his talk about using expo + next together at Next.js Conf 2021.

📦 Included packages

  • tamagui for cross-platform views, themes and animations
  • solito for cross-platform navigation
  • jotai for state management
  • @supabase/supabase-js
  • @supabase/supabase-auth-helpers
  • Expo SDK 44
  • Next.js 12
  • React Navigation 6

🗂 Folder layout

The main apps are:

  • expo (native)

  • next (web)

  • packages shared packages across apps

    • data-access Supabase client, Jotai state management & user / auth context
    • ui includes your custom UI kit that will be optimized by Tamagui
    • app you'll be importing most files from app/
      • features (don't use a screens folder. organize by feature.)
      • provider (all the providers that wrap the app, and some no-ops for Web.)
      • navigation Next.js has a pages/ folder. React Native doesn't. This folder contains navigation-related code for RN. You may use it for any navigation code, such as custom links.

You can add other folders inside of packages/ if you know what you're doing and have a good reason to.

🏁 Start the app

  • Set the environment variables for next and expo
  • Install dependencies: yarn
  • Next.js local dev: yarn web
    • Runs yarn next
  • Expo local dev: yarn native
    • Runs expo start

💾 Setting up Supabase

  • Create a new Supabase project

Using GUI

  • Navigate to the project, then SQL Editor
  • Run the following 'todos' migration
create table todos (
  id bigint generated by default as identity primary key,
  user_id uuid references auth.users not null,
  task text check (char_length(task) > 3),
  is_complete boolean default false,
  inserted_at timestamp with time zone default timezone('utc'::text, now()) not null
);

alter table todos enable row level security;
alter publication supabase_realtime add table todos;

create policy "Individuals can create todos." on todos for
    insert with check (auth.uid() = user_id);
create policy "Individuals can view their own todos. " on todos for
    select using (auth.uid() = user_id);
create policy "Individuals can update their own todos." on todos for
    update using (auth.uid() = user_id);
create policy "Individuals can delete their own todos." on todos for
    delete using (auth.uid() = user_id);

Using the CLI

  • Install the CLI npm install -g supabase
  • Init supabase in the project supabase init
  • Login with an access token supabase login
  • Link to your project supabase link --project-ref [project-ref]
  • Link your Supabase database supabase db remote set [database connection string with port 5432]
  • Create a new migration supabase migration new todos
  • Copy the schema from todos.sql into the new migration at supabase/migrations/[migration]_todos.sql
  • Run the todos migration supabase db push

Developing

Supabase

  • Navigate to the data-access package.
  • Set the SUPABASE_REST_API_URL, see .env.example for example
  • Generate new types from your Supabase project by running yarn supabase:types

Tamagui

We've added packages/ui to show an example of building your own design system.

You need to watch it to have changes propagate, we've added a root watch command you should run in a separate terminal alongside the apps:

yarn watch

If you want to see Tamagui extract, try running yarn web:optimize and put a debug pragma at the top of packages/app/features/home.tsx, like so:

// debug

You'll see lots of output including the compiled HTML, CSS and all the steps it takes to get there.

UI Kit

Note we're following the design systems guide and creating our own package for components.

See packages/ui named @my/ui for how this works.

🆕 Add new dependencies

Pure JS dependencies

If you're installing a JavaScript-only dependency that will be used across platforms, install it in packages/app:

cd packages/app
yarn add date-fns
cd ../..
yarn

Native dependencies

If you're installing a library with any native code, you must install it in expo:

cd expo
yarn add react-native-reanimated
cd ..
yarn

You can also install the native library inside of packages/app if you want to get autoimport for that package inside of the app folder. However, you need to be careful and install the exact same version in both packages. If the versions mismatch at all, you'll potentially get terrible bugs. This is a classic monorepo issue. I use lerna-update-wizard to help with this (you don't need to use Lerna to use that lib).

You might also like...

Expo Demo: Screen Capture with Managed Workflow

Expo Demo: Screen Capture with Managed Workflow This code demonstrates how to setup screen capture on an Expo app, without having to eject from the ma

Dec 30, 2022

A new renovated version of Directory to search @expo-google-fonts

Directory | AtilaDev Directory is an easy & quick search to find google fonts using @expo-google-fonts for your React Native App. Usage Press / key to

Oct 5, 2022

Boilerplate for a NextJS and Supabase Project. Including full authentication with sign up, login and password recovery.

NextJS x Supabase Boilerplate Getting Started Environment variables Create the enviroment variables with the following command cp .env.local.dist .env

Jun 13, 2022

Work from is a web app created by Josh Cawthorne for the Supabase Hackathon.

Work from is a web app created by Josh Cawthorne for the Supabase Hackathon.

Work From What is Work From? Work from is a web app created by Josh Cawthorne for the Supabase Hackathon. The concept of the app is for companies to b

Jan 3, 2023

A collection of framework specific Auth utilities for working with Supabase.

A collection of framework specific Auth utilities for working with Supabase.

Jan 2, 2023

Next-multipart - Easy & Simple File Uploads for Next.js

Next-Multipart Next-multipart is a small utility library to ease the process of file uploads with Next.js. It uses formidable under the hood, but with

Nov 11, 2022

Next-gen, highly customizable content editor for the browser - based on React and Redux and written in TypeScript. WYSIWYG on steroids.

ReactPage ReactPage is a smart, extensible and modern editor ("WYSIWYG") for the web written in React. If you are fed up with the limitations of conte

Jan 6, 2023

An interactive CLI automation tool 🛠️ for creating react.js and next.js projects most fast and efficiently. ⚛️

An interactive CLI automation tool 🛠️ for creating react.js and next.js projects most fast and efficiently. ⚛️

An interactive CLI automation tool 🛠️ for creating react.js and next.js projects most fast and efficiently. ⚛️ About ℹ️ ReexJs CLI is an interactive

Apr 12, 2022

An inventory and financial control system created in Next.js and Redux

An inventory and financial control system created in Next.js and Redux

An inventory and financial control system created in Next.js and Redux

Nov 10, 2022
Owner
Lachlan Hawthorne
Lachlan Hawthorne
Expo Config Plugin that generates an App Clip for iOS apps built with Expo.

react-native-app-clip Expo Config Plugin that generates an App Clip for iOS apps built with Expo. Warning This plugin is a work in progress and hasn’t

Benedikt 186 Dec 24, 2022
Next.js + Prisma + Supabase simple Blog example

Next.js + Prisma + Supabase Blog Project About the Project Prisma connects the PostgreSQL Database provided by Supabase by using postgres connection s

Soham Shah 4 Nov 19, 2022
cms for next.js based on supabase for developers.

one cms for next.js based on supabase for developers. disclaimer one is in early and active development and currently not functional. all the @one pac

Jonas Wanner 6 Aug 27, 2022
Boilerplate to build Cross-Platform Apps with Expo and React Native

Expo and React Native Boilerplate Boilerplate to build Cross-Platform Apps with Expo and React Native What are you going to find in this boilerplate E

José Ferrer 26 Apr 29, 2022
React Native & Expo music player application UI

Would you like to support me? Musicont React Native & Expo music player application UI Demo: https://expo.io/@jsxclan/musicont APK: Download on Google

JSX Clan 82 Dec 14, 2022
Our Expo-based mobile application for demonstration purposes.

Capable Care reference implementation This repository provides a working example of a React Native mobile application (built on Expo) integrating Capa

Capable Health 11 Oct 1, 2022
A simple example on how to get WalletConnect to authenticate wallets in the Expo Go app.

WalletConnect Example on Expo This is a simple example how to get WalletConnect up and running with Expo for React Native. WalletConnect's dependency

Carlos A. Wong 60 Dec 30, 2022
Convert a CSS linear gradient function to expo-linear-gradient props

@bacons/css-to-expo-linear-gradient Demo: snack Convert a CSS linear gradient function to expo-linear-gradient props. Add the package to your npm depe

Evan Bacon 15 Dec 15, 2022
An easy hook to use with expo-calendar library!

useCalendar Hook ?? Updated to Expo SDK45 This is an easy hook to use expo-calendar. It allows you: Get access permission to calendar Open settings to

AtilaDev 12 Nov 1, 2022
A lite version for the my original app loki stream which allowed watching anime on your phone. Made using expo.

LokiStream Lite A lite version for the my original app loki stream. This app is faster, smaller and more optimized for your phone. It allows you to wa

Lavish Kumar 18 Dec 24, 2022