Skip to content

Commit e509ad2

Browse files
author
MStarRobotics
committed
chore(ci,env): align env variables and workflows
- Clean .env (remove embedded JSON), add VITE_GOOGLE_OAUTH_CLIENT_ID and server GOOGLE_OAUTH_CLIENT_ID - Update .env.example with VITE_GOOGLE_OAUTH_CLIENT_ID and docs - Harden static-analysis CI to include both frontend and backend envs - Expand .gitignore to exclude all Firebase service account keys and CLI state - Track firebase.json hosting config Build/lint pass locally; Firebase service account files now protected from git.
1 parent faa4e93 commit e509ad2

File tree

7 files changed

+147
-84
lines changed

7 files changed

+147
-84
lines changed

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ VITE_FIREBASE_MEASUREMENT_ID=
1515
# reCAPTCHA v2 site key for phone auth (invisible or container-based)
1616
VITE_FIREBASE_RECAPTCHA_SITE_KEY=
1717

18+
# Google Identity (frontend sign-in)
19+
VITE_GOOGLE_OAUTH_CLIENT_ID=
20+
1821
# Backend / server configuration
1922
PORT=4000
2023
JWT_SECRET=update-this-secret

.github/workflows/static-analysis.yml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,36 @@ jobs:
2828
cache: 'npm'
2929

3030
- name: Create CI .env
31-
env:
32-
VITE_FIREBASE_API_KEY: ${{ secrets.VITE_FIREBASE_API_KEY }}
33-
VITE_FIREBASE_AUTH_DOMAIN: ${{ secrets.VITE_FIREBASE_AUTH_DOMAIN }}
34-
VITE_FIREBASE_PROJECT_ID: ${{ secrets.VITE_FIREBASE_PROJECT_ID }}
35-
VITE_FIREBASE_STORAGE_BUCKET: ${{ secrets.VITE_FIREBASE_STORAGE_BUCKET }}
36-
VITE_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.VITE_FIREBASE_MESSAGING_SENDER_ID }}
37-
VITE_FIREBASE_APP_ID: ${{ secrets.VITE_FIREBASE_APP_ID }}
38-
VITE_FIREBASE_MEASUREMENT_ID: ${{ secrets.VITE_FIREBASE_MEASUREMENT_ID }}
39-
VITE_GEMINI_API_KEY: ${{ secrets.VITE_GEMINI_API_KEY }}
4031
run: |
41-
{
42-
echo "VITE_FIREBASE_API_KEY=$VITE_FIREBASE_API_KEY"
43-
echo "VITE_FIREBASE_AUTH_DOMAIN=$VITE_FIREBASE_AUTH_DOMAIN"
44-
echo "VITE_FIREBASE_PROJECT_ID=$VITE_FIREBASE_PROJECT_ID"
45-
echo "VITE_FIREBASE_STORAGE_BUCKET=$VITE_FIREBASE_STORAGE_BUCKET"
46-
echo "VITE_FIREBASE_MESSAGING_SENDER_ID=$VITE_FIREBASE_MESSAGING_SENDER_ID"
47-
echo "VITE_FIREBASE_APP_ID=$VITE_FIREBASE_APP_ID"
48-
echo "VITE_FIREBASE_MEASUREMENT_ID=$VITE_FIREBASE_MEASUREMENT_ID"
49-
echo "VITE_GEMINI_API_KEY=$VITE_GEMINI_API_KEY"
50-
} > .env
32+
cat <<'EOF' > .env
33+
# Frontend (Vite)
34+
VITE_FIREBASE_API_KEY=
35+
VITE_FIREBASE_AUTH_DOMAIN=
36+
VITE_FIREBASE_PROJECT_ID=
37+
VITE_FIREBASE_STORAGE_BUCKET=
38+
VITE_FIREBASE_MESSAGING_SENDER_ID=
39+
VITE_FIREBASE_APP_ID=
40+
VITE_FIREBASE_MEASUREMENT_ID=
41+
VITE_GOOGLE_OAUTH_CLIENT_ID=
42+
VITE_GEMINI_API_KEY=
43+
VITE_PUBLIC_ONCHAINKIT_API_KEY=
44+
VITE_BASE_RPC_URL=https://sepolia.base.org
45+
VITE_FRACTAL_RECIPE_CONTRACT_ADDRESS=
46+
VITE_FRACTAL_RECIPE_DEPLOY_BLOCK=0
47+
48+
# Backend (server)
49+
PORT=4000
50+
JWT_SECRET=ci-secret
51+
JWT_TTL_SECONDS=3600
52+
CORS_ORIGIN=http://localhost:5173
53+
FIREBASE_PROJECT_ID=ci
54+
FIREBASE_CLIENT_EMAIL=
55+
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----\n"
56+
GOOGLE_OAUTH_CLIENT_ID=
57+
PASSWORD_MIN_LENGTH=10
58+
PWD_RESET_OTP_TTL_MS=600000
59+
PWD_RESET_MAX_ATTEMPTS=5
60+
EOF
5161
5262
- name: Install dependencies
5363
run: npm install

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ dist-ssr
1414
.env
1515
.env.*
1616

17-
# Firebase service account (keep out of git)
18-
zero-e6888-firebase-adminsdk-fbsvc-c1f10a9df2.json
17+
# Firebase service accounts (keep out of git)
18+
zero-e6888-firebase-adminsdk-*.json
19+
20+
# Firebase CLI local state
21+
.firebase/
22+
.firebaserc
1923

2024
# Editor directories and files
2125
.vscode/*

README.md

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -95,42 +95,49 @@ These can be wired into UI buttons as needed. For SMS delivery of OTP in server
9595

9696
## How to operate and run
9797

98-
1) Install toolchain and dependencies
99-
```bash
100-
npm ci
101-
```
98+
1. Install toolchain and dependencies
10299

103-
2) Populate `.env` (copy from `.env.example`). For Firebase Admin, escape newlines in `FIREBASE_PRIVATE_KEY` using `\n`.
100+
```bash
101+
npm ci
102+
```
104103

105-
3) Local quality gates
106-
```bash
107-
npm run lint
108-
npm run typecheck
109-
npm run build
110-
```
104+
2. Populate `.env` (copy from `.env.example`). For Firebase Admin, escape newlines in `FIREBASE_PRIVATE_KEY` using `\n`.
111105

112-
4) Start backend and frontend (separate terminals)
113-
```bash
114-
npm run server # http://localhost:4000
115-
npm run dev # http://localhost:5173
116-
```
106+
3. Run local quality gates
117107

118-
5) Test APIs quickly (optional)
119-
```bash
120-
curl http://localhost:4000/health
121-
```
108+
```bash
109+
npm run lint
110+
npm run typecheck
111+
npm run build
112+
```
122113

123-
6) E2E auth smoke test (server must be running)
124-
```bash
125-
npm run test:e2e-auth
126-
```
114+
4. Start backend and frontend (separate terminals)
115+
116+
```bash
117+
npm run server # http://localhost:4000
118+
npm run dev # http://localhost:5173
119+
```
120+
121+
5. Test APIs quickly (optional)
122+
123+
```bash
124+
curl http://localhost:4000/health
125+
```
126+
127+
6. Execute the E2E auth smoke test (server must be running)
128+
129+
```bash
130+
npm run test:e2e-auth
131+
```
127132

128133
Postman:
134+
129135
- Import `postman/FractalAuth.postman_collection.json`
130136
- Set `baseUrl` to your server (default `http://localhost:4000`)
131137
- Use `token` variable after logging in to call protected endpoints
132138

133139
Secrets hygiene:
140+
134141
- `.env` and service-account JSON must not be committed (already git-ignored).
135142
- Use GitHub Actions Secrets for CI.
136143
- Rotate leaked keys immediately.
@@ -148,4 +155,5 @@ Vite + React + TypeScript • Tailwind • viem/wagmi • OnchainKit • Express
148155
- Enable GitHub’s secret scanning and CodeQL (workflows included).
149156

150157
## License
158+
151159
Creative Commons BY‑NC‑SA 4.0. See `LICENSE.md`.

firebase.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"hosting": {
3+
"site": "yourecipegenerator",
4+
"public": "dist",
5+
"ignore": [
6+
"firebase.json",
7+
"**/.*",
8+
"**/node_modules/**"
9+
],
10+
"rewrites": [
11+
{ "source": "**", "destination": "/index.html" }
12+
]
13+
}
14+
}

package-lock.json

Lines changed: 62 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"cors": "^2.8.5",
2121
"dotenv": "^16.4.5",
2222
"express": "^5.1.0",
23-
"firebase": "^12.4.0",
23+
"firebase": "^12.5.0",
2424
"firebase-admin": "^13.5.0",
2525
"helmet": "^7.1.0",
2626
"jsonwebtoken": "^9.0.2",

0 commit comments

Comments
 (0)