### Install Dependencies Source: https://github.com/jb3ai/eaglestar/blob/main/README.md Run this command in your project directory to install all necessary Node.js dependencies. ```bash npm install ``` -------------------------------- ### Run Development Server Source: https://github.com/jb3ai/eaglestar/blob/main/README.md Start the local development server to view and test your AI Studio app. Ensure your .env.local file is correctly configured. ```bash npm run dev ``` -------------------------------- ### Configure Environment Variables Source: https://context7.com/jb3ai/eaglestar/llms.txt Copy the example environment file and edit it to set your API key. This is a necessary step before running the application. ```bash cp .env.example .env.local # Edit .env.local and set: # GEMINI_API_KEY=your_key_here ``` -------------------------------- ### Start Vite Development Server Source: https://context7.com/jb3ai/eaglestar/llms.txt Run this command to start the Vite development server. It will be accessible on port 3000 and all network interfaces. ```bash npm run dev # ➜ Local: http://localhost:3000/eaglestar/ # ➜ Network: http://0.0.0.0:3000/eaglestar/ ``` -------------------------------- ### Start Express API Server Source: https://context7.com/jb3ai/eaglestar/llms.txt In a separate terminal, run this command to start the Express API server on port 3001. This server handles data persistence. ```bash npm run server # Backend server running at http://localhost:3001 ``` -------------------------------- ### GET /api/signups - Retrieve All Signup Records Source: https://context7.com/jb3ai/eaglestar/llms.txt Retrieve all signup records from the 'signups' table, ordered by creation date descending. No authentication is required for this endpoint. ```bash curl -s http://localhost:3001/api/signups | jq ``` -------------------------------- ### GET /api/signups — Retrieve all signup records Source: https://context7.com/jb3ai/eaglestar/llms.txt Retrieves all signup records from the `signups` table, ordered by `created_at` in descending order. This endpoint is intended for internal or administrative use. ```APIDOC ## GET /api/signups ### Description Retrieves all signup records from the `signups` table, ordered by creation date in descending order. This endpoint is intended for internal/admin use. ### Method GET ### Endpoint /api/signups ### Parameters None ### Response #### Success Response (200) - An array of signup objects, each containing: - **id** (integer) - The unique identifier for the signup. - **name** (string) - The name of the person who signed up. - **email** (string) - The email address of the person who signed up. - **phone** (string) - The phone number of the person who signed up. - **created_at** (string) - The timestamp when the signup occurred. #### Response Example ```json [ { "id": 2, "name": "Thabo Mokoena", "email": "thabo@retailgroup.co.za", "phone": "+27 72 000 1234", "created_at": "2024-05-08 09:45:00" }, { "id": 1, "name": "Jane Dlamini", "email": "jane@example.co.za", "phone": "+27 82 555 0101", "created_at": "2024-05-08 09:30:00" } ] ``` ``` -------------------------------- ### Production Build Source: https://context7.com/jb3ai/eaglestar/llms.txt Execute this command to create a production build of the application. Static assets will be served from the /eaglestar/ base path. ```bash npm run build # Output: dist/ — static assets served from /eaglestar/ base path ``` -------------------------------- ### POST /api/signup — Register a new lead Source: https://context7.com/jb3ai/eaglestar/llms.txt Accepts a visitor's name, email, and optional phone number to register a new lead. Persists the record to the `signups` table and returns the generated row ID. `name` and `email` are required; missing either yields a 400 response. ```APIDOC ## POST /api/signup ### Description Registers a new lead with name, email, and an optional phone number. Returns the generated row ID upon success. ### Method POST ### Endpoint /api/signup ### Parameters #### Request Body - **name** (string) - Required - The name of the lead. - **email** (string) - Required - The email address of the lead. - **phone** (string) - Optional - The phone number of the lead. ### Request Example ```json { "name": "Jane Dlamini", "email": "jane@example.co.za", "phone": "+27 82 555 0101" } ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the newly created signup record. - **message** (string) - Confirmation message. #### Response Example ```json { "id": 1, "message": "Signup successful" } ``` #### Error Response (400) - **error** (string) - Message indicating missing required fields. ``` -------------------------------- ### POST /api/signup - Register New Lead Source: https://context7.com/jb3ai/eaglestar/llms.txt Use this endpoint to register a new lead with name and email. Phone is optional. A 400 error is returned if name or email are missing. ```bash curl -s -X POST http://localhost:3001/api/signup \ -H "Content-Type: application/json" \ -d '{"name": "Jane Dlamini", "email": "jane@example.co.za", "phone": "+27 82 555 0101"}' | jq ``` ```bash curl -s -X POST http://localhost:3001/api/signup \ -H "Content-Type: application/json" \ -d '{"phone": "+27 82 555 0101"}' | jq ``` -------------------------------- ### SQLite Database Table Initialization Source: https://context7.com/jb3ai/eaglestar/llms.txt Initialize 'signups' and 'contact_requests' tables in a SQLite database using better-sqlite3. The 'IF NOT EXISTS' clause prevents errors on server restarts. ```typescript import Database from 'better-sqlite3'; const db = new Database('database.db'); db.exec(` CREATE TABLE IF NOT EXISTS signups ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, email TEXT NOT NULL, phone TEXT, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ) `); db.exec(` CREATE TABLE IF NOT EXISTS contact_requests ( id INTEGER PRIMARY KEY AUTOINCREMENT, full_name TEXT NOT NULL, email TEXT NOT NULL, phone TEXT NOT NULL, company TEXT, service TEXT NOT NULL, message TEXT NOT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP ) `); const stmt = db.prepare( 'INSERT INTO contact_requests (full_name, email, phone, company, service, message) VALUES (?, ?, ?, ?, ?, ?)' ); const info = stmt.run('Sipho Ndlovu', 'sipho@co.za', '+27 11 234 5678', null, 'intelligence', 'Warehouse investigation'); console.log(info.lastInsertRowid); ``` -------------------------------- ### Set Gemini API Key Source: https://github.com/jb3ai/eaglestar/blob/main/README.md Configure your Gemini API key by adding it to the .env.local file. This is required for the application to authenticate with the Gemini API. ```env GEMINI_API_KEY= ``` -------------------------------- ### Type-Check Code Source: https://context7.com/jb3ai/eaglestar/llms.txt Run this command to perform type-checking on the codebase without emitting any files. This helps ensure code quality. ```bash npm run lint ``` -------------------------------- ### POST /api/contact - Submit Service Inquiry Source: https://context7.com/jb3ai/eaglestar/llms.txt Submit a detailed service inquiry including full name, email, phone, service, and message. An optional company field is also accepted. A 400 error is returned for missing required fields or an invalid service. ```bash curl -s -X POST http://localhost:3001/api/contact \ -H "Content-Type: application/json" \ -d '{ "fullName": "Sipho Ndlovu", "email": "sipho@logistics.co.za", "phone": "+27 11 234 5678", "company": "National Logistics Hub", "service": "intelligence", "message": "We need undercover operatives to investigate stock shrinkage in our Johannesburg warehouse." }' | jq ``` ```bash curl -s -X POST http://localhost:3001/api/contact \ -H "Content-Type: application/json" \ -d '{ "fullName": "Sipho Ndlovu", "email": "sipho@logistics.co.za", "service": "intelligence", "message": "Shrinkage investigation needed." }' | jq ``` -------------------------------- ### SignupModal Component Integration Source: https://context7.com/jb3ai/eaglestar/llms.txt Use the SignupModal component in your App.tsx file to manage a modal overlay for user registration. Control its visibility with the isOpen and onClose props. ```tsx import { useState } from 'react'; import { SignupModal } from './components/SignupModal'; export default function App() { const [isSignupOpen, setIsSignupOpen] = useState(false); return ( <> setIsSignupOpen(false)} /> ); } ``` -------------------------------- ### POST /api/contact — Submit a service inquiry Source: https://context7.com/jb3ai/eaglestar/llms.txt Accepts a full inquiry payload including `fullName`, `email`, `phone`, `service`, `message` (all required) and an optional `company`. The record is inserted into `contact_requests` and the new row ID is returned. Passing an unrecognized or empty `service` also triggers a 400. ```APIDOC ## POST /api/contact ### Description Submits a detailed service inquiry. Requires full name, email, phone, service, and message. An optional company field can also be included. Returns the new row ID upon successful submission. ### Method POST ### Endpoint /api/contact ### Parameters #### Request Body - **fullName** (string) - Required - The full name of the inquirer. - **email** (string) - Required - The email address of the inquirer. - **phone** (string) - Required - The phone number of the inquirer. - **service** (string) - Required - The service the inquirer is interested in. - **message** (string) - Required - The detailed message from the inquirer. - **company** (string) - Optional - The name of the inquirer's company. ### Request Example ```json { "fullName": "Sipho Ndlovu", "email": "sipho@logistics.co.za", "phone": "+27 11 234 5678", "company": "National Logistics Hub", "service": "intelligence", "message": "We need undercover operatives to investigate stock shrinkage in our Johannesburg warehouse." } ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the newly created contact request. - **message** (string) - Confirmation message. #### Response Example ```json { "id": 3, "message": "Inquiry submitted successfully" } ``` #### Error Response (400) - **error** (string) - Message indicating missing required fields or an invalid service. ``` -------------------------------- ### Logo Component Variants Source: https://context7.com/jb3ai/eaglestar/llms.txt Render the brand logo using the Logo component. Supports different variants for light and dark backgrounds, and an icon-only mode. ```tsx import { Logo } from './components/Logo'; ``` -------------------------------- ### ContactForm Component Usage Source: https://context7.com/jb3ai/eaglestar/llms.txt Integrate the ContactForm component into any section of your React application. It manages its own state and performs client-side validation before submission. ```tsx import { ContactForm } from './components/ContactForm'; export default function InquiryPage() { return (
); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.