Skip to content

About

Marine website

Resources

Stars

116 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

GMT Maritime and Transport Limited website

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.

Before publishing

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.

Requirements

  • Node.js 20+ and npm
  • MongoDB Community locally, or a MongoDB Atlas database

Install and configure

Open this folder in VS Code, then run from the project root:

npm install
npm run install:all

Copy 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-password

Copy client/.env.example to client/.env for local development:

VITE_API_URL=http://localhost:5000/api

Start locally

Start both apps from the project root:

npm run dev

Or run separately:

npm run dev --prefix server
npm run dev --prefix client

Open http://localhost:5173. The API health check is http://localhost:5000/api/status.

Test forms and dashboard

  1. Ensure MongoDB is running and the server logs MongoDB connected.
  2. Submit the Quote and Contact forms on the website. Required fields and email are validated on both client and server.
  3. Visit /admin, sign in with ADMIN_EMAIL and ADMIN_PASSWORD, then click Load Enquiries or Load Quotes. You can change status or delete a submission.

Deploy

Frontend: Netlify or Vercel

  • 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 _redirects file); Vercel automatically handles Vite SPA deployment when configured appropriately.

Backend: Render, Railway, or similar Node hosting

  • Set root directory to server.
  • Build command: npm install.
  • Start command: npm start.
  • Add MONGODB_URI, JWT_SECRET, ADMIN_EMAIL, ADMIN_PASSWORD, PORT, and CLIENT_URL environment variables in the host dashboard.
  • Set CLIENT_URL to 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.

Security notes

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.

About

Marine website

Resources

Stars

116 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages