How chandrashekharagrawal/postiz-app works
Main Components
• Frontend: The NextJS application (located in apps/frontend) is responsible for the user interface and experiences (routing, page layouts, authentication screens, and dashboards).
• Backend API: The NestJS application (in apps/backend) includes numerous API controllers (for agencies, auth, billing, integrations, media, etc.) and services (authentication middleware, public APIs, etc.) to serve as the core business logic layer.
• Background Services:
– Cron: A dedicated module (apps/cron) handling scheduled tasks (e.g., checking for updates, syncing trends).
– Workers: (apps/workers) for processing asynchronous/background jobs, likely triggered via Redis queues.
– Commands: (apps/commands) providing CLI task runners or utility commands.
• Databases & Messaging:
– Database: Prisma is used for interacting with a PostgreSQL database. The libraries subfolders (e.g., libraries/nestjs-libraries) include the Prisma schema and custom repository code.
– Cache/Queue: Redis (via BullMQ) for managing background tasks such as social media posting jobs.
• Email Notifications: Integration with Resend for sending emails (as highlighted in the README).
• External Integrations: Numerous authentication providers and social network integrations are implemented both in the frontend and backend, visible via provider folders for GitHub, Google, wallet, and many social platforms.
• Shared Libraries: Several libraries (e.g., libraries/helpers, libraries/react-shared-libraries, libraries/plugins) house common logic, decorators, utility functions, and plugin systems which support both backend and frontend needs.
Depicting Relationships & Interactions
• Frontend (NextJS) communicating with the Backend API via HTTP/REST calls (or GraphQL if applicable) to perform authentication, schedule posts, manage billing, etc.
• Within the Backend API, illustrate modular services handling specific routes (for example, authentication, billing, notifications) and how they depend on the shared libraries.
• That the Backend interacts directly with the PostgreSQL database (via Prisma) for CRUD operations.
• Integrations with external services (social media APIs, email provider Resend) using interface connectors.
• NX monorepo structure as an overarching “container” that encapsulates all these apps and libraries.
Architectural Patterns & Design Principles
• The application follows a modular, microservices-like architecture even though it lives in a single repository. Highlight the separation of concerns (frontend UI, backend business logic, task scheduling, and command-line utilities).
• The use of dependency injection in NestJS (as seen in the libraries and service files) and middleware for authentication/authorization are key design principles.
• Extensibility: the plugin system and dedicated providers for social media platforms clearly indicate that the architecture is designed to be easily extended to support new functionalities.