Skip to content

Implement meshinfo-network: Strapi + Astro centralized instance directory#2

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/design-meshinfo-network-architecture
Draft

Implement meshinfo-network: Strapi + Astro centralized instance directory#2
Copilot wants to merge 2 commits intomainfrom
copilot/design-meshinfo-network-architecture

Conversation

Copy link

Copilot AI commented Mar 26, 2026

Replaces the stub Python/FastAPI app with a full Strapi 5 + Astro 5 architecture for a moderated public directory of MeshInfo instances.

Strapi backend (strapi/)

  • 3 content types: MeshInstance (status/visibility workflow, bcrypt-hashed auth token, unique canonicalUrl), StatsSnapshot (coarse node count + geographic bounds), HeartbeatEvent (event log)
  • Custom routes on top of Strapi's default CRUD:
    • POST /api/register — canonicalizes URL, creates pending record, generates 32-byte token, returns plaintext once, stores bcrypt hash
    • POST /api/instances/:id/heartbeat — token-authenticated lastSeenAt update + event log
    • POST /api/instances/:id/stats — token-authenticated stats snapshot ingestion
    • GET /api/instances[/:id] — returns only status=approved + visibility=public records (consumed server-side by Astro)
  • lib/canonicalUrl.js — strips protocol/trailing slashes, lowercases host, preserves paths/subdomains/ports; 11 unit tests
  • lib/tokenHelper.jscrypto.randomBytes(32) + bcryptjs hash/verify
  • SQLite via better-sqlite3; DATABASE_CLIENT env var makes Postgres a one-line switch

Astro frontend (frontend/)

  • output: 'hybrid' — home page is statically prerendered; instances listing and detail are SSR for freshness
  • src/lib/strapi.ts fetches from Strapi server-side only; STRAPI_TOKEN never reaches the browser
  • Dark-mode indigo Tailwind palette aligned with MeshInfo's visual language

Networking model (docker-compose.yml + nginx/nginx.conf)

  • Strapi service has no ports: — attached only to the internal Docker bridge network
  • nginx: :80 → Astro (public), :1337 → Strapi admin panel; location /api { return 403; } blocks content API access on the public port
  • STRAPI_URL=http://strapi:1337 is the only path Astro uses to talk to Strapi

Docs

  • README.md — architecture diagram, content model, API reference, Docker + local dev guide, env var table
  • docs/canonical-url.md, docs/registration-flow.md, docs/meshinfo-integration.md (Phase 2 Python integration plan with code samples)

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Design and implement meshinfo-network as centralized directory Implement meshinfo-network: Strapi + Astro centralized instance directory Mar 26, 2026
Copilot AI requested a review from daviesgeek March 26, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants