Deploy best-free-static-contact-example
Deploy and Host a React Contact Form with a Private API on Railway
Just deployed
Just deployed
/data
Deploy and Host a React Contact Form with a Private API on Railway
A React/Vite contact page and a separate Node.js form API. The frontend serves static assets and proxies submissions to the API through Railway private networking. The API validates fields and saves messages to a persistent volume. It does not send email.
About Hosting a React Contact Form
The template creates a public web service, a private api service, and a volume mounted at /data for JSONL submissions. Defaults are included for both ports and the storage directory. The frontend's API host is a service reference, so every deployment uses its own API. There are no external API keys or required user inputs. Railway hosting resource usage is billed according to your plan.
Why Deploy a React Contact Form on Railway?
Use a single project for the frontend and backend while keeping the API off the public internet. Inspect deployments, healthchecks, environment variables, and storage from the same project. Customize the API for your own workflow rather than embedding secrets in browser code.
Common Use Cases
- Learning how a static React frontend submits to a backend
- Prototyping a landing-page contact form with persistent storage
- Starting a frontend/API monorepo
Dependencies for a React Contact Form
- A Railway account with available hosting resources
- Node.js and npm, installed by Railway's build system
- The public source repository: https://github.com/WillRaphaelson/railway-react-contact-form
Deployment Dependencies
The frontend builds with npm run build and starts with npm start from /frontend. The API starts with npm start from /api. API_HOST references the API's private domain. The API listens on port 3001 and the frontend on port 3000. The /health endpoint is configured for both services.
Open the web service's generated domain and visit /contact. Submit fictional details, then look for a saved-message reference. Saved submissions are in /data/submissions.jsonl on the API volume and can be accessed through Railway's volume file tools. No submission-reading endpoint is exposed.
This is a single-replica teaching example, not a managed form inbox. Before collecting real personal data, add stronger bot/rate protection, appropriate consent and retention controls, backups, and operator access controls. The included aggregate rate limiter is process-local and resets on restart. Add an email integration if messages should reach an inbox. Review the repository README for limits and local tests.
Template Content