How andreydovban/corporative-portal works
Main Components
• Backend Service:
• Entry Point: The “backend/cmd/main.go” file indicates the starting process.
• Configuration & Initialization: Files in “backend/configs” for configuration, “backend/pkg/di” for dependency injection, “backend/pkg/logger” for logging, and “backend/pkg/db” for database connectivity.
• Middleware & Request/Response Handling: Components in “backend/pkg/middleware”, “backend/pkg/request” and “backend/pkg/response” indicate layers for validation, decoding, logging, CORS, and general middleware handling.
• Migrations Utility: “backend/migrations” likely handles schema or data migrations.
• Frontend Service:
• Application Skeleton: The directory “frontend/src/app” along with layout files (e.g., layout.tsx) and various style sheets and page files indicate a Next.js app structure.
• Configuration & Build: Files like “frontend/next.config.ts”, “package.json” and ESLint configurations that help manage build, linting, and overall client-side settings.
• Public Assets & TypeScript Configurations: “frontend/public” and “frontend/tsconfig.json” for static file serving and TypeScript support.
Relationships & Interactions
• The frontend communicates with the backend either via RESTful APIs (or potentially GraphQL, though REST is more common given the structure) – clearly representing a client-server interaction.
• The backend, in turn, interacts with a database (as suggested by “backend/pkg/db”) and possibly other external services (mailer service under “backend/pkg/mailer”) to complete its business logic.
• Middleware and logging layers in the backend indicate that incoming HTTP requests are processed through multiple stages before reaching the internal post handlers.
Architectural Patterns & Principles
• Separation of Concerns: Frontend and backend components are clearly separated.
• Layered Architecture within the Backend: A clear progression from configuration and initialization, business logic (inside "internal") to infrastructure utilities (middleware, logger, db, etc.).
• Dependency Injection: The presence of a dedicated “di” package supports a design that isn’t tightly coupled, promoting testability and flexibility.
• Middleware Pipeline: Several middleware files indicate that the application uses a pipeline approach for processing requests.