How mateav23/fullstack-app-pern works
Project type and purpose
• From the file tree and README, this is a full-stack product administration system.
• Frontend is a React/TypeScript SPA built with Vite, Tailwind CSS, React Router, Axios, Valibot.
• Backend is a Node.js/TypeScript REST API using Express.js, Sequelize (PostgreSQL), Swagger, Jest for testing.
File structure
• Top level separates “client/” (frontend) and “server/” (backend).
• Frontend:
• src/components, layouts, views → React UI components and pages (NewProduct, EditProduct, Products).
• src/services/ProductService.ts → HTTP client layer (Axios).
• src/router.tsx → client-side routing (React Router).
• Tailwind config, Vite config → build tool and styling pipeline.
• Backend:
• src/server.ts & src/index.ts → application entrypoints.
• src/router.ts → Express routes mounting handlers.
• src/handlers/product.ts → controller layer (CRUD).
• src/models/Product.model.ts → Sequelize ORM models.
• src/config/db.ts → DB connection setup (PostgreSQL).
• src/config/swagger.ts → Swagger documentation setup.
• src/middleware → validation, error handling.
• src/data/index.ts → seed or migration logic.
• __test__ folders → Jest tests for unit/integration.
README for additional insights
• Full CRUD on products, data-validation on both ends, responsive UI, API doc at /docs, automated tests.
• Emphasizes TypeScript safety, layered architecture (frontend <→ backend <→ DB).
a. Main components
1) Browser / Client SPA (React + Valibot + Axios)
2) HTTP/API Layer (Express.js server)
3) Controller/Handler Layer (product handlers, middleware)
4) Data Layer / ORM (Sequelize + models)
5) Database (PostgreSQL)
6) API Documentation (Swagger UI)
7) Testing (Jest) – optional as a side component
b. Relationships & data flows
• Browser sends HTTP requests (GET/POST/PUT/DELETE) via Axios → Express router.
• Router dispatches to handlers → middleware for validation → calls service/data layer.
• Sequelize maps handlers’ queries to SQL → PostgreSQL stores/retrieves data.
• Swagger UI served from Express for /docs.
• Jest tests simulate requests against Express in test environment.
c. Architectural patterns & principles
• Layered (Presentation, API, Business/Controller, Data Access, Persistence).
• Single Page Application with RESTful backend.
• MVC-style separation in backend (router→handler→model).
• Type-safe contracts (TypeScript) and validation at boundary.
d. Key technologies/frameworks
• Frontend: React, TypeScript, Vite, Tailwind CSS, React Router, Axios, Valibot.
• Backend: Node.js, Express, TypeScript, Sequelize, PostgreSQL, Swagger, Jest.