This setup fixes the common issues:
- Railway:
Not Found/train has not arrived at the station - Frontend network/proxy failures
- CORS/PORT/start command mismatch
- Express server
- Uses
process.env.PORT || 3333 - Exposes:
GET /healthPOST /api/notion(Notion database query proxy)
- CORS accepts:
- your explicit
ALLOWED_ORIGINS *.github.io- localhost
- your explicit
- Start command:
node index.js
- Push repo to GitHub.
- Create a Railway project from this repo.
- In Railway service settings:
- Root Directory:
server - Start Command:
npm start - (Build command default is fine; Railway installs deps from
server/package.json)
- Add Railway environment variables:
NOTION_API_KEY=...NOTION_DB_ID=...ALLOWED_ORIGINS=https://YOUR_GITHUB_USERNAME.github.ioPORTis optional (Railway injects it automatically)
- Deploy and open logs.
Expected success log:
[BOOT] CyberScore Notion proxy listening on <port>
After Railway deploy, verify:
- Health:
https://YOUR_RAILWAY_DOMAIN/health- Must return JSON with
ok: true
- Notion proxy:
curl -X POST https://YOUR_RAILWAY_DOMAIN/api/notion \
-H "Content-Type: application/json" \
-d '{"page_size":1}'If it fails:
401=> badNOTION_API_KEY404=> badNOTION_DB_IDor integration not shared with DB403=> CORS blocked origin or Notion access issue
Use root .env:
VITE_API_URL=https://YOUR_RAILWAY_DOMAINTemplate is provided in .env.example.
- Ensure Pages settings:
Settings > Pages > Source = GitHub Actions
- Ensure Actions variable exists:
Settings > Secrets and variables > Actions > VariablesVITE_API_URL=https://YOUR_RAILWAY_DOMAIN
- Trigger deploy:
- Push to
main(or run workflow manually) - Workflow:
.github/workflows/deploy-pages.yml
Check for:
- Boot log present
- No crash on startup
- Incoming
/api/notionrequests
If you see Not Found / train has not arrived:
- Root Directory is wrong (must be
server) - Start command is wrong (must be
npm start) - No successful deploy yet
- Open Network tab
- Confirm calls go to:
https://YOUR_RAILWAY_DOMAIN/api/notion - Confirm response is not blocked by CORS
- Railway Root Directory =
server - Railway Start Command =
npm start - Railway env vars set:
NOTION_API_KEY,NOTION_DB_ID, optionalALLOWED_ORIGINS -
https://YOUR_RAILWAY_DOMAIN/healthreturnsok: true -
POST /api/notionworks from curl - Frontend
.envhasVITE_API_URL=https://YOUR_RAILWAY_DOMAIN - GitHub Actions Pages deploy succeeded
- Frontend network requests target Railway and return data
Backend:
cd server
npm install
cp .env.example .env
npm startFrontend:
npm install
cp .env.example .env
npm run dev