Skip to content

himacks/next-typescript-orm-trpc-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1e265c3 · Nov 16, 2024

History

4 Commits
Oct 22, 2024
Nov 16, 2024
Nov 16, 2024
Oct 22, 2024
Oct 22, 2024
Nov 16, 2024
Oct 22, 2024
Oct 22, 2024
Oct 22, 2024
Oct 22, 2024
Oct 22, 2024
Oct 22, 2024
Oct 22, 2024
Nov 16, 2024
Oct 22, 2024
Oct 22, 2024

Repository files navigation

Create T3 App

This is a T3 Stack project bootstrapped with create-t3-app.

Learn More

To learn more about the T3 Stack, take a look at the following resources:

How do I deploy this?

Follow our deployment guides for Vercel, Netlify and Docker for more information.

How to run the project

  1. Create .env file by copying .env.example and filling in the required fields, define your database name in the start-database.sh script. Ensure docker is running and installed. You can leave the database password as "password" and it will be generated for you or change it to your desired password.
  2. Run ./start-database.sh to start a local postgres database in a docker container
  3. Run npm run db:push to push default migrations
  4. Run npm install to install the dependencies
  5. Run npm run dev to start the development server

Configuration Instructions

Database Setup

  1. Run ./start-database.sh to start a local postgres database in a docker container
  2. Run npm run db:push to push the models to the database
  3. Update your schema in drizzle/schema.ts
  4. Run npm run db:push to push the new schema to the database
  5. We can leverage InferSelectModel and InferInsertModel to type our queries and mutations so we can use them in our tRPC routes and app for type safety. When we update schema our types will automatically be updated and reflected.

TRPC Setup

  1. All TRPC routes are defined in src/server/api/routers
  2. Add new TRPC routers in src/server/api/routers
  3. Resolve TRPC router imports in src/server/api/root.ts by adding them to the createTRPCRouter function
  4. Call TRPC routes within the app, see post as example, this creates a tunnel from the frontend to the backend in a type safe manner
  5. Read into queries and mutations, queries are used for read only data that is fetched on the client side by default on load and mutations are used for write operations

Auth Setup

  1. Add auth providers to src/server/auth.ts
  2. Include proper environment variables for auth providers in .env and src/env.js

Shadcn UI Component Setup

  1. Shadcn UI components are located in src/components/ui
  2. Use npx shadcn-ui@latest add {component} to add a new component it will automatically update the src/components/ui/index.tsx file
  3. Reference the website for the component you want to use here: https://ui.shadcn.com/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published