The ultimate starter repo for building full-stack, type-safe, LLM-powered web apps. It uses:
- Turborepo for monorepo management
- tRPC for API routing
- Prisma for database access
- Next.js for the web app
- OpenAI for the AI
- Langchain for LLM management
And much more!
.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
To get it running, follow the steps below:
# 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
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.
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 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.
-
Add your
DATABASE_URL
environment variable. -
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.
- 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)
The stack originates from create-t3-app and create-t3-turbo. The maintainers of these projects deserve all the credit!