A production-ready, full-stack ToDo application built with a modern React frontend and a robust Node.js/Express backend. It features end-to-end type safety using oRPC, secure authentication (JWT with HTTP-only cookies and Google OAuth), comprehensive observability using Sentry and OpenTelemetry, and a resilient data layer powered by PostgreSQL and Orchid ORM.
- End-to-End Type Safety: Powered by oRPC, ensuring the frontend and backend share the same data contracts without manual type definitions.
- Modern State Management: Uses TanStack React Query for efficient data fetching, caching, and synchronization.
- Secure Authentication: Combines traditional username/password login with Google OAuth. Uses HTTP-only, SameSite cookies for JWT storage.
- Robust Validation: Request and form validation powered by Zod, integrated directly into oRPC contracts.
- Form Management: Fast and performant forms built with React Hook Form.
- Deep Observability: Fully instrumented with OpenTelemetry for distributed tracing and Sentry for error tracking across the stack.
- PWA Ready: Installable as a Progressive Web Application offering an app-like experience and asset caching.
- Modern Data Access: Database interactions handled by Orchid ORM for a developer-friendly, type-safe query building experience.
Note to self/contributor: Add screenshots or a GIF here showcasing the login flow and the main ToDo dashboard in action. Example format:

- Framework: React 19, Vite
- Language: TypeScript
- RPC & State: oRPC (@orpc/client, @orpc/react-query), TanStack React Query
- Forms: React Hook Form
- Validation: Zod
- Auth:
@react-oauth/google - PWA:
vite-plugin-pwa - Observability:
@sentry/react, OpenTelemetry (@opentelemetry/sdk-trace-web)
- Framework: Node.js, Express
- Language: TypeScript
- RPC Server: oRPC (@orpc/server, @orpc/zod)
- Database: PostgreSQL
- ORM: Orchid ORM,
rake-db - Validation: Zod
- Auth:
jsonwebtoken,google-auth-library,cookie-parser - Observability:
@sentry/node, OpenTelemetry (@opentelemetry/sdk-node)
For a detailed visual breakdown of our oRPC architecture, authentication, and data flow, please see the ARCHITECTURE.md document.
The application follows a Contract-First architecture:
- Shared Contract: A central
contract.tsdefines all API procedures, inputs, and outputs using Zod. - Backend (Express + oRPC): Implements the procedures defined in the contract.
- Frontend (React + React Query): Consumes the backend procedures via a typed oRPC client, with React Query handling caching and loading states.
- Database (PostgreSQL): Interacted with using Orchid ORM.
- Observability Layer: Both client and server independently send traces and errors to Sentry and OpenTelemetry collectors.
ToDoAppJS/
โโโ backend/ # Node.js Express server
โ โโโ db/ # Orchid ORM schema & migrations
โ โโโ src/ # Middleware, oRPC Router & Telemetry
โ โ โโโ contract.ts # Shared oRPC contract definitions
โ โ โโโ router.ts # Backend procedure implementations
โ โโโ index.ts # Entry point & Express setup
โ โโโ package.json # Backend dependencies
โ โโโ tsconfig.json # Backend TS config
โโโ frontend/ # React frontend
โ โโโ src/ # React components, Utils, Main
โ โ โโโ shared/ # Symlinked or copied shared contract
โ โ โ โโโ contract.ts # The same contract used by backend
โ โ โโโ orpc.ts # Frontend oRPC client setup
โ โ โโโ App.tsx # Main application component
โ โ โโโ telemetry.ts # Frontend observability setup
โ โโโ index.html # Entry HTML
โ โโโ package.json # Frontend dependencies
โ โโโ vite.config.ts # Vite configuration
โโโ README.md # Project documentation
PORT=3001
FRONTEND_URL=http://localhost:5173
DATABASE_URL=postgres://user:password@localhost:5432/tododb
JWT_SECRET=your_super_secret_jwt_key
GOOGLE_CLIENT_ID=your_google_oauth_client_id
SENTRY_DSN=your_sentry_dsn_hereVITE_API_URL=http://localhost:3001
VITE_GOOGLE_CLIENT_ID=your_google_oauth_client_id
VITE_SENTRY_DSN=your_sentry_dsn_here- Node.js (v20+ recommended)
- PostgreSQL running locally
- Google Cloud Console account (for OAuth credentials)
Create a new PostgreSQL database for the application.
createdb tododbcd backend
npm install
# Create an .env file with the required variables
cp .env.example .env
# Run database migrations
npm run db:migrate
# Start the backend development server
npm run devcd frontend
npm install
# Create an .env file with the required variables
cp .env.example .env
# Start the frontend development server
npm run dev- Build Process:
- Frontend: Run
npm run buildin thefrontenddirectory. - Backend: Run
npm run buildin thebackenddirectory.
- Frontend: Run
- Database: Run
npm run db:migratein the CI/CD pipeline. - Execution: Start the backend server using
npm run start. - Environment: Ensure all
.envvariables are correctly populated. SetNODE_ENV=productionfor secure cookies.
- Sentry: Captures unhandled exceptions across the stack.
- OpenTelemetry: Distributed tracing from frontend UI down through oRPC procedures to database queries.
The API is defined as procedures in backend/src/contract.ts:
register- Create a new user.login- Session-based login (HTTP-only cookie).logout- Clear session cookie.me- Get current session info.google- Google OAuth authentication.
list- Fetch all todos.create- Add a new todo.toggle- Toggle todo completion status.delete- Remove a todo.
- Secure Cookies: JWTs stored in HTTP-only,
SameSite=lax/nonecookies. - Strict Validation: Zod schemas in oRPC contracts prevent malformed data.
- CORS: Restricts requests to the configured
FRONTEND_URL.
- React Query: Built-in caching, revalidation, and optimistic updates.
- Orchid ORM: Efficient SQL generation and type safety.
- Vite: High-performance bundling.
- Refresh Tokens: Implement rotation for long-lived sessions.
- Pagination: Add cursor-based pagination for todo lists.
- Automated Testing: Vitest for units, Playwright for E2E.
- CI/CD: GitHub Actions for automated lint/test/deploy.