Coder Social home page Coder Social logo

zckly / create-t3-turbo-ai Goto Github PK

View Code? Open in Web Editor NEW
337.0 16.0 17.0 325 KB

Build full-stack, type-safe, LLM-powered apps with the T3 Stack, Turborepo, OpenAI, and Langchain

License: MIT License

Shell 4.19% JavaScript 28.94% TypeScript 66.62% CSS 0.25%
gpt-3 langchain ai

create-t3-turbo-ai's Introduction

create-t3-turbo-ai

NOTE: THIS IS VERY MUCH ๐Ÿšง WIP ๐Ÿšง. A lot of the features are yet to come - stay tuned!

About

The ultimate starter repo for building full-stack, type-safe, LLM-powered web apps. It uses:

And much more!

Folder structure

.github
  โ””โ”€ workflows
        โ””โ”€ CI with pnpm cache setup
.vscode
  โ””โ”€ Recommended extensions and settings for VSCode users
apps
  โ””โ”€ next.js
      โ”œโ”€ Next.js 13
      โ”œโ”€ React 18
      โ”œโ”€ Tailwind CSS
      โ””โ”€ E2E Typesafe API Server & Client
packages
 โ”œโ”€ api
 |   โ””โ”€ tRPC v10 router definition
 โ”œโ”€ auth
     โ””โ”€ authentication using next-auth. **NOTE: Only for Next.js app, not Expo**
 โ””โ”€ db
     โ””โ”€ typesafe db-calls using Prisma

FAQ

Quick Start

To get it running, follow the steps below:

Setup dependencies

# Install dependencies
pnpm i

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

# Configure environment variables.
# There is an `.env.example` in the root directory you can use for reference
# Make sure you add the OPENAI_API_KEY environment variable!
cp .env.example .env

# Push the Prisma schema to your database
pnpm db:push

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.

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 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:

Vercel deployment settings

The install command filters out the expo package and saves a few second (and cache size) of dependency installation. The build command makes us build the application using Turbo.

  1. Add your DATABASE_URL environment variable.

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

TODO

  • Organize prompts in a prompt library (rather than leaving them in the API folder)
  • Add Promptable.js option
  • Add embeddings example
  • Add PromptLayer example
  • Add Vercel Edge Functions to handle streaming
  • Add ChatGPT w/ memory example
  • Add LLM + Agents example
  • Update to NextJS app directory (once stable)

References

The stack originates from create-t3-app and create-t3-turbo. The maintainers of these projects deserve all the credit!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.