Skip to content

Commit 3f78615

Browse files
committed
Configure Vercel Convex deployment
1 parent d0e8d66 commit 3f78615

8 files changed

Lines changed: 75 additions & 21 deletions

File tree

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,27 @@ bun run dev
103103
Required frontend env vars:
104104

105105
- `NEXT_PUBLIC_MAPBOX_TOKEN`
106+
- `NEXT_PUBLIC_API_URL` (use `https://bluedocs-api.onrender.com` for the hosted backend)
106107
- `NEXT_PUBLIC_CONVEX_URL` (from Convex dashboard / `convex dev`)
107108

109+
## Redeploying the Frontend
110+
111+
The old `bluedocs-ui.vercel.app` deployment cannot be repaired without access to its Vercel project. To redeploy, create a new Vercel project from this repo with `frontend` as the project root.
112+
113+
The frontend includes `frontend/vercel.json`, which sets:
114+
115+
```bash
116+
npx convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'bun run build'
117+
```
118+
119+
Configure these Vercel environment variables:
120+
121+
- `NEXT_PUBLIC_MAPBOX_TOKEN` — new Mapbox public token.
122+
- `NEXT_PUBLIC_API_URL``https://bluedocs-api.onrender.com`.
123+
- `CONVEX_DEPLOY_KEY` — Convex production deploy key for the new Convex deployment.
124+
125+
Convex auth is intentionally simple: users sign up or sign in with email and password, and no email verification or external provider is required.
126+
108127
## Team
109128

110129
Built by **Krish** (backend + AI) and **Partner** (frontend + UX).

frontend/.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
NEXT_PUBLIC_MAPBOX_TOKEN=
2+
NEXT_PUBLIC_API_URL=https://bluedocs-api.onrender.com
3+
NEXT_PUBLIC_CONVEX_URL=
4+
5+
# Vercel build-time only. Do not expose this to the browser.
6+
CONVEX_DEPLOY_KEY=

frontend/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ yarn-error.log*
3232

3333
# env files (can opt-in for committing if needed)
3434
.env*
35+
!.env.example
3536

3637
# vercel
3738
.vercel

frontend/README.md

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,54 @@
1-
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
1+
# BlueDocs Frontend
22

3-
## Getting Started
3+
Next.js app for the BlueDocs map dashboard.
44

5-
First, run the development server:
5+
## Local Setup
66

77
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
8+
bun install
9+
cp .env.example .env.local
1510
```
1611

17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
12+
Set these values in `.env.local`:
1813

19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
14+
- `NEXT_PUBLIC_MAPBOX_TOKEN`: Mapbox public token with access to Mapbox styles.
15+
- `NEXT_PUBLIC_API_URL`: BlueDocs API URL. Use `https://bluedocs-api.onrender.com` for the hosted backend or `http://localhost:8000` for local backend development.
16+
- `NEXT_PUBLIC_CONVEX_URL`: Convex deployment URL from `bun run convex:dev` or the Convex dashboard.
2017

21-
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
18+
Then run:
2219

23-
## Learn More
20+
```bash
21+
bun run dev
22+
```
23+
24+
## Simple Convex Auth
25+
26+
Authentication intentionally stays simple:
27+
28+
- Users create an account with email and password.
29+
- Sign-up immediately creates a session.
30+
- There is no email verification, no magic link, and no external auth provider.
31+
- Passwords must be at least 8 characters.
32+
- Saved projects are stored per signed-in Convex user.
2433

25-
To learn more about Next.js, take a look at the following resources:
34+
The auth functions live in `convex/accounts.ts`, and the session/password helpers live in `convex/lib/auth.ts`.
2635

27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
36+
## Vercel Redeploy
2937

30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
38+
Create a new Vercel project from this repo and set the project root to `frontend`.
3139

32-
## Deploy on Vercel
40+
Set Vercel environment variables:
41+
42+
- `NEXT_PUBLIC_MAPBOX_TOKEN`: New Mapbox public token.
43+
- `NEXT_PUBLIC_API_URL`: `https://bluedocs-api.onrender.com`.
44+
- `CONVEX_DEPLOY_KEY`: Convex production deploy key for the new Convex deployment.
45+
46+
The Vercel build command is configured in `vercel.json`:
47+
48+
```bash
49+
npx convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'bun run build'
50+
```
3351

34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
52+
That command deploys Convex functions first, injects `NEXT_PUBLIC_CONVEX_URL` for the frontend build, then runs the Next.js production build.
3553

36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
54+
If email notifications are needed, set `RESEND_API_KEY` in the Convex deployment environment. Without it, notification sending is skipped.

frontend/bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/convex/_generated/api.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
import type * as accounts from "../accounts.js";
1212
import type * as lib_auth from "../lib/auth.js";
13+
import type * as notifications from "../notifications.js";
1314
import type * as projects from "../projects.js";
1415

1516
import type {
@@ -21,6 +22,7 @@ import type {
2122
declare const fullApi: ApiFromModules<{
2223
accounts: typeof accounts;
2324
"lib/auth": typeof lib_auth;
25+
notifications: typeof notifications;
2426
projects: typeof projects;
2527
}>;
2628

frontend/convex/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"jsx": "react-jsx",
1212
"skipLibCheck": true,
1313
"allowSyntheticDefaultImports": true,
14+
"types": ["node"],
1415

1516
/* These compiler options are required by Convex */
1617
"target": "ESNext",

frontend/vercel.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://openapi.vercel.sh/vercel.json",
3+
"framework": "nextjs",
4+
"installCommand": "bun install",
5+
"buildCommand": "npx convex deploy --cmd-url-env-var-name NEXT_PUBLIC_CONVEX_URL --cmd 'bun run build'"
6+
}

0 commit comments

Comments
 (0)