How aayushbharti/zenith-academy works
Main Components
• Frontend (Next.js Application):
• The app/ directory houses routing, page components, and layout files.
• The components/ folder contains UI and feature-specific components (such as Auth, Dashboard, Home, etc.) built using React and enhanced with Tailwind CSS.
• The store/ folder shows client-side state management, likely implemented with a state management library (such as Zustand or similar).
• The services/ and utils/ folders provide business logic and helper functions that interact with APIs and process data before presentation.
• Backend (Server-Side Application):
• The server/ folder comprises the complete backend, including:
▫ Configurations for cloud services, database, and payment systems (cloudinary.ts, database.ts, razorpay.ts).
▫ Controllers for handling different routes and business logic (Auth, Course, Category, Payments, etc.).
▫ Models that define the data schema (User, Course, Section, etc.).
▫ Middlewares for authentication and demo purposes.
▫ Routes that expose API endpoints to the frontend.
▫ Utility functions for tasks like image uploading and email sending.
▫ Mail templates for various email notifications such as email verification and payment success.
• External and Supporting Services:
• Integration with external services like Cloudinary (for media), Razorpay (for payment processing), and mailing systems (for sending notifications).
• A database as configured by the server (see server/config/database.ts) which underpins data persistence for models such as Course, Profile, etc.
Relationships and Interactions
• The Frontend communicates with the Backend through API calls. This is facilitated via the controllers and custom routes in the server/ folder.
• The Next.js routing in the app/ folder directs users to the proper pages (for authentication, course view, dashboard functions, etc.).
• Requests initiated from UI components might pass through the service layer (services/ folder), which then uses utility functions (utils/ and lib/) to interact with the backend.
• The backend controllers access the database using the models and execute business logic, ensuring a secure and modular interaction with external services.
• State management stores (in the store/ folder) are used on the frontend to manage user authentication, cart, course data, and profile details consistently across the app.
Architectural Patterns & Design Principles
• Separation of Concerns is clear with distinct directories for UI and business logic.
• Modular Design: Each feature (authentication, course management, dashboard) is encapsulated both in dedicated pages and via separate controllers and models.
• Layered Architecture: Frontend (UI and client-side logic) is separate from the backend (API, controllers, models, database) along with clearly defined service layers.
• Reusability is bolstered by organizing shared components in the components/ folder and common utilities in utils/, lib/ and data/.
• Route Grouping: The app/ directory uses grouped routes (e.g., (auth), (dashboard), (course-view)) that mirror the structural grouping of functionalities.
Elements
• Client Side (Next.js Frontend): Show subcomponents for pages, layouts, UI components, and state management stores.
• API Layer: Represent the generalized API endpoints provided by the server/ routes and controllers which the frontend communicates with.
• Backend: Include controllers, models, and routes, plus connections to a database and external services.
• External Services: Represent integration with third-party services (Cloudinary, Razorpay, Email services).
• Differentiate UI components (perhaps using rounded rectangles) from backend components (using standard rectangles).