apps/web
-
-
+
+
{JSON.stringify(users, null, 2)}
diff --git a/apps/web/components/theme-provider.tsx b/apps/web/components/theme-provider.tsx
index 22167ae..d37aeef 100644
--- a/apps/web/components/theme-provider.tsx
+++ b/apps/web/components/theme-provider.tsx
@@ -1,20 +1,16 @@
"use client"
import * as React from "react"
-import { ConvexProvider, ConvexReactClient } from "convex/react";
+import { ConvexProvider, ConvexReactClient } from "convex/react"
import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes"
-const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL || "");
+const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL || "")
function ThemeProvider({
children,
...props
}: React.ComponentProps
) {
- return (
-
- {children}
-
- )
+ return {children}
}
function isTypingTarget(target: EventTarget | null) {
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index c19ac40..b58cfa9 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -4,7 +4,7 @@
"paths": {
"@/*": ["./*"],
"@workspace/ui/*": ["../../packages/ui/src/*"],
- "@workspace/backend/*": ["../../packages/backend/convex/*"],
+ "@workspace/backend/*": ["../../packages/backend/convex/*"]
},
"plugins": [
{
diff --git a/apps/widget/app/page.tsx b/apps/widget/app/page.tsx
index 1d4e870..cc1ee97 100644
--- a/apps/widget/app/page.tsx
+++ b/apps/widget/app/page.tsx
@@ -2,19 +2,17 @@
import { useMutation, useQuery } from "convex/react"
import { api } from "@workspace/backend/_generated/api"
-import { Button } from "@workspace/ui/components/button";
+import { Button } from "@workspace/ui/components/button"
export default function Page() {
const users = useQuery(api.users.getMany)
- const addUser = useMutation(api.users.add);
+ const addUser = useMutation(api.users.add)
return (
-
+
apps/widget
-
-
+
+
{JSON.stringify(users, null, 2)}
diff --git a/apps/widget/components/theme-provider.tsx b/apps/widget/components/theme-provider.tsx
index 373f5a3..371ac85 100644
--- a/apps/widget/components/theme-provider.tsx
+++ b/apps/widget/components/theme-provider.tsx
@@ -2,19 +2,15 @@
import * as React from "react"
import { ThemeProvider as NextThemesProvider, useTheme } from "next-themes"
-import { ConvexReactClient, ConvexProvider } from "convex/react";
+import { ConvexReactClient, ConvexProvider } from "convex/react"
-const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL || "");
+const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL || "")
function ThemeProvider({
children,
...props
}: React.ComponentProps
) {
- return (
-
- {children}
-
- )
+ return {children}
}
function isTypingTarget(target: EventTarget | null) {
diff --git a/apps/widget/tsconfig.json b/apps/widget/tsconfig.json
index c19ac40..b58cfa9 100644
--- a/apps/widget/tsconfig.json
+++ b/apps/widget/tsconfig.json
@@ -4,7 +4,7 @@
"paths": {
"@/*": ["./*"],
"@workspace/ui/*": ["../../packages/ui/src/*"],
- "@workspace/backend/*": ["../../packages/backend/convex/*"],
+ "@workspace/backend/*": ["../../packages/backend/convex/*"]
},
"plugins": [
{
diff --git a/packages/backend/convex/schema.ts b/packages/backend/convex/schema.ts
index d7b91f3..f721723 100644
--- a/packages/backend/convex/schema.ts
+++ b/packages/backend/convex/schema.ts
@@ -1,8 +1,8 @@
-import { defineSchema, defineTable } from "convex/server";
-import { v } from "convex/values";
+import { defineSchema, defineTable } from "convex/server"
+import { v } from "convex/values"
export default defineSchema({
- users: defineTable({
- name: v.string(),
- })
-});
\ No newline at end of file
+ users: defineTable({
+ name: v.string(),
+ }),
+})
diff --git a/packages/backend/convex/users.ts b/packages/backend/convex/users.ts
index 052f8a4..0111a28 100644
--- a/packages/backend/convex/users.ts
+++ b/packages/backend/convex/users.ts
@@ -1,21 +1,21 @@
-import { query, mutation } from "./_generated/server";
+import { query, mutation } from "./_generated/server"
export const getMany = query({
- args: {},
- handler: async (ctx) => {
- const users = await ctx.db.query("users").collect();
+ args: {},
+ handler: async (ctx) => {
+ const users = await ctx.db.query("users").collect()
- return users;
- },
-});
+ return users
+ },
+})
export const add = mutation({
- args: {},
- handler: async (ctx) => {
- const userId = await ctx.db.insert("users", {
- name: "RISHII",
- });
+ args: {},
+ handler: async (ctx) => {
+ const userId = await ctx.db.insert("users", {
+ name: "RISHII",
+ })
- return userId;
- },
-});
\ No newline at end of file
+ return userId
+ },
+})
diff --git a/packages/backend/tsconfig.json b/packages/backend/tsconfig.json
index cce0033..84b35d0 100644
--- a/packages/backend/tsconfig.json
+++ b/packages/backend/tsconfig.json
@@ -3,9 +3,9 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
- "@workspace/backend/*": ["./convex/*"],
- },
+ "@workspace/backend/*": ["./convex/*"]
+ }
},
"include": ["."],
"exclude": ["node_modules"]
-}
\ No newline at end of file
+}
From ac7eda89ea8b0ee28f740a7b7d2d6daea4f860d3 Mon Sep 17 00:00:00 2001
From: RISHII <93994298+RISHII7@users.noreply.github.com>
Date: Mon, 29 Jun 2026 21:52:56 +0530
Subject: [PATCH 3/5] fix(ci): exclude Convex auto-generated files from
Prettier check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add packages/backend/convex/_generated/ and convex/README.md to
.prettierignore — these files are auto-generated by convex dev and
should not be subject to Prettier formatting rules.
---
.prettierignore | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/.prettierignore b/.prettierignore
index 461b008..5539be9 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -4,4 +4,7 @@ node_modules/
.turbo/
coverage/
pnpm-lock.yaml
-.pnpm-store/
\ No newline at end of file
+.pnpm-store/
+# Convex auto-generated files
+packages/backend/convex/_generated/
+packages/backend/convex/README.md
\ No newline at end of file
From 75c0e100e7792514e4446a0ce4d6c7bf204c5f1a Mon Sep 17 00:00:00 2001
From: RISHII <93994298+RISHII7@users.noreply.github.com>
Date: Mon, 29 Jun 2026 21:57:46 +0530
Subject: [PATCH 4/5] fix(ci): add NEXT_PUBLIC_CONVEX_URL to CodeQL build step
CodeQL workflow runs pnpm build without NEXT_PUBLIC_CONVEX_URL set,
causing ConvexReactClient to receive an empty URL and fail. Add the
dev deployment URL to the build env, matching ci.yml and release.yml.
Co-Authored-By: Claude Sonnet 4.6
---
.github/workflows/codeql.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 0b20cbd..9538516 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -53,6 +53,8 @@ jobs:
- name: Build
run: pnpm build
+ env:
+ NEXT_PUBLIC_CONVEX_URL: https://terrific-llama-923.convex.cloud
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
From 221fb5a95b64eebffa39e377786a71ba0aceccc4 Mon Sep 17 00:00:00 2001
From: RISHII <93994298+RISHII7@users.noreply.github.com>
Date: Mon, 29 Jun 2026 22:06:08 +0530
Subject: [PATCH 5/5] chore: prepare release v0.2.0
Update CHANGELOG.md and README.md for the v0.2.0 release.
CHANGELOG:
- Add [0.2.0] section detailing the Convex backend integration:
packages/backend scaffolding, server functions, CI env var additions,
and .prettierignore updates. Document technical decisions.
- Update compare links to point v0.2.0 as the latest release.
README:
- Add Convex badge to header
- Add Real-Time Backend to Features list
- Add packages/backend to Architecture diagram
- Add Convex row to Tech Stack table
- Update Environment Variables section with NEXT_PUBLIC_CONVEX_URL
- Update dev commands to include --filter backend dev
- Update Project Structure tree with backend/convex layout
- Add @workspace/backend to Packages section with usage example
Co-Authored-By: Claude Sonnet 4.6
---
CHANGELOG.md | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++-
README.md | 62 +++++++++++++++++++++++++++++++++++++---------
2 files changed, 120 insertions(+), 12 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 464c7d8..ffd0f07 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
---
+## [0.2.0] - 2026-06-29
+
+### Overview
+
+This release integrates **Convex** as the real-time backend for the Echo monorepo.
+A new `@workspace/backend` package encapsulates all Convex schema definitions and
+server-side functions, and both `apps/web` and `apps/widget` are wired to the live
+Convex deployment via `ConvexProvider` and the generated TypeScript API.
+
+---
+
+### Added
+
+#### `packages/backend` — New Convex workspace package
+
+- Scaffolded `@workspace/backend` as a dedicated Convex workspace package
+- `convex/schema.ts` — database schema with a `users` table (`name: string`) defined
+ using Convex's `defineSchema` and `defineTable` helpers
+- `convex/users.ts` — two server functions:
+ - `getMany` — `query` that fetches all users from the database
+ - `add` — `mutation` that inserts a new user record (`name: "RISHII"`)
+- `convex/_generated/` — committed auto-generated TypeScript API types (`api.d.ts`,
+ `api.js`, `dataModel.d.ts`, `server.d.ts`, `server.js`) for full type safety across
+ the monorepo without requiring a running Convex dev server in CI
+- `package.json` — workspace package definition (`name: @workspace/backend`,
+ `convex: ^1.42.0` runtime dependency, `dev` and `setup` scripts)
+- `tsconfig.json` — TypeScript configuration extending `@workspace/typescript-config`
+- `.gitignore` — excludes `.env.local` (contains deployment secrets)
+- `convex/README.md` — Convex-generated quickstart guide (excluded from Prettier)
+
+#### Convex client integration in `apps/web` and `apps/widget`
+
+- Added `@workspace/backend: workspace:*` and `convex: ^1.42.0` to both app
+ `package.json` files
+- Added `@workspace/backend/*` TypeScript path alias in both `tsconfig.json` files,
+ pointing to `packages/backend/convex/*` for generated API type imports
+- `components/theme-provider.tsx` — replaced static `NextThemesProvider` wrapper with
+ `ConvexProvider` backed by `ConvexReactClient`, reading from `NEXT_PUBLIC_CONVEX_URL`
+ environment variable
+- `app/page.tsx` — replaced static math function demo with live Convex hooks:
+ - `useQuery(api.users.getMany)` — subscribes to real-time user list
+ - `useMutation(api.users.add)` — triggers user insertion via a button click
+
+#### CI/tooling improvements
+
+- Added `NEXT_PUBLIC_CONVEX_URL` environment variable to the `build` step in
+ `ci.yml`, `release.yml`, and `codeql.yml` — required for `ConvexReactClient`
+ to initialise with a valid URL during `next build` in CI environments
+- Added `packages/backend/convex/_generated/` and `packages/backend/convex/README.md`
+ to `.prettierignore` — auto-generated files should not be subject to formatting rules
+
+---
+
+### Technical Decisions
+
+- **`convex/_generated/` committed to source control** — Generated API types provide
+ full TypeScript safety across the monorepo without requiring every developer to run
+ `convex dev` before getting type completions. Files are excluded from Prettier.
+- **`ConvexProvider` in theme-provider** — Centralises the Convex client provider at
+ the layout level so all pages and components have access to real-time hooks without
+ additional wrapper boilerplate.
+- **`NEXT_PUBLIC_CONVEX_URL` as build-time env** — Convex's React client requires a
+ valid URL at module initialisation; adding it to CI workflows prevents static page
+ prerender failures in environments where `.env.local` is not present.
+
+---
+
## [0.1.1] - 2026-06-28
### Fixed
@@ -182,6 +249,7 @@ Initial release of **Echo** — an enterprise-grade full-stack monorepo platform
---
-[Unreleased]: https://github.com/RISHII7/echo/compare/v0.1.1...HEAD
+[Unreleased]: https://github.com/RISHII7/echo/compare/v0.2.0...HEAD
+[0.2.0]: https://github.com/RISHII7/echo/compare/v0.1.1...v0.2.0
[0.1.1]: https://github.com/RISHII7/echo/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/RISHII7/echo/releases/tag/v0.1.0
diff --git a/README.md b/README.md
index d4619bf..13d3642 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@
[](https://nextjs.org)
[](https://turbo.build)
[](https://tailwindcss.com)
+[](https://convex.dev)
[](CONTRIBUTING.md)
[Report Bug](https://github.com/RISHII7/echo/issues/new?template=bug_report.yml) · [Request Feature](https://github.com/RISHII7/echo/issues/new?template=feature_request.yml) · [Documentation](https://github.com/RISHII7/echo/wiki)
@@ -56,7 +57,8 @@ Echo is a production-ready, full-stack monorepo platform engineered for enterpri
## Features
- **Monorepo Architecture** — Turborepo with remote caching, task pipelines, and workspace dependency graph
-- **Type Safety** — End-to-end TypeScript with strict mode across all packages
+- **Real-Time Backend** — Convex reactive database with live queries and server mutations
+- **Type Safety** — End-to-end TypeScript with strict mode and generated API types across all packages
- **Design System** — Shared UI component library built on shadcn/ui and Radix primitives
- **Performance** — Next.js Turbopack, React Server Components, and Tailwind CSS v4
- **Code Quality** — ESLint 9, Prettier, and TypeScript strict checks enforced on every commit
@@ -74,13 +76,14 @@ echo/
│ ├── web/ # Primary Next.js application
│ └── widget/ # Embeddable widget application
├── packages/
+│ ├── backend/ # Convex real-time backend (schema + server functions)
│ ├── ui/ # Shared component library
│ ├── math/ # Shared utilities
│ ├── eslint-config/ # Shared ESLint configuration
│ └── typescript-config/ # Shared TypeScript configuration
```
-The monorepo uses a **workspace dependency graph** where apps consume packages, and packages can depend on other packages. Turborepo ensures tasks run in topological order with caching at every layer.
+The monorepo uses a **workspace dependency graph** where apps consume packages, and packages can depend on other packages. Turborepo ensures tasks run in topological order with caching at every layer. The `@workspace/backend` package provides a shared Convex client that both apps import for real-time data access.
---
@@ -93,6 +96,7 @@ The monorepo uses a **workspace dependency graph** where apps consume packages,
| UI Library | React 19 |
| Styling | Tailwind CSS 4 |
| Components | shadcn/ui + Radix UI |
+| Backend | Convex (real-time DB) |
| Icons | Lucide React |
| Monorepo | Turborepo 2 |
| Package Manager | pnpm 10 |
@@ -129,9 +133,19 @@ pnpm dev
### Environment Variables
-| Variable | Description | Required |
-| --------------------- | --------------------------------- | -------- |
-| `NEXT_PUBLIC_APP_URL` | Public URL of the web application | Yes |
+Create `apps/web/.env.local` and `apps/widget/.env.local` with the following:
+
+| Variable | Description | Required |
+| ------------------------ | --------------------------------- | -------- |
+| `NEXT_PUBLIC_CONVEX_URL` | Convex deployment URL | Yes |
+| `NEXT_PUBLIC_APP_URL` | Public URL of the web application | No |
+
+To get your `NEXT_PUBLIC_CONVEX_URL`, run `pnpm --filter backend dev` and copy the deployment URL from the Convex dashboard, or from `packages/backend/.env.local` after the first `convex dev` run.
+
+```bash
+# apps/web/.env.local
+NEXT_PUBLIC_CONVEX_URL=https://.convex.cloud
+```
---
@@ -140,15 +154,16 @@ pnpm dev
### Commands
```bash
-pnpm dev # Start all apps in development mode
-pnpm build # Build all packages and apps
-pnpm lint # Run linting across all workspaces
-pnpm typecheck # Run type checking across all workspaces
-pnpm format # Format all files with Prettier
+pnpm dev # Start all apps in development mode (Next.js + Convex)
+pnpm build # Build all packages and apps
+pnpm lint # Run linting across all workspaces
+pnpm typecheck # Run type checking across all workspaces
+pnpm format # Format all files with Prettier
-# Target a specific app
+# Target a specific workspace
pnpm --filter web dev
pnpm --filter widget dev
+pnpm --filter backend dev # Start Convex dev server only
```
### Branch Strategy
@@ -202,6 +217,11 @@ echo/
│ ├── web/ # Next.js web application
│ └── widget/ # Embeddable widget
├── packages/
+│ ├── backend/ # Convex real-time backend
+│ │ └── convex/
+│ │ ├── _generated/ # Auto-generated TypeScript API types
+│ │ ├── schema.ts # Database schema definitions
+│ │ └── users.ts # User query & mutation functions
│ ├── ui/ # Shared component library
│ ├── math/ # Shared utilities
│ ├── eslint-config/ # ESLint config presets
@@ -217,6 +237,26 @@ echo/
## Packages
+### `@workspace/backend`
+
+Convex real-time backend package. Provides the database schema and server functions, with auto-generated TypeScript types for end-to-end type safety.
+
+```tsx
+import { api } from "@workspace/backend/_generated/api"
+import { useQuery, useMutation } from "convex/react"
+
+const users = useQuery(api.users.getMany)
+const addUser = useMutation(api.users.add)
+```
+
+To start the Convex dev server:
+
+```bash
+pnpm --filter backend dev
+# or from repo root:
+pnpm dev # starts all apps including Convex
+```
+
### `@workspace/ui`
Shared component library built on shadcn/ui and Radix UI primitives.