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