Skip to content

About

Official website project for Jalops Electrical Services

Resources

Stars

113 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Jalops Electrical Services Website

A full-stack React + Vite frontend and Express + MongoDB backend for Jalops Electrical Services.

Requirements

  • Node.js 20+
  • MongoDB local instance or MongoDB Atlas database
  • npm

1. Configure the backend

cd server
npm install
copy .env.example .env

On macOS/Linux use cp .env.example .env. Edit server/.env:

  • MONGODB_URI: your MongoDB connection string
  • JWT_SECRET: a long random secret
  • ADMIN_NAME, ADMIN_EMAIL, ADMIN_PASSWORD: initial administrator credentials
  • CLIENT_ORIGIN: normally http://localhost:5173

Create the initial admin account:

npm run seed:admin

The seed command creates the admin if it does not already exist. Change the initial password before a public launch.

Start the API:

npm run dev

API health check: http://localhost:5000/api/health

2. Configure the frontend

Open a second terminal:

cd client
npm install
copy .env.example .env
npm run dev

Open http://localhost:5173.

Main routes

  • / Home
  • /about About
  • /services Services
  • /products Product catalogue
  • /quote Request a quote
  • /contact Contact
  • /admin/login Admin login
  • /admin Protected dashboard

Admin

Sign in using the values configured in server/.env. From the dashboard you can create, edit and delete catalogue products, review contact enquiries and quotation requests, and update enquiry statuses.

API

  • POST /api/enquiries contact form
  • GET /api/enquiries admin list
  • PATCH /api/enquiries/:id/status admin status update
  • POST /api/quotes quotation form
  • GET /api/quotes admin list
  • PATCH /api/quotes/:id/status admin status update
  • GET /api/products public catalogue
  • GET /api/products/:id public product detail
  • POST /api/products admin create
  • PUT /api/products/:id admin update
  • DELETE /api/products/:id admin delete
  • POST /api/auth/login admin login
  • GET /api/auth/me current admin
  • GET /api/dashboard admin summary

Business content accuracy

Service and product categories are presented as proposed catalogue content and should be confirmed by management before publication. Product entries are clearly labelled as catalogue examples; no price or stock claims are made. Replace editable company profile copy with owner-approved details. No registration numbers, certifications, years of experience, warranties or testimonials are fabricated.

Production deployment

  1. Deploy the Express server to a Node hosting provider and provision MongoDB Atlas.
  2. Set production environment variables (NODE_ENV=production, MONGODB_URI, JWT_SECRET, ADMIN_*, CLIENT_ORIGIN).
  3. Deploy the client folder as a static Vite site. Set VITE_API_URL to the deployed API base URL, e.g. https://api.example.com/api.
  4. Configure the frontend host's SPA rewrite so unknown paths serve index.html.
  5. Use HTTPS, restrict CLIENT_ORIGIN to the exact production frontend origin, use a strong admin password, and rotate secrets.
  6. Review service/product content with the business owner before publishing.

Notes

  • Contact and quote submissions are validated on both client and server and persisted in MongoDB.
  • Admin access uses bcrypt password hashing and JWT authentication. Tokens are stored in session storage and sent in the Authorization header.
  • The frontend uses text-based product image URLs for simple catalogue maintenance. Use image URLs from assets you own or are licensed to use.

About

Official website project for Jalops Electrical Services

Resources

Stars

113 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages