This application now uses Neon PostgreSQL as the database backend instead of Google Sheets, with a secure API layer.
- Frontend: React app (port 3000)
- Backend: Express API server (port 5000)
- Database: Neon PostgreSQL (cloud-hosted)
✅ Database credentials never exposed to frontend
✅ API layer with Helmet security headers
✅ CORS protection
✅ SSL connection to Neon database
✅ Environment variable isolation
The .env file contains:
DATABASE_URL: Neon PostgreSQL connection string (backend only)REACT_APP_API_URL: API endpoint for frontendPORT: Backend server port (default: 5000)FRONTEND_URL: Frontend URL for CORS
Important: Only variables prefixed with REACT_APP_ are accessible to the frontend.
Run the schema creation script in your Neon dashboard SQL editor:
-- See server/schema.sql for the complete schemaOr connect via psql:
psql "postgresql://username:password@host/database?sslmode=require&channel_binding=require"npm installnpm run devTerminal 1 - Backend:
npm run serverTerminal 2 - Frontend:
npm startHealth check endpoint
Fetch all molecules from database
Response:
{
"success": true,
"data": [
{
"id": "MOL-001",
"name": "Aspirin",
"smiles": "CC(=O)OC1=CC=CC=C1C(=O)O",
"weight": 180.158,
"formula": "C9H8O4",
"prediction": "BBB-",
"confidence": 87.5,
"mw": 180.158,
"logp": 1.19,
"hbd": 1,
"hba": 4,
"tpsa": 63.6,
"rotatable_bonds": 3,
"heavy_atoms": 13
}
]
}Fetch a single molecule by ID
CREATE TABLE molecules_and_predictions (
id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
Smiles TEXT UNIQUE,
Name TEXT,
Prediction SMALLINT,
Confidence NUMERIC,
mw NUMERIC,
logp NUMERIC,
hbd INTEGER,
hba INTEGER,
tpsa INTEGER,
rotatable_bonds INTEGER,
heavy_atoms INTEGER,
formula TEXT
);The backend must be hosted publicly to be accessible by the live frontend.
- Push code to GitHub.
- Create a new Web Service on Render.
- Connect your repository.
- Set Build Command:
npm install - Set Start Command:
node server/index.js - Add Environment Variables in Render Dashboard:
DATABASE_URL: Your Neon connection stringSERVER_PORT:5000
- Deploy anf Copy your new backend URL (e.g.,
https://brainroutedb-api.onrender.com).
- Update your local
.envfile with the live backend URL:REACT_APP_API_URL=https://your-backend-app.onrender.com
- Deploy the frontend:
This command builds the app and pushes it to the
npm run deploy
gh-pagesbranch.
- Never commit
.envfile - Use.env.exampletemplate instead - Rotate credentials regularly - Update Neon password periodically
- Use HTTPS in production - Ensure SSL/TLS for API communication
- Implement rate limiting - Protect API from abuse
- Add authentication - Implement JWT or OAuth if needed
- Verify
DATABASE_URLis correct - Check Neon database is running
- Ensure SSL is enabled
- Check
FRONTEND_URLin.env - Verify CORS settings in
server/index.js
- Check backend server is running on correct port
- Verify
REACT_APP_API_URLmatches backend URL
© 2026 BrainRoute-DB. All rights reserved.