# Install and launch

## 1. Choose your hosting path

The site needs a server to make live postal requests. A static-only upload cannot securely perform live USPS validation. Two portable server options are included.

### Option A — PHP / cPanel / Bluehost-style shared hosting

Requirements: PHP **8.1+**, cURL, JSON, outbound HTTPS access to `apis.usps.com`, Apache-compatible `.htaccess` routing with mod_rewrite. Confirm your hosting plan supports these features. The existing WordPress website is not modified by this package.

1. Back up the files currently serving `uspsaddressvalidationsoftware.com`.
2. In your hosting account, identify the **document root for that specific domain**. Do not upload to another website's root.
3. Upload the **contents** of `hosting/php/public/` into that document root. Include the hidden `.htaccess` file. Do not upload the entire development repository to public_html.
4. Open the domain over HTTPS. The website and sample tools should work without credentials.
5. Create a directory called `private` **one level above the domain's document root**, outside public web access. Copy `hosting/php/private/aes-config.example.php` there and rename it `aes-config.php`.
6. Edit that private file on your server to set `USPS_CLIENT_ID`, `USPS_CLIENT_SECRET` and `USPS_ENV`. Leave them empty for sample-only mode. Protect the file with your account's appropriate filesystem permissions.
7. If that private path is not available on your host, have your host configure environment variables or `AES_CONFIG_FILE` pointing to a protected location. Never move real secrets into public_html to work around the path requirement.
8. Visit `/api/status` on your domain. `liveConfigured: true` confirms credentials are present, **not** that USPS has authorized them. Perform an authorized live lookup to verify access.
9. If `/api/status` returns 404, check mod_rewrite and `.htaccess`. If your host disables `Options`, remove `Options -Indexes` only after enabling equivalent directory-listing protection in the host's control panel.
10. Turn off PHP `display_errors` in production; use protected error logs. A host behind a reverse proxy must pass the original HTTPS state correctly so same-origin checks work. Do not disable those checks.

The PHP adapter performs live batch requests sequentially. Shared-host execution limits may interrupt larger tests; use smaller batches or the Node version if your host's timeout is low. It uses temporary IP-hash counter files to limit live calls. Ensure the PHP temporary directory is writable and private to your hosting account. No address data is written to these counter files.

### Option B — Node.js hosting

Requirements: Node.js **22.9+**, outbound HTTPS, a persistent Node process, and an HTTPS reverse proxy. The package is dependency-free.

1. Upload the project to a private application directory, not to a publicly served source-code folder.
2. Copy `.env.example` to `.env` and set server values. Sample mode works with blank credentials.
3. Start using `npm start` (or the host's process manager). The default port is 3000. Set `PORT` for your host.
4. Point the domain's HTTPS proxy at the application port. Keep the source directory and `.env` outside static web serving.
5. For a local Windows test, install Node.js, extract the ZIP, open a terminal in the project folder and run `npm start`.
6. Configure your host to restart the application after a reboot and to install supported Node security updates.

Only `public/` is served by the Node static handler. The server supplies `/api/status`, `/api/validate` and `/api/batch`. If your proxy changes the request origin, configure its Host preservation so browser Origin and the request origin agree. Never place credentials in the front-end script.

The Node limiter trusts the socket connection, not forwarded headers. Behind a proxy it may apply a shared quota; configure rate limiting at your trusted edge for per-visitor limits. Worker limits are in memory and are per isolate, not a global billing cap. Use a persistent edge quota, provider spending/usage controls and abuse protection before an unrestricted public launch.

## 2. Enable live USPS validation

1. Complete the USPS Addresses API onboarding, terms, license, and any required payment-account setup in your own USPS Business Portal.
2. Link the developer credentials to the approved Addresses API license and refresh claims as directed by USPS.
3. Enter your client ID and secret **only in server-side configuration**.
4. Use `USPS_ENV=tem` for the USPS test environment or `production` for live production data. TEM results are labeled as test data.
5. Restart/redeploy the application after configuring credentials.
6. Select **Live USPS check**, submit an address you are authorized to process, and inspect the result and DPV indicator.
7. A 403 usually requires checking USPS access/license linkage. A 401 requires checking credentials. The site never falls back from live mode to a sample.

Current onboarding reference: https://www.usps.com/business/api-access.htm
Developer portal: https://developers.usps.com/

The API does not ship with a local copy of USPS address data. No CASS certificate, NCOALink license or right to redistribute USPS data is created by installing this website. A lookup does not issue PS Form 3553.

## 3. Connect AES Mail*SERVE instead (optional future integration)

The software family information describes AES products; the built-in live connector directly uses USPS. Your existing `msapix.dll`, DLL, socket service, or on-premise Mail*SERVE system is not configured or accessible here.

A developer can replace `liveResult` in `src/api.js` with an HTTPS request to an authorized AES gateway that returns the documented website result format. For a DLL/TCP deployment, run a protected gateway near the AES service. Keep service credentials on the server, validate input, preserve DPV codes and return real errors. Obtain the actual request/response specification before implementing it.

## 4. Domain, content and launch checks

- This package has not changed your DNS or replaced your existing domain. Point DNS only after the chosen hosting installation is ready.
- Enable HTTPS on the domain and redirect HTTP to HTTPS using your host's documented controls.
- Keep the independent-provider / USPS trademark notice visible; the domain name must not imply USPS ownership.
- Review the privacy and terms text against your actual hosting, retention and customer contracts.
- Confirm the sales phone numbers, contact email and current demo offer before public launch.
- The contact form prepares an email draft. Test the email app link and copy fallback. Configure a real mail/CRM service separately if you want automatic submissions.
- Test the three examples, an arbitrary sample input, missing credentials, actual live results, CSV export, calculator and mobile layout.
- Confirm that `.env`, the private PHP configuration and source files are never publicly accessible.
- Preserve the root layout. Deployment under a subdirectory requires adjusting absolute paths in HTML, JS, routing and sitemap.
- The external Google Fonts request has a system-font fallback. No image/CDN dependencies are required.
- The generated sitemap targets `https://uspsaddressvalidationsoftware.com`. Change it if you use another final domain.

## 5. Update the design

- Colors, typography and breakpoints: `public/styles.css`.
- Text, services, offers and main layout: `public/index.html`.
- Interactive behavior and product copy: `public/app.js`.
- Privacy/terms: `public/privacy.html` and `public/terms.html`.
- Main palette: AES blue `#1273eb`, navy `#102448`, Puerto Rico accent purple `#7554c7`.
- The AES monogram in this build is a new text-based website mark, not a downloaded official logo. Replace it with your approved brand artwork if desired.
- For PHP hosting, regenerate `hosting/php/public/` after any front-end edit with `node scripts/package-php.mjs` and upload the resulting contents.
