How johnkingzy/postiz-app works
Main Components
• Frontend: Located in apps/frontend, this is the NextJS/React web client. It handles UI, routing, authentication views, and making API calls.
• Backend: Found in apps/backend (built with NestJS). It includes multiple API controllers (e.g., agencies, auth, billing, webhooks) and core modules as defined in the “src” folder.
• Workers: In apps/workers, responsible for asynchronous processing (posts, stars, plugs, etc.) and likely processing/background jobs.
• Cron & Commands: In apps/cron and apps/commands respectively, these run scheduled and CLI-based tasks like token refreshes, checking stars, and syncing trending posts.
• Shared Libraries: Including helper libraries (e.g., authentication, configuration, utilities), NestJS libraries (e.g., database with Prisma repositories, bullMQ transport, integrations), and React shared libraries (e.g., components, forms, helpers). These encapsulate reusable business logic, integrations, and UI elements.
• Database: Managed by Prisma (default PostgreSQL schema as referenced in libraries/nestjs-libraries/src/database/prisma).
• Job Queue/Cache: Redis integrated with BullMQ to handle background processing.
• External Services: Email notifications via Resend, social media integrations (e.g., Facebook, Instagram, Twitter, TikTok, etc.), and other services for analytics and social posting.
Out the Relationships and Interactions
– The Frontend communicates with the Backend through a RESTful (or potentially GraphQL) API layer. In the file tree, API routes are defined in apps/backend/src/api and apps/frontend/src/app/api.
– The Backend uses shared libraries for common business logic and interacts with the Database (using Prisma based on the schema found in libraries/nestjs-libraries).
– The Backend enqueues background jobs into Redis using BullMQ. Workers subscribe to these queues to process tasks asynchronously.
– Cron and Command applications autonomously trigger scheduled tasks or maintenance operations, potentially delegating work to the backend and workers.
– Authentication, integrations, notifications, and media uploads are orchestrated via dedicated modules within the backend and/or shared libraries.
– Shared libraries for React are used to maintain UI consistency across different parts of the frontend.
Architectural Patterns & Important Technologies
– NX Monorepo: Clearly indicates a modular, multi-app structure.
– Microservice-like Split: Even though within one repository, splitting of responsibilities is clear (API backend, frontend client, background workers, etc.).
– MVC or Modular Pattern: Backend modules (controllers, services, middleware) follow best practices in NestJS, while frontend components and pages in NextJS are arranged consistently.
– Asynchronous Processing: Use of Redis/BullMQ for job queues.
– Data Persistence: Prisma as ORM interacting with PostgreSQL.
– Integration: Component-based integrations for multiple social media platforms.
Detailed Elements
– Connect the backend to the Database (Prisma/PostgreSQL) and also to the Redis queue.
– Illustrate external integrations (Resend, various social networks) as endpoints that the backend communicates with.
– Optionally, include the NX Monorepo as an umbrella label indicating that all these modules reside in one coordinated monorepo ecosystem.