Skip to content

Clean and simple starter repo using the T3 Stack along with Expo React Native

License

Notifications You must be signed in to change notification settings

justindc100/create-t3-turbo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

create-t3-turbo

About

Ever wondered how to migrate your T3 application into a monorepo? Stop right here! This is the perfect starter repo to get you running with the perfect stack!

It uses Turborepo and contains:

apps
 |- expo
     |- Expo SDK 46
     |- React Native using React 18
     |- Tailwind using Nativewind
     |- Typesafe API calls using tRPC
 |- next.js
     |- React 18
     |- TailwindCSS
     |- E2E Typesafe API Server & Client
packages
 |- api
     |- tRPC v10 router definition
 |- db
     |- typesafe db-calls using Prisma

Quick Start

To get it running, follow the steps below:

Setup dependencies

# Install dependencies
npm install

# In packages/db/prisma update schema.prisma provider to use sqlite
- provider = "postgresql"
+ provider = "sqlite"

# Create a `.env` for prisma and make sure it's synced
echo DATABASE_URL=file:./db.sqlite >> packages/db/.env
npm run db-push

Configure Expo dev-script

Note: If you want to use a physical phone with Expo Go, just run npm run dev and scan the QR-code.

Use iOS Simulator

  1. Make sure you have XCode and XCommand Line Tools installed as shown on expo docs.
  2. Change the dev script at apps/expo/package.json to open the iOS simulator.
+  "dev": "expo start --ios",
  1. Run npm run dev at the project root folder.

For Android

  1. Install Android Studio tools as shown on expo docs.
  2. Change the dev script at apps/expo/package.json to open the Android emulator.
+  "dev": "expo start --android",
  1. Run npm run dev at the project root folder.

Deployment

Next.js

Prerequisites

We do not recommend deploying a SQLite database on serverless environments since the data wouldn't be persisted. I provisioned a quick Postgresql database on Railway, but you can of course use any other database provider. Make sure the prisma schema is updated to use the correct database.

Deploy to Vercel

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.

  1. Create a new project on Vercel, select the apps/nextjs folder as the root directory and apply the following build settings: CleanShot 2022-09-03 at 22 51 25@2x

  2. Add your DATABASE_URL environment variable.

  3. Done! Your app should successfully deploy. Assign your domain and use that instead of localhost for the url in the Expo app so that your Expo app can communicate with your backend when you are not in development.

Expo

TODO: Feel free to PR a guide for this. Refer to the Expo docs:

References

The stack originates from create-t3-app.

A blog post where I wrote how to migrate a T3 app into this.

About

Clean and simple starter repo using the T3 Stack along with Expo React Native

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 88.5%
  • JavaScript 11.0%
  • CSS 0.5%