Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"dependencies": {
"@hono/node-server": "^1.19.9",
"@hono/zod-openapi": "^0.19.2",
"@repo/auth": "workspace:*",
"@repo/db": "workspace:*",
"@repo/env": "workspace:*",
"dotenv": "^17.2.4",
Expand Down
15 changes: 14 additions & 1 deletion apps/api/src/app.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { auth } from "@repo/auth"
import { env } from "@repo/env/server"
import { cors } from "hono/cors"
import createApp from "@/lib/helpers/app/create-app"
import configureOpenAPI from "@/lib/helpers/openapi/configure-openapi"
Expand All @@ -6,7 +8,18 @@ import waitlistRouter from "@/routes/waitlist/index"

const app = createApp()

app.use("*", cors())
app.use(
"*",
cors({
origin:
env.NODE_ENV === "development"
? "http://localhost:3000"
: env.NEXT_PUBLIC_API_URL,
credentials: true,
})
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.

app.on(["GET", "POST"], "/api/auth/**", (c) => auth.handler(c.req.raw))

configureOpenAPI(app)

Expand Down
27 changes: 5 additions & 22 deletions apps/web/.gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build
/dist

# misc
.DS_Store
Expand All @@ -30,12 +14,11 @@ yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
# env files
.env*

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# tanstack router (auto-generated)
routeTree.gen.ts
36 changes: 0 additions & 36 deletions apps/web/README.md

This file was deleted.

31 changes: 0 additions & 31 deletions apps/web/app/components/providers.tsx

This file was deleted.

34 changes: 0 additions & 34 deletions apps/web/app/layout.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions apps/web/app/page.tsx

This file was deleted.

14 changes: 14 additions & 0 deletions apps/web/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Townhall</title>
<meta name="description" content="Community chat. Nothing else." />
<link rel="icon" href="/favicon.ico" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
8 changes: 0 additions & 8 deletions apps/web/next.config.js

This file was deleted.

18 changes: 11 additions & 7 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"type": "module",
"private": true,
"scripts": {
"dev": "next dev --port 3000",
"build": "next build",
"start": "next start -p ${PORT:-3000}",
"check-types": "next typegen && tsc --noEmit"
"dev": "vite --port 3000",
"build": "vite build",
"start": "vite preview --port 3000",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

vite preview is not a production server.

vite preview is a lightweight static file server intended for locally previewing production builds. If this app will be deployed, you'll need a proper static hosting solution or a server (e.g., serve, nginx, or a Node adapter). Fine if this script is only used during development.

🤖 Prompt for AI Agents
In `@apps/web/package.json` at line 9, The "start" script in package.json
currently uses "vite preview", which is only for local preview and not suitable
as a production server; update the "start" script to use a real static server or
your chosen deployment approach (for example replace the "start" command with a
production server command such as using the "serve" package like "serve -s dist"
after running the build, or configure your Node adapter/nginx/static host
startup command), and ensure corresponding build ("build") and postbuild steps
produce the dist directory before the new "start" command runs; target the
"start" script entry in package.json to make this change.

"check-types": "tsc --noEmit"
},
"dependencies": {
"@repo/api-client": "workspace:*",
Expand All @@ -16,11 +16,10 @@
"@repo/ui": "workspace:*",
"@tailwindcss/postcss": "^4.1.18",
"@tanstack/react-query": "^5.90.21",
"@tanstack/react-router": "^1.120.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"dotenv": "^17.2.4",
"lucide-react": "^0.563.0",
"next": "16.1.6",
"next-themes": "^0.4.6",
"postcss": "^8.5.6",
"radix-ui": "^1.4.3",
Expand All @@ -32,8 +31,13 @@
},
"devDependencies": {
"@repo/typescript-config": "workspace:*",
"@tanstack/react-query-devtools": "^5.91.3",
"@tanstack/react-router-devtools": "^1.120.3",
"@tanstack/router-plugin": "^1.120.3",
"@types/react": "19.2.13",
"@types/react-dom": "19.2.3",
"tw-animate-css": "^1.4.0"
"@vitejs/plugin-react": "^4.5.2",
"tw-animate-css": "^1.4.0",
"vite": "^6.3.5"
}
}
3 changes: 0 additions & 3 deletions apps/web/pnpm-workspace.yaml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 44 additions & 0 deletions apps/web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
import { createRouter, RouterProvider } from "@tanstack/react-router"
import { ThemeProvider } from "next-themes"
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import "@repo/ui/globals.css"
import "./styles/fonts.css"
import { routeTree } from "./routeTree.gen"

const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 60 * 1000,
},
},
})

const router = createRouter({ routeTree })

declare module "@tanstack/react-router" {
interface Register {
router: typeof router
}
}

const rootElement = document.getElementById("root")
if (!rootElement) throw new Error("Root element not found")

createRoot(rootElement).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider
attribute="class"
defaultTheme="dark"
enableSystem
disableTransitionOnChange
>
<RouterProvider router={router} />
</ThemeProvider>
<ReactQueryDevtools initialIsOpen={false} buttonPosition="bottom-right" />
</QueryClientProvider>
</StrictMode>
)
21 changes: 21 additions & 0 deletions apps/web/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createRootRoute, Outlet } from "@tanstack/react-router"
import { lazy, Suspense } from "react"

const TanStackRouterDevtools = import.meta.env.DEV
? lazy(() =>
import("@tanstack/react-router-devtools").then((mod) => ({
default: mod.TanStackRouterDevtools,
}))
)
: () => null

export const Route = createRootRoute({
component: () => (
<>
<Outlet />
<Suspense>
<TanStackRouterDevtools />
</Suspense>
</>
),
})
32 changes: 32 additions & 0 deletions apps/web/src/routes/_authenticated.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { authClient } from "@repo/auth/client"
import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router"
import { useEffect } from "react"

export const Route = createFileRoute("/_authenticated")({
component: AuthenticatedLayout,
})

function AuthenticatedLayout() {
const navigate = useNavigate()
const { data: session, isPending } = authClient.useSession()

useEffect(() => {
if (!isPending && !session) {
navigate({ to: "/login" })
}
}, [isPending, session, navigate])

if (isPending) {
return (
<div className="flex h-screen items-center justify-center">
<div className="text-muted-foreground text-sm">Loading...</div>
</div>
)
}

if (!session) {
return null
}

return <Outlet />
}
25 changes: 25 additions & 0 deletions apps/web/src/routes/_authenticated/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { authClient } from "@repo/auth/client"
import { Button } from "@repo/ui/components/button"
import { createFileRoute } from "@tanstack/react-router"

export const Route = createFileRoute("/_authenticated/")({
component: Home,
})

function Home() {
const { data: session } = authClient.useSession()

return (
<div className="flex h-screen flex-col items-center justify-center gap-4">
<h1 className="text-2xl font-bold">Townhall</h1>
{session && (
<p className="text-muted-foreground text-sm">
Welcome, {session.user.name}
</p>
)}
<Button variant="outline" size="sm" onClick={() => authClient.signOut()}>
Sign out
</Button>
</div>
)
}
Loading