Conversation
Fix server imports
Summary of ChangesHello @zigapk, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces significant architectural enhancements by integrating Hono RPC for type-safe API communication and 'better-auth' for a comprehensive authentication solution. The server-side code has been modularized into distinct feature modules, improving organization and maintainability. Additionally, the database workflow has been streamlined with new Drizzle commands, and a custom Vite plugin now enforces strict architectural boundaries between client and server code. These changes collectively aim to boost developer productivity, improve code quality, and provide better observability through enhanced OpenTelemetry tracing. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant architectural changes, migrating the Hono backend to a feature-based structure and integrating Hono RPC with React Query for type-safe API calls. It also incorporates Better Auth for authentication and refines OpenTelemetry tracing across both frontend and backend. The addition of a Vite plugin to prevent server-side code imports into the client build is a strong security and architectural improvement. Overall, the changes enhance maintainability, type safety, and observability of the application.
There was a problem hiding this comment.
Pull request overview
This PR implements Hono RPC for type-safe client-server communication, integrates Better Auth for authentication, restructures the server into a feature-based architecture, and adds comprehensive testing infrastructure with Vitest.
Changes:
- Adds Hono RPC client with React Query integration for type-safe API calls
- Implements Better Auth with email/password authentication and database-backed sessions
- Refactors server architecture into features (auth, demo, health, otel) with dedicated middleware
- Adds Vitest testing infrastructure with PGlite for isolated database tests
- Creates Vite plugin to enforce architectural boundaries (prevent client from importing server code)
Reviewed changes
Copilot reviewed 60 out of 66 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| web/lib/api.ts | Type-safe Hono RPC client setup using hono-rpc-query |
| web/lib/auth-client.ts | Better Auth React client configuration |
| web/router.tsx | Adds QueryClientProvider for React Query integration |
| web/components/auth-demo.tsx | Demo component showcasing authentication flow with tracing |
| web/components/ui/input.tsx | New input component following shadcn pattern |
| server/server.ts | Refactored entry point with feature-based routing and middleware composition |
| server/lib/auth.ts | Better Auth configuration with Drizzle adapter and OTel instrumentation |
| server/lib/router.ts | Typed Hono router factory with middleware types |
| server/middleware/auth.middleware.ts | Session and authentication middleware with request context |
| server/middleware/db.middleware.ts | Database injection middleware |
| server/features/demo/routes/demo-trace.ts | Demo route with Zod validation and parameterized testing |
| server/features/auth/routes/handler.ts | Better Auth handler with OpenTelemetry span enrichment |
| server/database/index.ts | Database connection with OTel instrumentation |
| server/database/schema/auth.ts | Auto-generated Better Auth schema tables |
| server/utils/testing/* | Comprehensive testing utilities (test-db, test-app, test-auth, test-users) |
| vite-plugins.ts | Custom Vite plugin to prevent server imports in client code |
| shared/tracing.ts | Shared OpenTelemetry tracing utilities for client and server |
| scripts/dev.ts | Development orchestrator with dynamic port allocation |
| AGENTS.md | New AI agent guidelines for the codebase |
Comments suppressed due to low confidence (1)
server/database/index.ts:5
- The database schema is not passed to the drizzle instance. This will prevent Drizzle's relational query API from working. The schema should be imported and passed as a configuration option to the drizzle function, similar to how it's done in the test database setup.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.