Deployment Guide
Relevant source files
The following files were used as context for generating this wiki page:This guide provides technical instructions for deploying the Vandore Heritage website. The project is a static website served by a lightweight, custom Node.js server. It utilizes a Git-based content management approach configured via Stackbit, where page content is stored in JSON files.
The architecture is simple, consisting of a Node.js runtime to serve static HTML, CSS, JavaScript, and image files. There are no external databases or complex backend services required. The primary deployment requirement is a Node.js environment capable of running the server.js script.
1. Server Setup and Execution
The application is started using npm scripts defined in package.json. The server itself is a simple Node.js application that requires no external npm packages to run.
Sources: package.json, server.js
1.1. Scripts
The package.json file defines the scripts for running the server. Both dev and start execute the same command.
| Script | Command | Description |
|---|---|---|
dev | node server.js | Starts the server for development. |
start | node server.js | Starts the server for production. |
Sources: package.json:5-8
To run the application, execute the following command in the project's root directory:
npm start
The server will start and listen for requests on port 8000.
Sources: server.js:4, server.js:77-79
2. Server Architecture
The core of the application's runtime is a single server.js file that uses Node.js's built-in http and fs modules to create a static file server.
Sources: server.js
2.1. Request Handling Flow
The server processes incoming HTTP requests by attempting to map the URL to a file in the local file system. If a file is not found, it serves a custom 404 page.
This diagram illustrates the server's request handling logic.
Sources: server.js:28-75
2.2. MIME Type Support
The server identifies the correct Content-Type header based on the requested file's extension. If the extension is not recognized, it defaults to application/octet-stream.
| Extension | MIME Type |
|---|---|
.html | text/html |
.css | text/css |
.js | text/javascript |
.json | application/json |
.png | image/png |
.jpg | image/jpeg |
.jpeg | image/jpeg |
.gif | image/gif |
.svg | image/svg+xml |
.ico | image/x-icon |
.woff | font/woff |
.woff2 | font/woff2 |
.ttf | font/ttf |
.eot | application/vnd.ms-fontobject |
Sources: server.js:7-23
2.3. Error Handling
If a requested file does not exist (ENOENT error), the server attempts to serve a custom 404.html page. If 404.html itself cannot be read, a generic "404 - Page Not Found" message is returned. For any other file-read errors, a generic 500 server error is returned.
Sources: server.js:53-68
3. Project Structure
The repository is organized into several key directories that separate concerns like content, styling, client-side logic, and static assets.
| File / Directory | Description |
|---|---|
server.js | The Node.js static file server. |
*.html | Root-level HTML files for each page of the site (e.g., properties.html, about.html). |
content/ | Contains JSON files that hold the editable content for pages, managed by Stackbit. |
css/ | Contains stylesheets, including custom.css for brand-specific styles. |
js/ | Contains client-side JavaScript files like script.js. |
image/ | Stores all static image assets used throughout the site. |
stackbit.config.ts | Stackbit configuration file defining content models and URL mappings. |
package.json | Defines project metadata and run scripts. |
Sources: server.js, stackbit.config.ts, properties.html, css/custom.css, js/script.js
4. Content Management with Stackbit
The website uses Stackbit for content management, which is configured in stackbit.config.ts. This file defines how content, stored in JSON files within the content/ directory, is structured and mapped to the website's HTML pages.
Sources: stackbit.config.ts
4.1. Content Models
Stackbit defines models that structure the content. The two main models are Page and Property.
| Model | Type | File Path | Description |
|---|---|---|---|
Page | page | content/pages/{slug}.json | Represents a standard web page with fields for title, hero content, and lists of other content blocks. |
Property | data | content/properties/{slug}.json | Represents a single real estate property with fields for price, address, description, and other details. |
Sources: stackbit.config.ts:11-124
4.2. Site Mapping
The siteMap function in the configuration file maps the content documents to the final HTML URLs. Page documents are mapped directly to corresponding HTML files, while Property documents are mapped to a template file.
This diagram shows how Stackbit maps JSON content to live URLs.
Sources: stackbit.config.ts:127-149
5. Summary
Deploying the Vandore Heritage website is a straightforward process. The key steps are:
- Ensure a Node.js runtime is available in the deployment environment.
- Place all project files on the server.
- Run
npm startto initiate the static file server on port 8000. - Configure a reverse proxy (like Nginx or Apache) if needed to handle incoming traffic on standard ports (80/443) and forward it to port 8000.
The application is self-contained, with no database dependencies. All content is managed via flat JSON files in the content/ directory, making the deployment package simple and portable.