How oussama-filali/usine-ia works
1. This repository is a small monorepo with two runtime surfaces:
- immersive-brain/: the main interactive frontend
- api/: a Node-based backend and data/maintenance layer
Supporting material lives in docs/ and the repo root.
2. The frontend is a Vite + TypeScript app (immersive-brain/) built around React components. Its architecture is section-driven rather than page-driven: HeroSection, Intro, MissionSection, ProjectsSection, TeamSectionUpdated, NewsletterSection, and related “Updated” variants indicate a single long-form landing experience composed of modular sections.
3. A major distinguishing feature of the frontend is its immersive/visual layer. Components like BrainScene, SpaceStationScene, SpaceBoiSection, HeartMorph, Particles, SketchfabViewer, and AudioLayer/AmbientAudio point to a presentation-heavy UI with 3D models, animated effects, and layered audio. Static assets in public/models and public/images are part of that visual subsystem.
4. The frontend entry path is standard for a Vite app: src/main.tsx boots App.tsx, which then assembles the section components. global.css and tailwind.config.cjs indicate Tailwind-based styling with global CSS for theme/layout control. useScrollReactive.ts suggests scroll position is used to drive interactive transitions or reveal effects across sections.
5. There is a clear error/isolation boundary in the UI through ErrorBoundary.tsx, which is important because the app contains heavy media/3D dependencies that can fail independently. SpaceBoiLoader.tsx also suggests asynchronous loading states for expensive assets.
6. The backend in api/ is a separate Node service with server.js as the main runtime entry. Based on the file set, it likely exposes HTTP endpoints used by the frontend for content or newsletter interactions, while also handling data access and scheduled/batch tasks. The presence of a dedicated package.json and lockfile reinforces that it is deployed independently from the frontend.
7. Persistence is centered on Supabase. The api/supabase/ folder contains SQL for create-articles-table.sql, create-newsletter-table.sql, drop-newsletter-table.sql, and fix-rls-newsletter.sql, so the backend’s data boundary is a Postgres-backed Supabase database with row-level security concerns. This means the system’s main durable state is article content and newsletter signups/digest data.
8. There are two clear backend data flows:
- import-articles.js likely seeds or syncs article content into the articles table.
- newsletter-digest.js likely assembles newsletter-related output from stored data, probably for distribution or reporting.
test-db.js is a validation utility for database connectivity/schema assumptions.
9. The frontend/backend integration boundary is likely newsletter- and content-oriented. The NewsletterSection on the frontend corresponds to the newsletter table and digest tooling on the backend, while “projects”/content sections likely consume article data or static content surfaced through the API. The repo does not show a CMS; instead it appears to rely on Supabase tables plus import scripts.
10. Deployment/runtime hints matter here:
- immersive-brain/public/.htaccess suggests the frontend may be deployed to an Apache-hosted static environment.
- docs/build.bat and docs/start.bat plus root commit*.bat suggest Windows-oriented local workflow scripts.
- api/.env.example and root .env.example show environment-based configuration for both services.
11. The docs/ folder is operational/documentation support, not a runtime subsystem. FRONTEND-DESIGN-README.md and CHANGELOG.md likely capture design decisions and release history, which is useful for understanding why the frontend is heavily componentized and visually complex.
12. For an architecture diagram, the best high-level shape is:
- Users interact with the React/Vite frontend.
- The frontend renders an immersive single-page experience with 3D/audio/scroll effects.
- It calls a separate Node API for newsletter/content-related operations.
- The API reads/writes Supabase/Postgres tables and runs maintenance/import scripts.
- Static media assets are served directly from the frontend’s public/ folder.
Main entry points: App.tsx App · server.js Server · supabase/README.md Supabase · README.md README
Components 27
Repo
Workspace and top-level guidance
- README · Top-level repository overview
README.md - Env example · Shared environment template
.env.example
Frontend
Vite + React immersive landing app
- Main · Bootstraps the frontend app
immersive-brain/src/main.tsx - App · Assembles the long-form immersive experience
immersive-brain/src/App.tsx - Boundary · Protects heavy visual components from runtime failures
immersive-brain/src/components/ErrorBoundary.tsx - Scroll hook · Drives scroll-reactive transitions and reveals
immersive-brain/src/hooks/useScrollReactive.ts - Hero · Primary landing hero section
immersive-brain/src/components/HeroSection.tsx - Intro · Introductory section variant
immersive-brain/src/components/IntroUpdated.tsx - Mission · Mission and narrative section
immersive-brain/src/components/MissionSection.tsx - Projects · Projects and content showcase
immersive-brain/src/components/ProjectsSection.tsx - Team · Team section variant
immersive-brain/src/components/TeamSectionUpdated.tsx - Newsletter · Newsletter signup and call to action
immersive-brain/src/components/NewsletterSectionUpdated.tsx - Brain scene · Core immersive brain visual
immersive-brain/src/components/BrainScene.tsx - Station scene · Space station visual environment
immersive-brain/src/components/SpaceStationScene.tsx - SpaceBoi · Animated character section and related loading flow
immersive-brain/src/components/SpaceBoiSection.tsx - Audio layer · Ambient audio and layered sound controls
immersive-brain/src/components/AudioLayerUpdated.tsx - Effects · Particles, morphing visuals, and embedded viewer
immersive-brain/src/components/Particles.tsx - Loader · Loading state for expensive 3D assets
immersive-brain/src/components/SpaceBoiLoader.tsx
Backend
Node API and maintenance scripts
- Server · Main backend runtime entry
api/server.js - Import articles · Seeds or syncs article content
api/import-articles.js - Digest · Builds newsletter digest output
api/newsletter-digest.js - DB test · Checks database connectivity and schema assumptions
api/test-db.js
Data
Supabase/Postgres persistence and schema
- Supabase · Articles and newsletter tables with RLS-managed persistence
api/supabase/README.md - Articles SQL · Creates the articles table
api/supabase/create-articles-table.sql - Newsletter SQL · Creates and repairs newsletter storage and RLS
api/supabase/create-newsletter-table.sql
Docs
Operational and design documentation
- Design notes · Frontend architecture and design rationale
docs/FRONTEND-DESIGN-README.md - Changelog · Release and change history
docs/CHANGELOG.md
Connections 29
- README → App: describes · Repository overview points to the main frontend experience
- README → Server: describes · Repository overview points to the backend service
- Main → App: boots · Vite entry mounts the application shell
- App → Boundary: wraps · App uses an error boundary around fragile UI
- App → Scroll hook: drives · Scroll state feeds interactive section transitions
- App → Hero: assembles · Long-form landing experience starts with the hero
- App → Intro: assembles · App composes the narrative intro section
- App → Mission: assembles · App composes the mission section
- App → Projects: assembles · App composes the projects showcase
- App → Team: assembles · App composes the team section
- App → Newsletter: assembles · App composes the newsletter call to action
- App → Brain scene: renders · App includes immersive 3D brain visuals
- App → Station scene: renders · App includes space-station scene visuals
- App → SpaceBoi: renders · App includes character-centric visual section
- App → Audio layer: layers · App layers ambient and interactive audio
- App → Effects: layers · App uses motion effects and embedded 3D media
- App → Loader: guards · App shows loading states for heavy assets
- Server → Import articles: runs · API service has maintenance/import entry points
- Server → Digest: runs · API service has newsletter batch output
- Server → DB test: validates · API service includes database validation tooling
- Server → Supabase: reads/writes · Server communicates with Supabase-backed persistence
- Import articles → Articles SQL: loads · Article import script populates article schema
- Digest → Newsletter SQL: uses · Digest generation relies on newsletter data
- DB test → Supabase: checks · Validation script verifies database access and schema
- Articles SQL → Supabase: defines · Articles table lives in the Supabase database boundary
- Newsletter SQL → Supabase: defines · Newsletter table and RLS fixes live in Supabase
- Newsletter → Server: submits to · Newsletter UI likely integrates with the backend API
- Design notes → App: documents · Design notes explain the componentized landing experience
- Changelog → README: tracks · Change history complements the repository overview