Nexus Mapping is more than just an application; it is a reference architecture for building modern, secure, and scalable full-stack solutions. It serves as a live demonstration of a professional, decoupled monorepo leveraging a bleeding-edge, serverless-first technology stack.
The platform provides a complete administrative dashboard for visualizing, managing, and analyzing geographic data points, architected as a "Public Sandbox" that automatically resets hourly for an interactive and risk-free user experience.
Our development philosophy is decoupled, serverless-first, and type-safe. The project is built as a pnpm
monorepo, ensuring a clean separation of concerns between the frontend and backend while maintaining a unified development experience.
graph TD
subgraph "User Interface Layer"
U[User's Browser]
end
subgraph "Application Layer (Cloudflare)"
A[Admin Dashboard<br/>SvelteKit on Pages]
B[API<br/>Hono on Workers]
end
subgraph "Data & Services Layer"
DB[(Database<br/>Cloudflare D1)]
ExtAuth[Authentication<br/>Google OAuth via Auth.js]
Cron[Cron Trigger<br/>Scheduled Reset]
end
U -- "Interacts with" --> A
A -- "Calls API" --> B
B -- "Queries" --> DB
A -- "Redirects for Login" --> ExtAuth
B -- "Validates JWT from" --> ExtAuth
Cron -- "Triggers" --> B
Category | Technology |
---|---|
Monorepo | pnpm Workspaces |
Frontend | SvelteKit (Svelte 5), TypeScript, Tailwind CSS v4, shadcn-svelte , MapLibre GL JS |
Backend API | Hono on Cloudflare Workers |
Database | Cloudflare D1 (SQL), wrangler for migrations |
Authentication | Auth.js / SvelteKitAuth with Google Provider |
Automation | Cloudflare Cron Triggers for scheduled tasks |
Tooling | Vite, ESLint, Prettier |
pnpm
package manager (npm install -g pnpm
)git clone https://github.com/BuildTheNexus/NexusMapping.git
cd NexusMapping
pnpm install
You will need to create two .dev.vars
files for the local development servers.
For the Worker (apps/nexusmapping-worker/.dev.vars
):
# Get these from your Google Cloud Platform console
GOOGLE_CLIENT_ID="YOUR_GOOGLE_CLIENT_ID"
GOOGLE_CLIENT_SECRET="YOUR_GOOGLE_CLIENT_SECRET"
ADMIN_APP_GOOGLE_CLIENT_ID="YOUR_GOOGLE_CLIENT_ID" # Often the same as above
# Generate a long, random string: openssl rand -base64 32
AUTH_SECRET="YOUR_AUTH_SECRET"
# For the Public Sandbox, this can be left empty or contain your primary admin email
ADMIN_EMAILS="[email protected]"
# A long, random string to protect the reset endpoint
DB_RESET_SECRET="a-very-long-and-random-string-for-security"
For the Admin App (apps/nexusmapping-admin/.env
):
# Your API key from maptiler.com
VITE_MAPTILER_API_KEY="YOUR_MAPTILER_API_KEY"
These commands are run from the apps/nexusmapping-worker
directory.
cd apps/nexusmapping-worker
# Create the local database file
pnpm wrangler d1 migrations apply nexusmapping-db --local
# Seed the database with initial data
pnpm wrangler d1 execute nexusmapping-db --local --command="DELETE FROM map_points"
pnpm exec wrangler d1 execute nexusmapping-db --local --command="DELETE FROM users"
pnpm exec wrangler d1 execute nexusmapping-db --local --file=./migrations/seed.sql # (Note: You may need to create this seed file)
Self-correction: A seed.sql
is more robust. For now, the user-driven seeder is sufficient for local dev.
Run this command from the project root.
pnpm dev
http://localhost:5173
.http://localhost:8788
.This project served as a testbed for several key architectural patterns:
viewer
role, we chose to grant all public users temporary admin privileges. This is combined with a self-healing, hourly database reset via a Cloudflare Cron Trigger, providing a fully interactive and risk-free demo experience.h-screen
vs min-h-screen
) and implementing a performant, lazy-loading video (onMount
with data-src
) to create a powerful first impression without sacrificing page speed.hono-rate-limiter
) proved incompatible with the Cloudflare Worker's runtime, we engineered a dependency-free, in-memory rate-limiter from scratch that respects the runtime's constraints.Built by PT AiTi Global Nexus.