Skip to content

Commit a4e3cf5

Browse files
committed
added setup for vercel deployment
1 parent cfc1800 commit a4e3cf5

2 files changed

Lines changed: 98 additions & 0 deletions

File tree

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy Frontend to Vercel
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
15+
- name: Use Node.js 24
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '24'
19+
20+
- name: Install frontend dependencies
21+
run: |
22+
cd frontend
23+
npm ci
24+
25+
- name: Build frontend
26+
run: |
27+
cd frontend
28+
npm run build
29+
30+
- name: Deploy to Vercel
31+
uses: amondnet/vercel-action@v20
32+
with:
33+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
34+
vercel-args: '--prod'
35+
working-directory: frontend
36+
env:
37+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
38+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,63 @@ cd frontend && npm install
6565
npm run dev
6666
```
6767

68+
## Vercel deployment (detailed)
69+
70+
Follow these exact steps to deploy the `frontend` to Vercel and wire it to GitHub Actions.
71+
72+
1) Create a Vercel token
73+
74+
```bash
75+
# using the Vercel CLI (recommended)
76+
npm i -g vercel
77+
vercel login
78+
vercel tokens create my-token
79+
# copy the printed token value for the next step
80+
```
81+
82+
Or create a token in the Vercel dashboard: Account Settings → Tokens → Create Token.
83+
84+
2) (Optional) Get Org (Team) and Project IDs
85+
86+
- In Vercel: Project → Settings → General → Identify to find the **Project ID**.
87+
- In Vercel: Account or Team → Settings → General → Identify to find the **Team/Org ID**.
88+
89+
You can also fetch these via the API:
90+
91+
```bash
92+
curl -H "Authorization: Bearer $VERCEL_TOKEN" https://api.vercel.com/v1/projects/<project-name>
93+
curl -H "Authorization: Bearer $VERCEL_TOKEN" https://api.vercel.com/v1/teams
94+
```
95+
96+
3) Add GitHub repository secrets
97+
98+
- Go to your GitHub repo → Settings → Secrets and variables → Actions → New repository secret.
99+
- Add:
100+
- `VERCEL_TOKEN` — the token from step 1
101+
- `VERCEL_ORG_ID` — (optional) Team/Org ID
102+
- `VERCEL_PROJECT_ID` — (optional) Project ID
103+
104+
4) Configure the Vercel project build settings (monorepo / `frontend` subfolder)
105+
106+
- In Vercel Project → Settings → Build & Development Settings:
107+
- Root Directory: `frontend`
108+
- Install Command: `npm ci`
109+
- Build Command: `npm run build`
110+
- Output Directory: `dist`
111+
112+
5) Add environment variables in Vercel (production)
113+
114+
- In Vercel Project → Settings → Environment Variables add `VITE_API_URL` and set it to your backend API URL (the URL produced by `sam deploy` or your chosen backend host). Mark it for `Production` and `Preview` as desired.
115+
116+
6) Trigger a deployment
117+
118+
- Push to `main` (Vercel auto-deploys) or run the GitHub Action `Deploy Frontend to Vercel` (Actions → Deploy Frontend to Vercel → Run workflow). The workflow uses the `frontend` folder and the `VERCEL_TOKEN` secret.
119+
120+
7) Confirm the live site
121+
122+
- After the deploy completes, open the Vercel project page to get the production URL (e.g., `https://your-project.vercel.app`).
123+
124+
Notes and security
125+
- Do NOT commit tokens or IDs into your repository. Use GitHub Secrets as shown above. I updated `.github/workflows/deploy-vercel.yml` to read `VERCEL_TOKEN`, `VERCEL_ORG_ID`, and `VERCEL_PROJECT_ID` from secrets.
126+
- If you prefer me to add a short section with CLI/API commands to find IDs automatically, tell me and I will add it.
127+

0 commit comments

Comments
 (0)