Engineering
How I think about building software: architecture, quality and trade-offs.
“From this repository” is real code in this site. “Illustrative” is a pattern, not a production system I shipped. “Conceptual” is knowledge and practice, not a claim that this portfolio runs that stack.
This site is Server Components by default, with self-hosted fonts and no client data library. The Playground is the main client bundle and loads on that route. There is no fabricated Lighthouse score here.
Frontend architecture
How I structure React and Next.js applications.
- Small, cohesive components. Reuse only when the duplication is real, not to save a few lines.
- Server Components by default; Client Components only for interactivity and browser APIs.
- State lives close to where it is used. No global store without a real need.
- Forms validate at the boundary with schemas and give accessible, specific feedback.
- UI stays free of business rules. Data access goes through services and repositories, so the data source can change without rewriting the UI.
- UI
- Hooks
- Services
- Repository
- Mock / API
// app/projects/page.tsx: Server Component, no client JavaScript
export default async function ProjectsPage() {
const projects = await projectService.list();
return <ProjectList projects={projects} />;
}
// features/projects/ProjectFilter.tsx: Client Component only where interaction needs it
"use client";
export function ProjectFilter({ onChange }: { onChange: (query: string) => void }) {
return (
<input
type="search"
aria-label="Search projects"
onChange={(event) => onChange(event.target.value)}
/>
);
}Backend architecture
How I organize REST APIs with Node.js and NestJS.
- REST resources with clear verbs and meaningful status codes.
- Controllers handle HTTP, services hold business rules, repositories handle persistence.
- Input is validated at the boundary (DTOs and schemas) before it reaches business logic.
- Cross-cutting concerns such as authentication, logging and error mapping live in middleware, guards and filters.
- API contracts are documented with OpenAPI, so clients and servers share one source of truth.
- Consistent error responses that never leak internal details.
- Request
- Middleware
- Controller
- Service
- Repository
- Database
@Controller("users")
export class UsersController {
constructor(private readonly users: UsersService) {}
@Get(":id")
findOne(@Param("id") id: string) {
return this.users.findOne(id);
}
@Post()
create(@Body() dto: CreateUserDto) {
return this.users.create(dto);
}
}
@Injectable()
export class UsersService {
constructor(private readonly repository: UsersRepository) {}
async findOne(id: string) {
const user = await this.repository.findById(id);
if (!user) throw new NotFoundException("User not found");
return user;
}
}Database
Relational modeling with PostgreSQL and Prisma.
Conceptual only: this portfolio does not use a real PostgreSQL database. The playground runs on in-memory mock data.
- Entities, constraints and relationships are modeled explicitly.
- The Prisma schema is the typed source of truth for models and migrations.
- CRUD operations go through a repository, never directly from controllers or components.
- One-to-many relationships, such as users and their tickets, expressed with foreign keys.
model User {
id String @id @default(uuid())
email String @unique
tickets Ticket[]
}
model Ticket {
id String @id @default(uuid())
title String
assignee User @relation(fields: [assigneeId], references: [id])
assigneeId String
}Testing
Tests that give confidence, not just coverage.
This project uses Vitest and Testing Library; in professional work I use Jest.
- Unit tests for pure domain rules and utilities.
- Component tests with Testing Library, using roles and labels to verify behavior instead of implementation.
- Integration tests where layers meet, such as a service working with its repository.
- End-to-end tests for critical user flows. This is a concept here: this project has no E2E suite.
it("toggles the theme attribute and persists the choice", async () => {
const user = userEvent.setup();
render(<ThemeToggle />);
await user.click(screen.getByRole("button", { name: /switch to light theme/i }));
expect(document.documentElement).toHaveAttribute("data-theme", "light");
expect(window.localStorage.getItem(THEME_STORAGE_KEY)).toBe("light");
});Performance
Decisions backed by a reason, not guesswork.
- Server Components and static rendering to ship less JavaScript.
- Code splitting and lazy loading for heavy client code that is not needed on first paint.
- Optimized images and fonts with next/image and next/font.
- Avoid unnecessary re-renders: measure first, memoize only with evidence.
- An explicit caching and revalidation strategy for data fetching.
Accessibility
A requirement, not a final polish step.
- Semantic HTML first; ARIA only when native semantics are not enough.
- Everything is reachable and operable with the keyboard, with visible focus.
- Modals and drawers use the native dialog element, which provides focus trapping, Escape and focus return.
- Sufficient color contrast in both themes, and no information conveyed by color alone.
- Accessible names for icon buttons, a sensible heading hierarchy and respect for reduced motion.
useLayoutEffect(() => {
const dialog = ref.current;
if (!dialog) return;
if (open && !dialog.open) dialog.showModal();
if (!open && dialog.open) dialog.close();
}, [open]);
return (
<dialog ref={ref} aria-label={label} onClose={onClose} className={...}>
{children}
</dialog>
);Security
Treated as an engineering requirement, even for a portfolio.
This portfolio has no authentication and stores no user data; these are the principles I follow.
- Validate and sanitize all external input at trust boundaries.
- Never render untrusted HTML: React escapes by default and dangerouslySetInnerHTML is avoided.
- External links use rel="noopener noreferrer".
- Secrets live only in server-side environment variables, never in client bundles.
- Authentication proves who you are; authorization decides what you can do and is enforced on the server.
- Secure API design: least privilege, input limits and consistent error handling.
AI-assisted engineering
AI is a tool inside an engineering process, not a replacement for it.