How belghalimohammed/dynamic-portfolio works
Project Type and Purpose
• This is a full-stack personal portfolio management application.
• Frontend: a React/TypeScript SPA (create-react-app + CRACO + Tailwind) that serves both a public portfolio site and an authenticated admin console.
• Backend: a Python/Flask REST API providing authentication, CRUD endpoints for portfolio data (hero, about, projects, etc.), file-upload handling, and persistence via a relational database (SQLAlchemy models).
File Structure
• Top-level “frontend” and “backend” directories clearly separate client and server.
• Frontend:
• public/ (static HTML, assets)
• src/ (App.js, React components: portfolio UI, admin UI, shared UI primitives, contexts, hooks, services/api.js)
• configuration: craco.config.js, postcss.config.js, tailwind.config.js
• Backend:
• server.py (Flask app entrypoint)
• auth.py, database.py, models.py, file_upload.py
• .env + requirements.txt
• uploads/ (stored images for hero, projects, etc.)
• tests/ and backend_test.py cover automated backend tests.
• contracts.md likely lists API contracts.
README
• (Assuming it documents overall architecture, setup steps, dependencies, and intended use: public portfolio display + admin management.)
a. Main Components
• Public SPA (React) – fetches portfolio JSON, displays pages.
• Admin SPA (React) – authenticated UI for CRUD operations.
• API Gateway (Flask server) – routes requests to auth, data, file-upload modules.
• Relational Database – stores user, portfolio entities.
• File Storage – local “uploads” directory (or cloud bucket in prod).
• Authentication Service – JWT/Session management within Flask.
• (Optional) Reverse Proxy / Load Balancer – Nginx or similar in front of Flask.
b. Relationships & Interactions
• Frontend → HTTP(S) → Flask API (REST endpoints).
• Flask API → ORM → Database.
• Flask API → File I/O → Uploads directory.
• Admin SPA includes a ProtectedRoute component that checks AuthContext before invoking API.
• Public SPA reads portfolio data, no auth required.
c. Architectural Patterns & Principles
• Client-Server separation (clear frontend vs backend).
• Layered backend: routing → service modules (auth, file_upload, database) → data layer (models).
• Single-Page Application pattern on the client.
• MVC-style partition on the backend (Flask views/controllers, SQLAlchemy models).
• Separation of concerns: UI components vs shared UI library vs data service layer.
d. Key Technologies & Frameworks
• Frontend: React, CRACO, Tailwind CSS, React Router, custom UI primitives.
• Backend: Flask, SQLAlchemy, JWT (or Flask-Login), Werkzeug for file upload.
• Dev toolchain: npm/Yarn, Python pip, dotenv.
Be Detailed and Comprehensive
• Distinct React route/component group (portfolio vs admin) if needed.
• Environment config (dotenv) to show where secrets and URLs are injected.
• Third-party integrations (e.g., CDN for static assets, analytics).
• Document internal module relationships (auth.py ↔ database.py ↔ models.py).