How javiertrujilloserrano/portafolio works
Project type and purpose
• This is a full-stack personal portfolio template.
• Frontend: React + Vite SPA serving cards, translations, form and download link.
• Backend: Node.js + Express API for sending email (Nodemailer) and serving the CV PDF.
File structure
• Top-level:
• client/ – React app
• server/ – Express server
• client/:
• src/hooks – custom hooks (language context, name-effect, privacy popup)
• src/utils – form validations (Zod)
• src/static – translation data, example
• package.json, vite.config.js – build and lint configuration
• server/:
• src/index.mjs & server.mjs – Express app setup and launch
• src/routers/nodemailer-routes.mjs – contact form API
• config/nodemailer.mjs – mail transporter using environment variables
• public/ – static assets (CV PDF)
• .env.example – example configuration
README for insights
• No database: user data is sent by email.
• Uses CORS for cross-origin API calls.
• Privacy policy hook pops up on first visit.
• CV download served via static folder.
Main components & interactions
a. Frontend (React + Vite)
• State/Context: LanguageContext, PrivacyCheckbox
• Utilities: Zod validations, Axios for API calls
• Dev/Build: Vite bundler
b. Backend (Node.js + Express)
• HTTP Server: Express app
• API Router: /api/contact → nodemailer
• Config: dotenv, CORS
• Static server: serves /public/javierTrujilloCV.pdf
c. External services
• Gmail SMTP via Nodemailer
Data flows
1. User loads SPA from Vite dev server or static build hosted somewhere.
2. SPA fetches translation files from its bundle.
3. User fills contact form → frontend uses Axios POST to Express API.
4. Express uses Nodemailer to send email.
5. SPA provides download link → browser GET /javierTrujilloCV.pdf from Express static folder.
Architectural patterns & design principles
• Separation of concerns:
• Presentation (components) vs. form logic (hooks/utils)
• API layer (Express routers) vs. mail configuration (config module)
• Single-page application on client, REST API on server.
• Environment-based config via dotenv.
• Client-side validation with Zod, server just forwards.
• No persistent database – stateless backend.
Diagramming conventions
• Use rectangles for modules (Client, Server, External).
• Blue = client modules
• Green = server modules
• Red = external services
• Environment variables (e.g., .env sends to config).