Skip to content

Lantern — Scaffold Notes

This file describes the current scaffold and how to work with it.

Web scaffold

  • Vite + React
  • PWA enabled via vite-plugin-pwa (configured in vite.config.mjs)
  • Tailwind CSS configured (tailwind.config.cjs, postcss.config.cjs, src/tailwind.css)
  • Storybook for component development (npm run storybook)
  • Vitest + Testing Library for unit tests (vitest.config.js, test.setup.js)

Workspaces

This monorepo uses npm workspaces to manage multiple projects:

WorkspacePathPurpose
admin/adminInternal admin portal linking to Wiki.js for docs editing
discord-bot/discord-botDiscord bot for GitHub issue integration
firebase-functions/firebase-functionsCloud Functions for Firebase backend

Admin Portal

The admin portal (/admin) is an internal-only React app for managing documentation and platform data:

  • Tech Stack: Vite + React (same as main app)
  • Docs Editing: StackEdit or GitHub.dev (direct GitHub integration)
  • Auth: Firebase Auth with admin role check
  • Deployment: Cloudflare Pages at admin.ourlantern.app
  • Git Integration: Edits commit directly to /docs folder in GitHub

Key Files:

  • admin/src/App.jsx — Main app with auth flow
  • admin/src/firebase.js — Firebase config with admin role checking
  • admin/src/components/DocsEditor.jsx — Links to StackEdit and GitHub.dev

Commands:

  • npm run admin:dev — Run admin dev server on port 3001
  • npm run admin:build — Build admin for production
  • npm run admin:preview — Preview built admin portal

Key files

  • Root: package.json, index.html, .gitignore
  • App shell & routing: src/main.jsx, src/App.jsx (hash-based routes)
  • Merchants: src/screens/merchant/MerchantDashboard.jsx, src/screens/merchant/OfferForm.jsx
  • Firebase setup: src/firebase.js
  • Shared helpers: src/lib/ (auth/profile services, encryption, device helpers)
  • PWA: public/manifest.webmanifest, public/icons/*, vite.config.mjs
  • Tests: vitest.config.js, test.setup.js, src/__tests__/
  • Storybook docs: docs/storybook/*

Commands

  • npm install — install dependencies
  • npm run dev — run dev server (Vite)
  • npm run build — production build
  • npm run preview — preview built site (best for PWA testing)
  • npm run storybook — run Storybook on http://localhost:6006
  • npm test — run unit tests (Vitest)
  • npm run lint — lint src
  • npm run lint:fix — autofix lint issues
  • npm run format — format source files
  • npm run format:check — check formatting only
  • npm run test:coverage — run tests with coverage

Mobile (next)

  • Recommended: Initialize an Expo project in /mobile/ with npx create-expo-app mobile.
  • Share UI logic where possible; consider monorepo structure later.

PWA (web)

  • Installable behavior on supported browsers; service worker generated at build time.
  • See ./PWA.md for local testing instructions.

Suggested backend approaches

  • Realtime: Firebase or Supabase for quick prototypes
  • Custom backend: Node.js + Express + WebSocket (or Socket.IO)

Built with VitePress