The client is the React/Vite website for the CodeWithHassan portfolio, blog, services, reader accounts, and admin interface. The API is in the sibling server/ directory.
- Node.js 24.x and npm
- The API running locally or a deployed API URL
From this client/ directory:
npm installCreate a .env file in this directory:
VITE_API_URL=http://localhost:5000/apiStart the development server:
npm run devVite prints the local URL, usually http://localhost:5173. In development, VITE_API_URL can point to a local API. In production, API requests use the same-origin /api proxy configured in vercel.json so authentication cookies work reliably.
| Command | Description |
|---|---|
npm run dev |
Start Vite in development mode |
npm run build |
Create a production build in dist/ |
npm run preview |
Serve the production build locally |
npm run lint |
Run ESLint |
| Route | Description |
|---|---|
/ |
Portfolio homepage; shows a short About section and up to three project/profile cards |
/about |
Full About page |
/projects |
Published project portfolio |
/profiles |
Published external profiles |
/blogs |
Searchable and paginated published blog list |
/blog/:slug |
Public article with reactions, comments, and save controls |
/courses |
Public published course catalog and course details |
/books |
Public published book catalog and book details |
/services |
Service cards, custom quote details, and inquiry path |
/login |
Reader login |
/signup |
Reader account registration |
/dashboard |
Protected reader overview |
/dashboard/saved |
Saved articles |
/dashboard/reactions |
Reader reactions |
/dashboard/history |
Reading history |
/dashboard/comments |
Reader's comments, with edit/delete controls |
/dashboard/profile |
Reader display name and profile details |
/dashboard/settings |
Account actions |
/admin |
Admin login |
/admin/dashboard |
Protected content overview with blog, book, course, project, and profile counts |
/admin/blogs |
Protected blog management |
/admin/courses |
Protected course CRUD and publication controls |
/admin/books |
Protected book CRUD and publication controls |
/admin/projects |
Protected project CRUD and publication controls |
/admin/profiles |
Protected profile CRUD and publication controls |
src/
├── app/providers/ Theme and app-level providers
├── components/ Shared layout, SEO, and UI components
├── features/
│ ├── admin/ Admin login, dashboard, and blog editor
│ ├── blog/ Blog listing, detail, and reader interactions
│ ├── home/ Homepage sections and contact form
│ ├── services/ Services page
│ └── user/ Reader auth, protected dashboard, and account pages
├── lib/ API base URL configuration
└── styles/ Global Tailwind styles
In development, the client sends requests to VITE_API_URL or http://localhost:5000/api. In production, /api is proxied to the deployed backend by vercel.json.
Reader sign-in and account actions use /api/users/*. Admin content management uses protected /api/blogs/*, /api/courses/*, /api/books/*, /api/projects/*, and /api/profiles/* routes. Public catalogs and portfolios expose only published items. Free published course and book text is stored in MongoDB and readable publicly; only admins can create, edit, publish, or remove entries. Contact form submissions use POST /api/send-email.
Reader accounts require the server's MongoDB configuration. Reader and admin sessions use separate server-side roles and HttpOnly cookies; authentication tokens are not stored in localStorage. Comment ownership is enforced by the server as well as reflected in the interface.
Run npm run build to create dist/. The included vercel.json proxies /api/* requests to the backend and rewrites client-side routes to index.html so direct visits to paths such as /blogs and /dashboard load the React app.
Do not commit .env files. The client is covered by the repository's proprietary license; third-party packages and media remain under their own licenses.