How valerakoz/photographer-service works
Main Components
• Frontend/UI Layer:
– Represented by the Next.js pages and components under src/app (e.g., dashboard, photo gallery, modal dialogs, etc.) and UI components under src/components and src/ui.
– This is responsible for rendering pages, interacting with users, and presenting the dashboard and photo management interfaces.
• API / Backend Layer:
– Next.js API routes under src/app/api handle backend functions such as authentication (with Yandex), photo management, and project/folder operations.
– These routes encapsulate RESTful endpoints (or possibly edge functions) that serve data to the UI.
• Database Layer:
– The prisma directory, containing a Prisma schema (prisma/schema.prisma), database migrations, and the generated Prisma client (prisma/prisma-client.ts) indicates that the persistent data (projects, folders, user data, photos, etc.) is managed via a relational database through Prisma ORM.
• External Services:
– Authentication via Yandex is clearly integrated (files under src/app/api/auth/ and utils/auth/yandex).
– There is an S3 integration for file uploads (src/service/S3Client and src/service/file-upload), which represents a connection to an external object storage service.
• Utility & State Management:
– State management and helper functions are in src/lib/store and src/lib/helpers.
– Global query management is hinted by src/lib/queryClient which might be using a client like React Query.
Relationships and Data Flow
• The UI (frontend) makes requests (using RESTful API or possibly GraphQL endpoints) to the API endpoints provided by Next.js under src/app/api for various functions:
– Authentication endpoints handle sign-in/up via Yandex.
– Photo and project endpoints handle file and project management.
• The API layer interacts with the Database via Prisma to persist and query data.
• For file upload and storage, the API layer or dedicated service calls the S3Client service to upload files to the external S3 storage.
• Utility functions and middleware (e.g., src/middleware.ts) facilitate session management, authentication, and possibly error handling.
Architectural Patterns and Design Principles
• Modular, Component-Based Architecture:
– Separation between UI components (React components) and API routes.
– Code is logically organized: dashboard files, form components, and modal management help maintain a clean separation of concerns.
• Server-Side Rendering (SSR) and API integration:
• Data Access Layer via Prisma ORM:
– All database interactions go through Prisma, emphasizing abstraction between the raw database and business logic.
• External Service Integration: