Skip to content

Commit 5ef4276

Browse files
authored
Merge pull request #9 from paccloud/fix/oauth-authentication-config
fix: Remove quotes from Stack Auth environment variables
2 parents 9627b6b + a51ef33 commit 5ef4276

5 files changed

Lines changed: 288 additions & 12 deletions

File tree

CHANGELOG.md

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Vercel Web Analytics integration for tracking application usage
12+
- Comprehensive fish data validation testing suite
13+
- Data validation module for ensuring fish data integrity
14+
15+
### Fixed
16+
- Contributor profile OAuth authentication flow
17+
- Mobile menu navigation issues
18+
- Yield range return format (now returns array instead of string)
19+
- Neon database fish data import including tuna and PDF species
20+
21+
### Data
22+
- Imported Tuna and Albacore profiles to fish_data_v3
23+
- Updated Pacific Halibut conversion yields
24+
- Normalized Walleye Pollock roe yield to integer values
25+
- Completed comprehensive fish yield data from MAB-37 PDF research publication
26+
27+
## [1.0.0] - 2025-12-16
28+
29+
### Added
30+
- React 19 + Vite 7 frontend with modern build tooling
31+
- Tailwind CSS styling with responsive design
32+
- User authentication system with JWT and bcrypt password hashing
33+
- Save and export fish yield calculations
34+
- Custom user yield data management with Excel/CSV upload support
35+
- Contributor profile system for data transparency
36+
- User data management interface with full CRUD operations
37+
- About page with project mission and Local Catch Network information
38+
- Data sources transparency page documenting MAB-37 research
39+
- Comprehensive REST API with 15 endpoints
40+
- Authentication: `/api/register`, `/api/login`
41+
- Calculations: `/api/saved-calcs`, `/api/save-calc`, `/api/export-calcs`
42+
- User Data: `/api/user-data` (GET/POST/PUT/DELETE), `/api/upload-data`, `/api/export-user-data`
43+
- Contributors: `/api/contributors`, `/api/contributor`, `/api/contributor/me`
44+
- Vercel serverless deployment support
45+
- Neon PostgreSQL database integration
46+
- SQLite to PostgreSQL migration scripts
47+
- Comprehensive documentation:
48+
- API documentation (`docs/API.md`)
49+
- Architecture documentation (`docs/ARCHITECTURE.md`)
50+
- Deployment guide (`DEPLOYMENT.md`)
51+
- Contributing guidelines (`CONTRIBUTING.md`)
52+
- Implementation summary (`IMPLEMENTATION_SUMMARY.md`)
53+
54+
### Data
55+
Based on Marine Advisory Bulletin No. 37 (MAB-37) research publication "Recoveries and Yields from Pacific Fish and Shellfish" by Chuck Crapo, Brian Paust, and Jerry Babbitt (Alaska Sea Grant, 2004):
56+
57+
**Salmon Species (5)**
58+
- Pink Salmon
59+
- Chum Salmon
60+
- Coho Salmon
61+
- Sockeye Salmon
62+
- Chinook Salmon
63+
64+
**Rockfish Species (17)**
65+
- Black Rockfish
66+
- Blue Rockfish
67+
- Yelloweye Rockfish
68+
- Canary Rockfish
69+
- Copper Rockfish
70+
- Quillback Rockfish
71+
- Widow Rockfish
72+
- Yellowtail Rockfish
73+
- Bocaccio
74+
- Chilipepper
75+
- Shortbelly Rockfish
76+
- Silvergray Rockfish
77+
- Splitnose Rockfish
78+
- Stripetail Rockfish
79+
- Greenstriped Rockfish
80+
- Rosethorn Rockfish
81+
- Sharpchin Rockfish
82+
83+
**Flatfish Species (13)**
84+
- Pacific Halibut
85+
- Arrowtooth Flounder
86+
- Petrale Sole
87+
- Dover Sole
88+
- English Sole
89+
- Rock Sole
90+
- Flathead Sole
91+
- Starry Flounder
92+
- Greenland Turbot
93+
- Alaska Plaice
94+
- Yellowfin Sole
95+
- Rex Sole
96+
- Butter Sole
97+
98+
**Shark Species (7)**
99+
- Spiny Dogfish
100+
- Blue Shark
101+
- Shortfin Mako
102+
- Thresher Shark
103+
- Common Thresher
104+
- Bigeye Thresher
105+
- Leopard Shark
106+
107+
**Crab Species (4)**
108+
- Dungeness Crab
109+
- Red King Crab
110+
- Blue King Crab
111+
- Golden King Crab
112+
113+
**Shellfish Species (12+)**
114+
- Pacific Geoduck
115+
- Manila Clam
116+
- Pacific Oyster
117+
- Weathervane Scallop
118+
- Pink Shrimp
119+
- Spot Prawn
120+
- Sidestripe Shrimp
121+
- Coonstripe Shrimp
122+
- Pacific Razor Clam
123+
- Littleneck Clam
124+
- Butter Clam
125+
- Horse Clam
126+
127+
**Other Species (15+)**
128+
- Walleye Pollock
129+
- Pacific Cod
130+
- Lingcod
131+
- Sablefish
132+
- Pacific Whiting
133+
- Albacore Tuna
134+
- Yellowfin Tuna
135+
- Bigeye Tuna
136+
- Pacific Herring
137+
- Pacific Sardine
138+
- Northern Anchovy
139+
- Pacific Mackerel
140+
- Jack Mackerel
141+
- Striped Bass
142+
- California Sheephead
143+
144+
### Technical Stack
145+
- **Frontend**: React 19.0.0, Vite 7.2.4, Tailwind CSS 4.x
146+
- **Backend**: Vercel Serverless Functions, Express 5.2.1
147+
- **Database**: Neon PostgreSQL (@neondatabase/serverless)
148+
- **Authentication**: jsonwebtoken 9.x, bcrypt 5.x
149+
- **File Processing**: formidable, xlsx
150+
- **Deployment**: Vercel with edge runtime support
151+
152+
## [0.1.0] - 2023-08-16
153+
154+
### Added
155+
- Initial project setup
156+
- Basic repository structure
157+
- Project scaffolding
158+
159+
[Unreleased]: https://github.com/paccloud/Fish_Cost_Calculator/compare/v1.0.0...HEAD
160+
[1.0.0]: https://github.com/paccloud/Fish_Cost_Calculator/releases/tag/v1.0.0
161+
[0.1.0]: https://github.com/paccloud/Fish_Cost_Calculator/releases/tag/v0.1.0

CONTRIBUTING.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,38 @@ cd ../server && npm install && node server.js
6666

6767
1. Update documentation if needed
6868
2. Ensure the app runs without errors
69-
3. Create a PR with a clear description of changes
70-
4. Wait for review
69+
3. **Update the CHANGELOG.md** (see below)
70+
4. Create a PR with a clear description of changes
71+
5. Wait for review
72+
73+
#### Maintaining the Changelog
74+
75+
We follow the [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. For every PR with user-facing changes:
76+
77+
1. **Add entries under `[Unreleased]`** in `CHANGELOG.md`
78+
2. **Use the appropriate category**:
79+
- `Added` - New features
80+
- `Changed` - Changes to existing functionality
81+
- `Fixed` - Bug fixes
82+
- `Removed` - Removed features
83+
- `Security` - Security fixes
84+
- `Data` - Fish species/yield data updates
85+
3. **Write in past tense**: "Added user authentication" (not "Add user authentication")
86+
4. **Link to PRs/issues when relevant**: `- Fixed login bug ([#123](link))`
87+
5. **Be descriptive but concise**: Help users understand what changed and why it matters
88+
89+
Example:
90+
```markdown
91+
## [Unreleased]
92+
93+
### Added
94+
- Export calculations to CSV format
95+
96+
### Fixed
97+
- Calculator rounding errors for small yields
98+
```
99+
100+
When we create a new release, maintainers will move entries from `[Unreleased]` to a new version section.
71101

72102
## Code of Conduct
73103

app/.env.development

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ VITE_API_URL=http://localhost:3000
44

55
# Stack Auth (Neon Auth) environment variables
66
# Frontend (Vite) - these get bundled into the client
7-
VITE_STACK_PROJECT_ID='a55799cf-aec1-4699-94ce-fb42094552d9'
8-
VITE_STACK_PUBLISHABLE_CLIENT_KEY='pck_cn8y47v9g8029134473btakf840y8feyar4jnkmjq2268'
7+
VITE_STACK_PROJECT_ID=a55799cf-aec1-4699-94ce-fb42094552d9
8+
VITE_STACK_PUBLISHABLE_CLIENT_KEY=pck_cn8y47v9g8029134473btakf840y8feyar4jnkmjq2268
99

1010
# Backend (server-side only)
11-
STACK_PROJECT_ID='a55799cf-aec1-4699-94ce-fb42094552d9'
12-
STACK_SECRET_SERVER_KEY='ssk_tq5d2rpbz60dgr0yt9kspvah4deeybxrqnregh5vfp6dg'
11+
STACK_PROJECT_ID=a55799cf-aec1-4699-94ce-fb42094552d9
12+
STACK_SECRET_SERVER_KEY=ssk_tq5d2rpbz60dgr0yt9kspvah4deeybxrqnregh5vfp6dg
1313

1414
# Database owner connection string
15-
DATABASE_URL='postgresql://neondb_owner:npg_QImJ9BrlwUq7@ep-spring-sea-adslwvmp-pooler.c-2.us-east-1.aws.neon.tech/neondb?sslmode=require'
15+
DATABASE_URL=postgresql://neondb_owner:npg_QImJ9BrlwUq7@ep-spring-sea-adslwvmp-pooler.c-2.us-east-1.aws.neon.tech/neondb?sslmode=require

app/.env.production

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ VITE_API_URL=
44

55
# Stack Auth (Neon Auth) environment variables
66
# Frontend (Vite) - these get bundled into the client
7-
VITE_STACK_PROJECT_ID='a55799cf-aec1-4699-94ce-fb42094552d9'
8-
VITE_STACK_PUBLISHABLE_CLIENT_KEY='pck_cn8y47v9g8029134473btakf840y8feyar4jnkmjq2268'
7+
VITE_STACK_PROJECT_ID=a55799cf-aec1-4699-94ce-fb42094552d9
8+
VITE_STACK_PUBLISHABLE_CLIENT_KEY=pck_cn8y47v9g8029134473btakf840y8feyar4jnkmjq2268
99

1010
# Backend (Vercel serverless functions) - these are server-side only
11-
STACK_PROJECT_ID='a55799cf-aec1-4699-94ce-fb42094552d9'
12-
STACK_SECRET_SERVER_KEY='ssk_tq5d2rpbz60dgr0yt9kspvah4deeybxrqnregh5vfp6dg'
11+
STACK_PROJECT_ID=a55799cf-aec1-4699-94ce-fb42094552d9
12+
STACK_SECRET_SERVER_KEY=ssk_tq5d2rpbz60dgr0yt9kspvah4deeybxrqnregh5vfp6dg
1313

1414
# Database owner connection string
15-
DATABASE_URL='postgresql://neondb_owner:npg_QImJ9BrlwUq7@ep-spring-sea-adslwvmp-pooler.c-2.us-east-1.aws.neon.tech/neondb?sslmode=require'
15+
DATABASE_URL=postgresql://neondb_owner:npg_QImJ9BrlwUq7@ep-spring-sea-adslwvmp-pooler.c-2.us-east-1.aws.neon.tech/neondb?sslmode=require

docs/ENVIRONMENT_VARIABLES.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Environment Variables Configuration
2+
3+
This document explains how to properly configure environment variables for the Local Catch application.
4+
5+
## Important: No Quotes in .env Files
6+
7+
When setting environment variables in `.env` files, **do NOT use quotes** around the values unless the quotes are part of the actual value. Vite will include quotes as part of the value if you add them.
8+
9+
### ❌ Wrong (with quotes)
10+
```bash
11+
VITE_STACK_PROJECT_ID='a55799cf-aec1-4699-94ce-fb42094552d9'
12+
VITE_STACK_PUBLISHABLE_CLIENT_KEY='pck_cn8y47v9g8029134473btakf840y8feyar4jnkmjq2268'
13+
```
14+
15+
### ✅ Correct (without quotes)
16+
```bash
17+
VITE_STACK_PROJECT_ID=a55799cf-aec1-4699-94ce-fb42094552d9
18+
VITE_STACK_PUBLISHABLE_CLIENT_KEY=pck_cn8y47v9g8029134473btakf840y8feyar4jnkmjq2268
19+
```
20+
21+
## Vercel Environment Variables
22+
23+
When adding environment variables to Vercel (either via dashboard or CLI), ensure they are added without quotes:
24+
25+
```bash
26+
# Using printf to avoid quotes
27+
printf 'your-value-here' | vercel env add VARIABLE_NAME production
28+
```
29+
30+
## Required Environment Variables
31+
32+
### Frontend (Vite) - Client-side
33+
These are bundled into the client code and exposed to the browser:
34+
- `VITE_STACK_PROJECT_ID` - Stack Auth project ID
35+
- `VITE_STACK_PUBLISHABLE_CLIENT_KEY` - Stack Auth public key
36+
- `VITE_API_URL` - API base URL (empty for production, http://localhost:3000 for dev)
37+
38+
### Backend (Vercel Functions) - Server-side only
39+
These are only accessible on the server:
40+
- `STACK_PROJECT_ID` - Stack Auth project ID (server-side)
41+
- `STACK_SECRET_SERVER_KEY` - Stack Auth secret key (**NEVER expose to client**)
42+
- `JWT_SECRET` - Secret for signing JWT tokens
43+
- `DATABASE_URL` - PostgreSQL connection string
44+
- All `POSTGRES_*` and `PG*` variables from Neon
45+
46+
## Common Issues
47+
48+
### "Invalid project ID" Error
49+
If you see an error like "Invalid project ID: ... Project IDs must be UUIDs", this usually means:
50+
1. The environment variable has quotes around it
51+
2. The environment variable wasn't set correctly in Vercel
52+
3. The build needs to be redeployed after fixing the variables
53+
54+
**Solution**: Remove quotes from all environment variables and redeploy.
55+
56+
### Authentication 401 Errors
57+
If you get 401 Unauthorized errors when logged in with OAuth:
58+
1. Check that `VITE_STACK_PROJECT_ID` and `VITE_STACK_PUBLISHABLE_CLIENT_KEY` are set in Vercel
59+
2. Verify they don't have quotes around them
60+
3. Redeploy the application
61+
62+
## Local Development Setup
63+
64+
1. Copy `.env.example` to `.env.development`:
65+
```bash
66+
cp app/.env.example app/.env.development
67+
```
68+
69+
2. Fill in your values **without quotes**:
70+
```bash
71+
VITE_API_URL=http://localhost:3000
72+
VITE_STACK_PROJECT_ID=your-project-id-here
73+
VITE_STACK_PUBLISHABLE_CLIENT_KEY=your-key-here
74+
DATABASE_URL=your-connection-string-here
75+
```
76+
77+
3. Never commit `.env`, `.env.development`, or `.env.production` files - they're gitignored for security.
78+
79+
## Production Deployment
80+
81+
Environment variables for production are managed in Vercel:
82+
1. Go to Vercel dashboard → Project Settings → Environment Variables
83+
2. Add variables without quotes
84+
3. Select appropriate environments (Production, Preview, Development)
85+
4. Redeploy to apply changes

0 commit comments

Comments
 (0)