Skip to content

tiesen243/create-yuki-turbo

Repository files navigation

create-yuki-turbo

Installation

Note

Make sure to follow the system requirements specified in package.json#engines before proceeding.

There are two ways of initializing an app using the create-yuki-turbo starter. You can either use this repository as a template:

Click the "Use this template" button on the top right of the repository,

or use Turbo's CLI to init your project (use PNPM as package manager):

npx create-turbo@latest -e https://github.com/tiesen243/create-yuki-turbo

About

This template is forked from create-t3-turbo with some modifications to fit my personal preferences. It is a monorepos template for building full-stack applications with Turborepo, Next.js, tRPC and more.

It uses Turborepo and contains:

.github
  └─ workflows
        └─ CI to check the monorepo: format, lint, and typecheck
apps
  └─ web
      ├─ Next.js 15
      ├─ React 19
      ├─ Tailwind CSS
      └─ E2E Typesafe API Server & Client
packages
  ├─ api
  |   └─ tRPC v11 router definition
  ├─ auth
  |   └─ Authentication from scratch using arctic for OAuth.
  ├─ db
  |   └─ Typesafe db calls using Prisma & Neon
  └─ ui
      └─ Start of a UI package for the webapp using shadcn-ui
tooling
  ├─ eslint
  |   └─ shared, fine-grained, eslint presets
  ├─ prettier
  |   └─ shared prettier configuration
  └─ typescript
      └─ shared tsconfig you can extend from

In this template, we use @yuki as a placeholder for package names. As a user, you might want to replace it with your own organization or project name. You can use find-and-replace to change all the instances of @yuki to something like @my-company or @project-name.

Quick Start

Note The db package is preconfigured to use Neon and is edge-bound. If you're using something else, make the necessary modifications to the schema as well as the client. If you want to switch to non-edge database driver, remove export const runtime = "edge"; from all pages and api routes.

To get it running, follow the steps below:

1. Setup dependencies

# Install dependencies
bun i

# Configure environment variables
# There is an `.env.example` in the root directory you can use for reference
cp .env.example .env

# Push the Drizzle schema to the database
bun db:push

2a. When it's time to add a new UI component

Run the ui-add script to add a new UI component using the interactive shadcn/ui CLI:

bun ui-add

When the component(s) has been installed, you should be good to go and start using it in your app.

2b. When it's time to add a new package

To add a new package, simply run bun turbo gen init in the monorepo root. This will prompt you for a package name as well as if you want to install any dependencies to the new package (of course you can also do this yourself later).

The generator sets up the package.json, tsconfig.json and a index.ts, as well as configures all the necessary configurations for tooling around your package such as formatting, linting and typechecking. When the package is created, you're ready to go build out the package.

2c. When it's time to update the dependencies

To update the dependencies, run the following command:

bun bump-deps

This will update all the dependencies in the monorepos to the latest version.

FAQ

Does the starter include Solito?

No. Solito will not be included in this repo. It is a great tool if you want to share code between your Next.js and Expo app. However, the main purpose of this repo is not the integration between Next.js and Expo — it's the code splitting of your T3 App into a monorepo. The Expo app is just a bonus example of how you can utilize the monorepo with multiple apps but can just as well be any app such as Vite, Electron, etc.

Integrating Solito into this repo isn't hard, and there are a few official templates by the creators of Solito that you can use as a reference.

Does this pattern leak backend code to my client applications?

No, it does not. The api package should only be a production dependency in the Next.js application where it's served. The Expo app, and all other apps you may add in the future, should only add the api package as a dev dependency. This lets you have full typesafety in your client applications, while keeping your backend code safe.

If you need to share runtime code between the client and server, such as input validation schemas, you can create a separate shared package for this and import it on both sides.

Deployment

Next.js

Prerequisites

Note 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.

Deploy to Vercel

Let's deploy the Next.js application to Vercel. If you've never deployed a Turborepo app there, don't worry, 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. Vercel's zero-config system should handle all configurations for you.

  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.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Yuki

About

Clean and typesafe starter monorepo using Turborepo along with Next.js and tRPC

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published