How nirlekaartha/project-kelas-008 works
Project type and purpose
• This is a full-stack web application built with React (frontend) and a Node/TypeScript backend (API server), using Vite for fast HMR, and a relational database defined in database/db_schema.sql.
• The frontend delivers UI for user authentication, blogs, galleries and profiles; the backend exposes REST endpoints and orchestrates business logic; a SQL database persists users, blogs, gallery metadata, etc.
File structure
• Top-level:
• src/client holds React components, pages, routes, layouts, assets, Redux-style slices in store
• src/server contains API routes (api/), controllers (controllers/), data models (models/), middleware, helpers, tests, and file upload handling
• src/services implements domain-level business logic and DB access wrappers
• database/db_schema.sql defines schema; docker-compose.yml orchestrates DB and server containers
• Scripts for DB initialization and dev environment setup
• Patterns:
• MVC-style separation: API → controller → service → model → DB
• Client-side state managed via Redux slices
• Utility modules for cross-cutting concerns (auth, validation, file handling)
README for additional insights
• The README provides guidance on ESLint/TS integration and Vite plugins; confirms React+TS+Vite stack.
a. Main components:
• Frontend (React + Vite dev server)
• Backend API Server (Node.js + TypeScript + Express or built-in HTTP server)
• Database (PostgreSQL or chosen SQL engine)
• File Storage (uploads directory or external storage if configured)
• External services (e.g., authentication provider or cloud storage if used)
b. Relationships and interactions:
• Browser ↔ Frontend: HTTP(S) for web UI, HMR in dev
• Frontend → Backend API: REST calls (login, CRUD on blogs/gallery/users)
• Backend → Database: SQL queries via dbServices
• Backend → File Storage: read/write user uploads
• Services layer orchestrates model operations and returns domain DTOs
c. Architectural patterns:
• Client-server separation with a clear API boundary
• Controller-Service-Model layering in the backend
• Redux (slice) pattern for client state management
• Utility modules for shared concerns (validation, auth tokens, file handling)
d. Key technologies and libraries:
• Frontend: React, Vite, TypeScript, Redux Toolkit (authSlice, blogSlice, etc.)
• Backend: Node.js, TypeScript, Express/HTTP server, middleware, controllers
• Database: SQL engine defined in db_schema.sql, connection managed via dbConnection.ts
• Deployment/config: Docker Compose, shell/PowerShell scripts for setup
Detail
• Every major directory as a node or sub-node (e.g., src/client/components, src/server/middleware).
• How scripts/init-db.sh and docker-compose.yml tie into the overall deployment.
• Shared utility modules (authUtils, validationUtils) as reusable components across services and controllers.