A full-stack personal portfolio with a public site for visitors and a protected admin dashboard for managing projects and contact messages — no database GUI or code changes needed to update content.
- Public Portfolio — About, Skills, Projects (loaded dynamically from the database), Contact form
- Admin Dashboard — single-admin login (JWT), add/edit/delete projects, view & manage contact messages
- Full CRUD — projects and messages both stored in MongoDB, managed entirely through the UI
- No frameworks — plain HTML, CSS, and JavaScript frontend
| Layer | Technology |
|---|---|
| Frontend | HTML5, CSS3, JavaScript (Fetch API) |
| Backend | Node.js, Express.js |
| Database | MongoDB + Mongoose |
| Auth | JWT + bcrypt (single admin account, seeded from .env) |
portfolio/
├── backend/
│ ├── config/db.js
│ ├── models/
│ │ ├── Admin.js
│ │ ├── Project.js
│ │ └── Message.js
│ ├── middleware/authMiddleware.js
│ ├── controllers/
│ │ ├── authController.js
│ │ ├── projectController.js
│ │ └── messageController.js
│ ├── routes/
│ │ ├── authRoutes.js
│ │ ├── projectRoutes.js
│ │ └── messageRoutes.js
│ ├── server.js
│ └── .env.example
├── frontend/
│ ├── index.html # Public portfolio site
│ ├── admin-login.html # Admin login
│ ├── admin.html # Admin dashboard (projects + messages)
│ ├── css/style.css
│ └── js/
│ ├── api.js
│ ├── main.js
│ ├── admin-login.js
│ └── admin-dashboard.js
└── README.md
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/login |
❌ | Admin login |
GET |
/api/projects |
❌ | List all projects (public) |
POST |
/api/projects |
✅ | Create a project |
PUT |
/api/projects/:id |
✅ | Update a project |
DELETE |
/api/projects/:id |
✅ | Delete a project |
POST |
/api/messages |
❌ | Submit contact form (public) |
GET |
/api/messages |
✅ | View all messages |
PUT |
/api/messages/:id/read |
✅ | Mark message as read |
DELETE |
/api/messages/:id |
✅ | Delete a message |
cd backend
npm install
cp .env.example .envFill in .env:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_random_secret
ADMIN_EMAIL=you@example.com
ADMIN_PASSWORD=choose_a_strong_password
PORT=5000npm run devOn first run, this automatically creates your admin account from the .env credentials — no separate signup step.
cd ../frontend
npx http-server -p 5500Visit http://localhost:5500 for the public site, and http://localhost:5500/admin-login.html to manage content.
⚠️ UpdateAPI_BASE_URLinfrontend/js/api.jsto match your backend URL (local or deployed).
There's no public registration — the only admin account is created automatically the first time the server starts, using the ADMIN_EMAIL / ADMIN_PASSWORD from your .env. Logging in returns a JWT, stored in localStorage, and sent as Authorization: Bearer <token> on every project/message management request. Public visitors never touch this — they only hit the public GET /api/projects and POST /api/messages routes.