A React/Vite frontend and Express/MongoDB backend for GMT Maritime and Transport Limited. The public site has pages for Home, About, Services, Quote, Contact and a protected /admin dashboard.
The current business phone number and physical location use the information provided. Company profile, mission, vision, values, and service scope include deliberately editable wording because they have not been independently confirmed. Replace all [Editable] text after management approval. No email address, certification, licence, partnership, route, performance promise, client, testimonial, or company history is claimed.
- Node.js 20+ and npm
- MongoDB Community locally, or a MongoDB Atlas database
Open this folder in VS Code, then run from the project root:
npm install
npm run install:allCopy server/.env.example to server/.env, then set the values. Do not commit this file.
PORT=5000
MONGODB_URI=mongodb://127.0.0.1:27017/gmt_maritime
CLIENT_URL=http://localhost:5173
JWT_SECRET=use_a_long_unique_random_secret
ADMIN_EMAIL=your-private-admin-email@example.com
ADMIN_PASSWORD=use-a-strong-private-passwordCopy client/.env.example to client/.env for local development:
VITE_API_URL=http://localhost:5000/apiStart both apps from the project root:
npm run devOr run separately:
npm run dev --prefix server
npm run dev --prefix clientOpen http://localhost:5173. The API health check is http://localhost:5000/api/status.
- Ensure MongoDB is running and the server logs
MongoDB connected. - Submit the Quote and Contact forms on the website. Required fields and email are validated on both client and server.
- Visit
/admin, sign in withADMIN_EMAILandADMIN_PASSWORD, then click Load Enquiries or Load Quotes. You can change status or delete a submission.
- Set root directory to
client. - Build command:
npm run build. - Publish directory:
dist. - Add
VITE_API_URL=https://YOUR-API-DOMAIN/api. - Configure a SPA rewrite: on Netlify add
/* /index.html 200(or a_redirectsfile); Vercel automatically handles Vite SPA deployment when configured appropriately.
- Set root directory to
server. - Build command:
npm install. - Start command:
npm start. - Add
MONGODB_URI,JWT_SECRET,ADMIN_EMAIL,ADMIN_PASSWORD,PORT, andCLIENT_URLenvironment variables in the host dashboard. - Set
CLIENT_URLto the final frontend origin (or comma-separated origins when needed). - In MongoDB Atlas, allow the hosting provider IP range and create a database user with a strong password.
After deployment, update VITE_API_URL, rebuild/redeploy the frontend, and test both form submissions and admin login.
Admin credentials and MongoDB configuration remain server-side only. Use a long random JWT secret and a unique admin password. The API includes CORS, request-size limits, rate limiting, server-side validation and protected admin endpoints. For a larger production operation, replace environment-based single-owner authentication with persisted, hashed user accounts and audit logging.