How terence0-8/sq-main works
1. Overall shape
- Solitiquo is a monolithic Node.js web app split into a backend API/server and a mostly static frontend built with HTML/CSS/vanilla JavaScript.
- The frontend is page-oriented, not SPA-oriented: each major section has its own HTML entry point and page-specific CSS.
2. Frontend presentation layer
- Top-level HTML pages cover the public site and back-office/editor views: articles, podcasts, emissions, parties, search, authentication, profile, payments, contact, legal pages, and admin/editor pages.
- CSS is organized by page under css/pages, with a shared base stylesheet in css/shared.css.
- Client-side JavaScript is modular and small in scope: js/api.js for server calls, js/i18n.js for language handling, js/lazyload.js, js/urlBuilder.js, and a general site script js/solitiquo.js.
- PWA/offline behavior is present via manifest.json, sw.js, and offline.html.
3. Backend server boundary
- The backend is an Express application under backend/, with server.js as the entry point.
- It exposes route modules for domain areas rather than a single generic API: articles, auth, comments, search, subscriptions, analytics, language, translate, polls, podcasts, parties, emissions, contact, admin, and legacy redirects.
- This makes the backend the central integration layer between browser pages, authentication, database, media storage, and payment services.
4. Domain-oriented routes
- Content APIs are split by business object: articles, podcasts, emissions, parties, polls, and comments.
- Platform functions live in separate routes: auth, subscriptions, search, analytics, language, translate, contact, and admin.
- legacyRedirects suggests the app preserves older URLs and funnels them to current content routes, which matters for SEO and stable links.
5. Middleware and request pipeline
- The request pipeline includes auth/session checks (middleware/auth.js), CSRF protection (middleware/csrf.js), input sanitization (middleware/sanitize.js), slug-based content resolution (middleware/slugResolver.js), and upload handling (middleware/upload.js).
- This indicates a fairly defensive server boundary: requests are validated and normalized before reaching route handlers.
- Passport-based authentication is configured separately in backend/config/passport.js, with OAuth support in addition to local login.
6. Data layer
- PostgreSQL is the primary persistence layer, configured from backend/config/database.js.
- Schema management is explicit: there is an initial schema migration plus later migrations for full-text search, OAuth columns, featured podcasts, and reading milestones.
- There is also a backend/database/ folder containing a schema dump and seed data, which suggests both bootstrapping and reference schema artifacts are tracked in-repo.
7. Media and external storage
- Cloudinary is used for external media storage, configured in backend/config/cloudinary.js.
- The presence of upload middleware and content editor pages implies that images or other assets are uploaded from the admin/editor interface and stored externally rather than in the app server.
8. Authentication and identity
- Authentication uses Passport with local login plus Google and Facebook OAuth, as reflected in the README and the migration adding OAuth support.
- Session security depends on environment configuration, especially SESSION_SECRET.
- The auth subsystem is likely used by both public user accounts and privileged editorial/admin workflows.
9. Payments and subscriptions
- Subscriptions are a separate subsystem, with dedicated routes and a payment utility in backend/utils/fedapay.js.
- The repo also includes payment success and payment pages on the frontend, showing a user-facing checkout flow.
- A migration for subscription payment IDs indicates subscriptions are persisted and reconciled with an external payment provider.
10. Content enrichment and platform services
- translationService.js and translation-related routes/migrations indicate multilingual content support and translation caching.
- Full-text search is supported at the database level and exposed through a search route.
- Analytics has its own route and legacy migration scripts, implying tracked engagement metrics are a first-class subsystem rather than an afterthought.
11. SEO and publishing support
- seoController.js, slug resolution middleware, and legacy redirect handling point to SEO being a core architectural concern.
- The article.html / editor pages and “reading milestones” migration suggest the platform tracks article consumption in addition to publishing content.
- This is consistent with a media site where canonical URLs, translations, and content discoverability matter.
12. Operations, automation, and quality gates
- The repo includes Docker support, GitHub Actions CI, ESLint/Prettier, and Node’s built-in test runner.
- Test coverage is route-focused (auth.test.js, subscriptions.test.js) with a dummy test retained to satisfy CI globbing.
- Maintenance scripts exist for migrations, translations, favicon/header injection, CSS minification, and status/data sync tasks, indicating a codebase with significant build-time content processing.
13. How data moves through the system
- A browser loads a static page, then page JS calls the Express backend.
- The backend authenticates the user, validates/sanitizes the request, resolves content by slug or ID, queries PostgreSQL, and may enrich data via translation/search/analytics logic.
- For uploads or paid features, the backend also talks to Cloudinary and the payment provider before persisting final state in Postgres.
14. What to draw as the main boundaries
- Draw three primary blocks: frontend presentation, Express backend/API, and PostgreSQL.
- Add side integrations for Cloudinary, OAuth providers, and the payment gateway.
- Inside the backend, separate content management, auth, subscriptions/payments, search/analytics, and translation as distinct subsystems because they are implemented as independent routes/services rather than a single generic API layer.
Main entry points: server.js Express app · articles.js Content API · auth.js Platform API · database.js Postgres
Components 17
Frontend
Static pages, browser scripts, and offline shell.
- Pages · Page-oriented HTML entry points for public, account, editor, and legal views.
index.html - Styles · Shared stylesheet plus page-specific CSS under css/pages.
css/shared.css - Client JS · Small browser modules for API calls, i18n, lazy loading, and URL building.
js/api.js - PWA shell · Manifest, service worker, and offline fallback for installable/offline behavior.
manifest.json
Backend
Express server, request pipeline, routes, and services.
- Express app · Backend entry point that wires middleware, routes, and startup.
server.js - Pipeline · Auth, CSRF, sanitization, slug resolution, and upload handling.
backend/middleware/auth.js - Content API · Articles, podcasts, emissions, parties, polls, comments, and legacy redirects.
backend/routes/articles.js - Platform API · Auth, search, language, translation, contact, admin, and analytics endpoints.
backend/routes/auth.js - Billing · Subscription and payment flows backed by dedicated route logic and payment utility.
backend/routes/subscriptions.js - SEO · Canonicalization, redirect handling, and publishing-friendly URL behavior.
backend/controllers/seoController.js - Translation · Translation logic and cache-oriented content enrichment.
backend/services/translationService.js
Data
Database schema, migrations, and seed artifacts.
- Postgres · Database connection and schema management setup.
backend/config/database.js - Migrations · Initial schema plus later migrations for search, OAuth, featured podcasts, and reading milestones.
backend/migrations/1_initial_schema.js - Schema dump · Tracked schema and seed artifacts used for bootstrapping and reference.
backend/database/schema.sql
Integrations
External services for identity, media, and payments.
- Cloudinary · External storage for uploaded media and editor assets.
backend/config/cloudinary.js - OAuth · Passport-based local auth plus Google and Facebook login.
backend/config/passport.js - Fedapay · External payment provider used for subscriptions and checkout.
backend/utils/fedapay.js
Connections 19
- Pages → Express app: API calls · Page scripts call the backend for data and actions.
- Client JS → Express app: fetch · Browser modules use the Express API boundary.
- PWA shell → Pages: shell · Manifest, service worker, and offline fallback wrap the static frontend.
- Styles → Pages: style · Shared and page-specific CSS style the site pages.
- Express app → Pipeline: uses · Requests pass through defensive middleware before handlers.
- Express app → Content API: mounts · Core content endpoints are mounted on the Express app.
- Express app → Platform API: mounts · Platform and utility endpoints are mounted on the Express app.
- Express app → Billing: mounts · Subscription and payment flows are exposed by the backend.
- Express app → SEO: uses · SEO and redirect handling are part of the server boundary.
- Content API → Postgres: queries · Content handlers persist and read data from Postgres.
- Platform API → Postgres: queries · Platform features depend on the primary database.
- Billing → Fedapay: charges · Subscription checkout and reconciliation use the payment provider.
- Content API → Cloudinary: uploads · Editor and content workflows store media externally.
- Pipeline → OAuth: auth · Passport and OAuth support are enforced at the request boundary.
- Platform API → Translation: translate · Translation endpoints delegate to translation logic.
- Platform API → Migrations: evolves · Search, OAuth, analytics, and other features are backed by migrations.
- Postgres → Migrations: applies · The configured database is shaped by tracked schema changes.
- Postgres → Schema dump: bootstraps · Schema and seed files support initial setup and reference data.
- Content API → SEO: canonicalizes · Content routes cooperate with slug and redirect logic for stable URLs.