Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve trpc usage #2

Merged
merged 3 commits into from
Dec 13, 2024
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ node_modules

# Testing
coverage
/test-results/
/__screenshots__/

# Turbo
.turbo
Expand All @@ -25,6 +27,7 @@ build
dist



# Debug
npm-debug.log*
yarn-debug.log*
Expand Down
35 changes: 18 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,26 @@ The monorepo is powered by Turborepo and Bun workspaces, consisting of:

### Technologies

| Category | Technology | Version |
|-------------------|------------|---------|
| Monorepo | [<img src="https://user-images.githubusercontent.com/4060187/196936104-5797972c-ab10-4834-bd61-0d1e5f442c9c.png" width="40" alt="Turborepo">](https://turbo.build/repo) [Turborepo](https://turbo.build/repo) | 2.3.3 |
| Workspace/Runtime | [<img src="https://bun.sh/logo.svg" width="40" alt="Bun">](https://bun.sh) [Bun](https://bun.sh) | 1.1.38 |
| Linting | [<img src="https://avatars.githubusercontent.com/u/140182603?s=200&v=4" width="40" alt="Biome">](https://biomejs.dev/) [Biome](https://biomejs.dev/) | 1.9.4 |
| Language | [<img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/typescript/typescript.png" width="40" alt="TypeScript">](https://www.typescriptlang.org/) [TypeScript](https://www.typescriptlang.org/) | 5.5.4 |
| Server | [<img src="https://raw.githubusercontent.com/honojs/hono/main/docs/images/hono-logo.png" width="40" alt="Hono">](https://hono.dev) [Hono](https://hono.dev) | 4.6.13 |
| API | [<img src="https://trpc.io/img/logo.svg" width="40" alt="tRPC">](https://trpc.io) [tRPC](https://trpc.io) | 11.0.0-rc.660 |
| Schema Validation | [<img src="https://zod.dev/logo.svg" width="40" alt="Zod">](https://zod.dev) [Zod](https://zod.dev) | 3.23.8 |
| UI Framework | [<img src="https://reactrouter.com/splash/hero-3d-logo.dark.webp" width="40" alt="React Router">](https://reactrouter.com) [React Router](https://reactrouter.com) | 7.0.2 |
| UI Library | [<img src="https://reactjs.org/favicon.ico" width="40" alt="React">](https://react.dev) [React](https://react.dev) | 19.0.0 |
| Styling | [<img src="https://tailwindcss.com/_next/static/media/tailwindcss-mark.3c5441fc7a190fb1800d4a5c7f07ba4b1345a9c8.svg" width="40" alt="Tailwind CSS">](https://tailwindcss.com) [Tailwind CSS](https://tailwindcss.com) | 4.0.0-beta.6 |
| E2E Testing | [<img src="https://playwright.dev/img/playwright-logo.svg" width="40" alt="Playwright">](https://playwright.dev) [Playwright](https://playwright.dev) | 1.49.0 |
| Bundler | [<img src="https://vitejs.dev/logo.svg" width="40" alt="Vite">](https://vitejs.dev) [Vite](https://vitejs.dev) | 6.0.3 |
| CI | [<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Octicons-mark-github.svg/1200px-Octicons-mark-github.svg.png" width="40" alt="GitHub Actions">](https://github.com/features/actions) [GitHub Actions](https://github.com/features/actions) | N/A |
| Category | Technology | Version |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
| Build system | [<img src="https://user-images.githubusercontent.com/4060187/196936104-5797972c-ab10-4834-bd61-0d1e5f442c9c.png" width="40" alt="Turborepo">](https://turbo.build/repo) [Turborepo](https://turbo.build/repo) | 2.3.3 |
| Workspace/runtime | [<img src="https://bun.sh/logo.svg" width="40" alt="Bun">](https://bun.sh) [Bun](https://bun.sh) | 1.1.38 |
| Linting | [<img src="https://avatars.githubusercontent.com/u/140182603?s=200&v=4" width="40" alt="Biome">](https://biomejs.dev/) [Biome](https://biomejs.dev/) | 1.9.4 |
| Language | [<img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/typescript/typescript.png" width="40" alt="TypeScript">](https://www.typescriptlang.org/) [TypeScript](https://www.typescriptlang.org/) | 5.5.4 |
| Server | [<img src="https://raw.githubusercontent.com/honojs/hono/main/docs/images/hono-logo.png" width="40" alt="Hono">](https://hono.dev) [Hono](https://hono.dev) | 4.6.13 |
| API | [<img src="https://trpc.io/img/logo.svg" width="40" alt="tRPC">](https://trpc.io) [tRPC](https://trpc.io) | 11.0.0-rc.660 |
| Schema validation | [<img src="https://zod.dev/logo.svg" width="40" alt="Zod">](https://zod.dev) [Zod](https://zod.dev) | 3.23.8 |
| UI framework | [<img src="https://reactrouter.com/splash/hero-3d-logo.dark.webp" width="40" alt="React Router">](https://reactrouter.com) [React Router](https://reactrouter.com) | 7.0.2 |
| UI library | [<img src="https://reactjs.org/favicon.ico" width="40" alt="React">](https://react.dev) [React](https://react.dev) | 19.0.0 |
| Styling | [<img src="https://tailwindcss.com/_next/static/media/tailwindcss-mark.3c5441fc7a190fb1800d4a5c7f07ba4b1345a9c8.svg" width="40" alt="Tailwind CSS">](https://tailwindcss.com) [Tailwind CSS](https://tailwindcss.com) | 4.0.0-beta.6 |
| E2E testing | [<img src="https://playwright.dev/img/playwright-logo.svg" width="40" alt="Playwright">](https://playwright.dev) [Playwright](https://playwright.dev) | 1.49.0 |
| Integration testing | [<img src="https://raw.githubusercontent.com/vitest-dev/vitest/main/docs/public/logo.svg" width="40" alt="Vitest">](https://vitest.dev) [Vitest (Browser Mode)](https://vitest.dev) | 2.1.8 |
| Bundler | [<img src="https://vitejs.dev/logo.svg" width="40" alt="Vite">](https://vitejs.dev) [Vite](https://vitejs.dev) | 6.0.3 |
| CI | [<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Octicons-mark-github.svg/1200px-Octicons-mark-github.svg.png" width="40" alt="GitHub Actions">](https://github.com/features/actions) [GitHub Actions](https://github.com/features/actions) | N/A |

### Still to come

* Database connectivity - SQL and NoSQL
* Vitest + Vitest Browser Mode
* Docker
* realtime subscriptions
* Containerisation with Docker
* Deployment via CD, powered by Github Actions
2 changes: 1 addition & 1 deletion apps/web/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { client } from 'index';
import { client } from '../server';
import type { Route } from './+types/_index';

export function meta({}: Route.MetaArgs) {
Expand Down
10 changes: 10 additions & 0 deletions apps/web/app/server/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createTRPCClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../../../server/src';

export const client = createTRPCClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3000/trpc',
}),
],
});
10 changes: 0 additions & 10 deletions apps/web/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +0,0 @@
import { createTRPCProxyClient, httpBatchLink } from '@trpc/client';
import type { AppRouter } from '../server/src/router';

export const client = createTRPCProxyClient<AppRouter>({
links: [
httpBatchLink({
url: 'http://localhost:3000/trpc',
}),
],
});
Loading