This repository contains the source code of Circles. Circles is an app that we developed for our master thesis during our last year at Université catholique de Louvain.
Circles uses Turborepo and contains:
.github
└─ workflows
└─ CI
.vscode
└─ Recommended extensions and settings for VSCode users
apps
├─ expo
| ├─ Expo SDK 48
| ├─ React Native using React 18
| ├─ Navigation using reactnavigation
| ├─ Tailwind using Nativewind
| ├─ Typesafe API calls using tRPC
| └─ Clerk authentication
└─ next.js
├─ Next.js 13
├─ React 18
├─ Tailwind CSS
├─ E2E Typesafe API Server & Client
└─ Clerk authentication
packages
├─ accesscontrol
| └─ Library to ensure users permissions on resources
├─ api
| └─ tRPC v10 router definition
├─ db
| └─ Typesafe db-calls using Prisma
└─ schema
└─ zod schema and Typescript definition
To get it running, follow the steps below:
- Create a new Firebase project at https://firebase.google.com
- ...
- Create an account at https://clerk.com/ if you do not already have one
- Create a Clerk application
- Link Clerk with Firebase in the dashboard
- In the Clerk dashboard you can find environment variables for your project
# Install dependencies
npm i
# Configure environment variables.
# There is an `.env.example` in the root directory you can use for reference
cp .env.example .env
# Push the Prisma schema to your database
npm run db:push
- Install Android Studio tools as shown on expo docs.
- Run
npm dev
in theapps/expo
folder.
- A MongoDB
Please note that the Next.js application with tRPC must be deployed in order for the Expo app to communicate with the server in a production environment.
Let's deploy the Next.js application to Vercel. If you have ever deployed a Turborepo app there, the steps are quite straightforward. You can also read the official Turborepo guide on deploying to Vercel.
-
Create a new project on Vercel, select the
apps/nextjs
folder as the root directory and apply the following build command:cd ../.. && npx turbo run build --filter=nextjs
-
Add your environment variables.
-
Done! Your app should successfully deploy. Assign your domain and use that instead of
localhost
for theurl
in the Expo app so that your Expo app can communicate with your backend when you are not in development.
Deploying your Expo application works slightly differently compared to Next.js on the web. Instead of "deploying" your app online, you need to submit production builds of your app to the app stores, like Apple App Store and Google Play. You can read the full Distributing your app, including best practices, in the Expo docs.
-
Modify
apps/expo/app.json
with your name and identifiers. -
Make sure to modify the
extra.prodServerBaseUrl
inapps/expo/app.json
to point to your backend's production URL. -
Let's start by setting up EAS Build, which is short for Expo Application Services. The build service helps you create builds of your app, without requiring a full native development setup. The commands below are a summary of Creating your first build.
// Install the EAS CLI $ npm add -g eas-cli // Log in with your Expo account $ eas login // Configure your Expo app $ cd apps/expo $ eas build:configure
-
After the initial setup, you can create your first build. You can build for Android and use different eas.json build profiles to create production builds or development, or test builds. Let's make a production build for Android.
$ eas build --platform android --profile production
If you don't specify the
--profile
flag, EAS uses theproduction
profile by default. -
Now that you have your first production build, you can submit this to the stores. EAS Submit can help you send the build to the stores.
$ eas submit --platform android --latest
You can also combine build and submit in a single command, using
eas build ... --auto-submit
. -
Before you can get your app in the hands of your users, you'll have to provide additional information to the app stores. This includes screenshots, app information, privacy policies, etc. While still in preview, EAS Metadata can help you with most of this information.
-
Once everything is approved, your users can finally enjoy your app. Let's say you spotted a small typo; you'll have to create a new build, submit it to the stores, and wait for approval before you can resolve this issue. In these cases, you can use EAS Update to quickly send a small bugfix to your users without going through this long process. Let's start by setting up EAS Update.
The steps below summarize the Getting started with EAS Update guide.
// Add the `expo-updates` library to your Expo app $ cd apps/expo $ npm install expo-updates // Configure EAS Update $ eas update:configure
-
Before we can send out updates to your app, you have to create a new build and submit it to the app stores. For every change that includes native APIs, you have to rebuild the app and submit the update to the app stores. See steps 2 and 3.
-
Now that everything is ready for updates, let's create a new update for
production
builds. With the--auto
flag, EAS Update uses your current git branch name and commit message for this update. See How EAS Update works for more information.$ cd apps/expo $ eas update --auto
Your OTA (Over The Air) updates must always follow the app store's rules. You can't change your app's primary functionality without getting app store approval. But this is a fast way to update your app for minor changes and bug fixes.
-
Done! Now that you have created your production build, submitted it to the stores, and installed EAS Update, you are ready for anything!
The stack originates from create-t3-turbo.