How xmlking/spectacular works
Main Components
• Monorepo Structure (Turborepo): Place an overarching “Monorepo” container that includes all apps and shared packages.
• Applications:
– Console: A SvelteKit-based portal (apps/console) that appears to be a core admin/dashboard app.
– Web: A public-facing website (apps/web), built in SvelteKit and Astro components.
– Smart: Another SvelteKit application focusing on “smart” or AI-assisted features.
– Docs: A documentation site (apps/docs) built with Astro.
• Shared Packages:
– UI Library: (packages/ui) containing components, themes, and utilities.
– Typescript and Utils: (packages/typescript-config, packages/utils) for shared configurations and helper functions.
• Backend & Services:
– API endpoints nested under routes (e.g. apps/console/src/routes/api).
– Serverless functions under the functions folder.
– GraphQL & Hasura/Nhost integration (the “nhost” folder holds metadata, migrations, seeds, and email templates).
• Third-Party & External Services:
– Authentication services (Auth.js and nhost-auth).
– GraphQL services via Houdini.
– Email services handled by Nhost.
– Testing tools (vitest for unit tests, playwright for end-to-end tests).
– Deployment tooling (Docker, CI/CD configs in .github folder, and Turborepo’s build and release scripts).
Relationships and Interactions
• Monorepo (Turborepo) at the top as a container that orchestrates multiple apps and shared libraries.
• API layer: within apps/console (and similar apps) the routes (especially those in “api”) interact with external GraphQL and backend services (Hasura, nhost).
• That deployment and build processes are managed centrally via Turborepo scripts and CI/CD workflows (shown in the .github, Dockerfile, and turborepo config files).
• External integrations:
– Authentication services connect to the apps via Auth.js/nhost.
– The GraphQL layer (Houdini) enables communication between the frontend and Hasura databases.
– Testing frameworks feed back into CI pipelines.
Architectural Patterns and Design Principles
• Modularized Design: Multiple SvelteKit apps interacting through shared libraries (UI, utils, types, etc.) within the monorepo.
• Separation of Concerns: The division between frontend (SvelteKit apps, Astro for docs) and backend (serverless functions, GraphQL APIs, authentication).
• Microservice Elements: Even though the project is monolithic in repository structure, the use of functions and separate API routes suggest a service-oriented approach.
• CI/CD and Automated Testing: Emphasize that a robust pipeline exists (with GitHub workflows, linting, formatting tests, E2E tests) which is an integral part of the system.
Specific Technologies and Relationships
• SvelteKit as the primary framework for “Console”, “Smart”, and “Web” apps.
• Astro used for “Docs”.
• Tailwind CSS and supported UI libraries (SkeletonUI, Shadcn, Flowbite) in shared UI components.
• Houdini (GraphQL client) and Hasura for the data layer.
• Docker and serverless deployment configurations.
• CI/CD workflows (GitHub actions, Turborepo build commands) that unify the deployment process.
• Authentication provided by Auth.js and nhost.