This is a full-stack application with a React frontend and Flask backend, configured for deployment on Railway.
.
├── backend/
│ ├── app.py # Flask application
│ ├── requirements.txt # Python dependencies
│ └── ... # Other backend files
├── frontend/
│ ├── package.json # Node.js dependencies
│ ├── vite.config.ts # Vite configuration
│ └── ... # Other frontend files
├── railway.toml # Railway deployment configuration
├── Procfile # Process execution commands
├── requirements.txt # Python dependencies (root level)
├── package.json # Node.js configuration (root level)
├── runtime.txt # Python runtime version
└── start.sh # Application start script
The project is configured with railway.toml to:
- Use Nixpacks builder
- Install Node.js 18, Python 3.11, and pip
- Install frontend and backend dependencies
- Build the React frontend
- Copy the built files to the backend static directory
- Start the Flask application
Set these environment variables in your Railway project:
FLASK_CONFIG=productionSECRET_KEY=your-secret-keyJWT_SECRET_KEY=your-jwt-secret-keyMONGODB_URI=your-mongodb-uri(or leave unset to use mock database)
Railway will automatically:
- Detect and use the Nixpacks builder
- Execute the setup phase to install Node.js 18, Python 3.11, and pip
- Run the install phase to install frontend and backend dependencies
- Run the build phase to build the React frontend and copy files
- Start the application using the start command
To run locally:
-
Start the backend:
cd backend python app.py -
Start the frontend (in another terminal):
cd frontend npm run dev
- The Flask backend serves the React frontend build files from the
staticdirectory - All non-API routes are handled by serving
index.htmlto support client-side routing - CORS is enabled for all API routes
- The application listens on the PORT environment variable provided by Railway