Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .agents/tanstack-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ Server functions wrapped in `createServerFn` can be imported statically. Never u
// Bad: dynamic import causes bundler issues
const rolesQuery = useQuery({
queryFn: async () => {
const { $listRoles } = await import("@/utils/roles.server");
const { $listRoles } = await import("#utils/roles.server");
return $listRoles({ data: {} });
},
});

// Good: static import
import { $listRoles } from "@/utils/roles.server";
import { $listRoles } from "#utils/roles.server";

const rolesQuery = useQuery({
queryFn: async () => $listRoles({ data: {} }),
Expand Down
10 changes: 5 additions & 5 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"iconLibrary": "lucide",
"rtl": false,
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
"components": "#components",
"utils": "#lib/utils",
"ui": "#components/ui",
"lib": "#lib",
"hooks": "#hooks"
Comment thread
dotnize marked this conversation as resolved.
Outdated
},
"menuColor": "default",
"menuAccent": "subtle",
Expand Down
2 changes: 1 addition & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Config } from "drizzle-kit";

import { env } from "@/env/server";
import { env } from "#env/server";

export default {
out: "./drizzle",
Expand Down
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
"name": "tanstarter",
"private": true,
"type": "module",
"imports": {
"#*": [
"./src/*",
"./src/*.ts",
"./src/*.tsx",
"./src/*/index.ts",
"./src/*/index.tsx"
]
},
"scripts": {
"dev": "vite dev",
"build": "vite build",
Expand Down
8 changes: 4 additions & 4 deletions src/components/_DELETE_ME_intro_page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { Suspense } from "react";
import { useState } from "react";
import { toast } from "sonner";

import { SignOutButton } from "@/components/sign-out-button";
import { ThemeToggle } from "@/components/theme-toggle";
import { Button } from "@/components/ui/button";
import { useAuthSuspense } from "@/lib/auth/hooks";
import { SignOutButton } from "#components/sign-out-button";
import { ThemeToggle } from "#components/theme-toggle";
import { Button } from "#components/ui/button";
import { useAuthSuspense } from "#lib/auth/hooks";

/**
* This is the intro component for TanStarter, which you may delete after creating the project.
Expand Down
4 changes: 2 additions & 2 deletions src/components/sign-in-social-button.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useMutation } from "@tanstack/react-query";
import { toast } from "sonner";

import { Button } from "@/components/ui/button";
import { authClient } from "@/lib/auth/auth-client";
import { Button } from "#components/ui/button";
import { authClient } from "#lib/auth/auth-client";

interface SocialLoginButtonProps {
provider: string;
Expand Down
6 changes: 3 additions & 3 deletions src/components/sign-out-button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useQueryClient } from "@tanstack/react-query";
import { useRouter } from "@tanstack/react-router";

import { Button } from "@/components/ui/button";
import { authClient } from "@/lib/auth/auth-client";
import { authQueryOptions } from "@/lib/auth/queries";
import { Button } from "#components/ui/button";
import { authClient } from "#lib/auth/auth-client";
import { authQueryOptions } from "#lib/auth/queries";

export function SignOutButton() {
const queryClient = useQueryClient();
Expand Down
6 changes: 3 additions & 3 deletions src/components/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SunIcon, MoonIcon } from "lucide-react";

import { useTheme } from "@/components/theme-provider";
import { Button } from "@/components/ui/button";
import { useTheme } from "#components/theme-provider";
import { Button } from "#components/ui/button";
import {
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu";
} from "#components/ui/dropdown-menu";

export function ThemeToggle() {
const { theme, setTheme } = useTheme();
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Button as ButtonPrimitive } from "@base-ui/react/button";
import { cva, type VariantProps } from "class-variance-authority";

import { cn } from "@/lib/utils";
import { cn } from "#lib/utils";

const buttonVariants = cva(
"group/button inline-flex shrink-0 items-center justify-center rounded-4xl border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/30 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Menu as MenuPrimitive } from "@base-ui/react/menu";
import { ChevronRightIcon, CheckIcon } from "lucide-react";
import * as React from "react";

import { cn } from "@/lib/utils";
import { cn } from "#lib/utils";

function DropdownMenu({ ...props }: MenuPrimitive.Root.Props) {
return <MenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Input as InputPrimitive } from "@base-ui/react/input";
import * as React from "react";

import { cn } from "@/lib/utils";
import { cn } from "#lib/utils";

function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/label.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from "react";

import { cn } from "@/lib/utils";
import { cn } from "#lib/utils";

function Label({ className, ...props }: React.ComponentProps<"label">) {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/sonner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from "lucide-react";
import { Toaster as Sonner, type ToasterProps } from "sonner";

import { useTheme } from "@/components/theme-provider";
import { useTheme } from "#components/theme-provider";

const Toaster = ({ ...props }: ToasterProps) => {
const { theme } = useTheme();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/auth/auth-client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createAuthClient } from "better-auth/react";

import { env } from "@/env/client";
import { env } from "#env/client";

/**
* https://better-auth.com/docs/concepts/client
Expand Down
6 changes: 3 additions & 3 deletions src/lib/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { drizzleAdapter } from "@better-auth/drizzle-adapter";
import { betterAuth } from "better-auth/minimal";
import { tanstackStartCookies } from "better-auth/tanstack-start";

import { env } from "@/env/server";
import { db } from "@/lib/db";
import * as schema from "@/lib/db/schema";
import { env } from "#env/server";
import { db } from "#lib/db";
import * as schema from "#lib/db/schema";

export const auth = betterAuth({
baseURL: env.VITE_BASE_URL,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/auth/functions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createServerFn, createServerOnlyFn } from "@tanstack/react-start";
import { getRequest, setResponseHeader } from "@tanstack/react-start/server";

import { auth } from "@/lib/auth/auth";
import { auth } from "#lib/auth/auth";

/**
* This server function is meant to be called via authQueryOptions() in queries.ts,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/auth/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMiddleware } from "@tanstack/react-start";
import { setResponseStatus } from "@tanstack/react-start/server";

import { _getUser } from "@/lib/auth/functions";
import { _getUser } from "#lib/auth/functions";

// https://tanstack.com/start/latest/docs/framework/react/guide/middleware

Expand Down
4 changes: 2 additions & 2 deletions src/lib/db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import "@tanstack/react-start/server-only";
import { drizzle } from "drizzle-orm/postgres-js";
import postgres from "postgres";

import { env } from "@/env/server";
import * as schema from "@/lib/db/schema";
import { env } from "#env/server";
import * as schema from "#lib/db/schema";

const client = postgres(env.DATABASE_URL);

Expand Down
4 changes: 2 additions & 2 deletions src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { QueryClient } from "@tanstack/react-query";
import { createRouter } from "@tanstack/react-router";
import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";

import { DefaultCatchBoundary } from "@/components/default-catch-boundary";
import { DefaultNotFound } from "@/components/default-not-found";
import { DefaultCatchBoundary } from "#components/default-catch-boundary";
import { DefaultNotFound } from "#components/default-not-found";

import { routeTree } from "./routeTree.gen";

Expand Down
8 changes: 4 additions & 4 deletions src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { ReactQueryDevtoolsPanel } from "@tanstack/react-query-devtools";
import { createRootRouteWithContext, HeadContent, Scripts } from "@tanstack/react-router";
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";

import { ThemeProvider } from "@/components/theme-provider";
import { Toaster } from "@/components/ui/sonner";
import type { AuthQueryResult } from "@/lib/auth/queries";
import { ThemeProvider } from "#components/theme-provider";
import { Toaster } from "#components/ui/sonner";
import type { AuthQueryResult } from "#lib/auth/queries";

import appCss from "@/styles.css?url";
import appCss from "#styles.css?url";

interface MyRouterContext {
queryClient: QueryClient;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/_auth/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";

import { useAuthSuspense } from "@/lib/auth/hooks";
import { useAuthSuspense } from "#lib/auth/hooks";

export const Route = createFileRoute("/_auth/app/")({
component: AppIndex,
Expand Down
6 changes: 3 additions & 3 deletions src/routes/_auth/app/route.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createFileRoute, Link, Outlet } from "@tanstack/react-router";

import { SignOutButton } from "@/components/sign-out-button";
import { ThemeToggle } from "@/components/theme-toggle";
import { Button } from "@/components/ui/button";
import { SignOutButton } from "#components/sign-out-button";
import { ThemeToggle } from "#components/theme-toggle";
import { Button } from "#components/ui/button";

export const Route = createFileRoute("/_auth/app")({
component: AppLayout,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/_auth/route.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";

import { authQueryOptions } from "@/lib/auth/queries";
import { authQueryOptions } from "#lib/auth/queries";

/**
* This is the _auth layout, which enables 'protected routes'
Expand Down
10 changes: 5 additions & 5 deletions src/routes/_guest/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { createFileRoute, Link } from "@tanstack/react-router";
import { GalleryVerticalEndIcon, LoaderCircleIcon } from "lucide-react";
import { toast } from "sonner";

import { SignInSocialButton } from "@/components/sign-in-social-button";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { authClient } from "@/lib/auth/auth-client";
import { SignInSocialButton } from "#components/sign-in-social-button";
import { Button } from "#components/ui/button";
import { Input } from "#components/ui/input";
import { Label } from "#components/ui/label";
import { authClient } from "#lib/auth/auth-client";

export const Route = createFileRoute("/_guest/login")({
component: LoginForm,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/_guest/route.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute, Outlet, redirect } from "@tanstack/react-router";

import { authQueryOptions } from "@/lib/auth/queries";
import { authQueryOptions } from "#lib/auth/queries";

export const Route = createFileRoute("/_guest")({
component: RouteComponent,
Expand Down
12 changes: 6 additions & 6 deletions src/routes/_guest/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
import { GalleryVerticalEndIcon, LoaderCircleIcon } from "lucide-react";
import { toast } from "sonner";

import { SignInSocialButton } from "@/components/sign-in-social-button";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { authClient } from "@/lib/auth/auth-client";
import { authQueryOptions } from "@/lib/auth/queries";
import { SignInSocialButton } from "#components/sign-in-social-button";
import { Button } from "#components/ui/button";
import { Input } from "#components/ui/input";
import { Label } from "#components/ui/label";
import { authClient } from "#lib/auth/auth-client";
import { authQueryOptions } from "#lib/auth/queries";

export const Route = createFileRoute("/_guest/signup")({
component: SignupForm,
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/auth/$.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";

import { auth } from "@/lib/auth/auth";
import { auth } from "#lib/auth/auth";

export const Route = createFileRoute("/api/auth/$")({
server: {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";

import { IntroPageDeleteMe } from "@/components/_DELETE_ME_intro_page";
import { IntroPageDeleteMe } from "#components/_DELETE_ME_intro_page";

export const Route = createFileRoute("/")({
component: HomePage,
Expand Down
4 changes: 1 addition & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
"target": "ES2022",
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"@/*": ["./src/*"]
},
"resolvePackageJsonImports": true,
"noEmit": true,
"strictNullChecks": true,
"types": ["node", "vite/client"]
Expand Down
3 changes: 0 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { nitro } from "nitro/vite";
import { defineConfig } from "vite";

export default defineConfig({
resolve: {
tsconfigPaths: true,
},
server: {
port: 3000,
},
Expand Down