This guide outlines the best practices and patterns to follow when developing with the Builder Box.
src/features/
features/ ├── auth/ ├── chat/ └── dashboard/
// components/ui/Button.tsx import { ButtonProps } from '@/types' import { cn } from '@/utils' export const Button = ({ className, ...props }: ButtonProps) => { return ( <button className={cn( 'rounded-md bg-primary px-4 py-2 text-white', className )} {...props} /> ) }
// routers/user.ts import { z } from 'zod' import { publicProcedure, router } from '../trpc' export const userRouter = router({ getProfile: publicProcedure .input(z.object({ id: z.string() })) .query(async ({ input, ctx }) => { // Implementation }), })
// services/user.ts import { prisma } from '@/lib/prisma' export const userService = { async createUser(data: CreateUserInput) { return prisma.$transaction(async (tx) => { const user = await tx.user.create({ data: { ...data, profile: { create: { // Profile data } } } }) return user }) } }
<div className=" flex flex-col space-y-4 p-4 md:flex-row md:space-x-4 md:space-y-0 "> {/* Content */} </div>