Personal goal tracker with JWT auth. Built with React, Redux Toolkit, Node and MongoDB.
A small full-stack MERN app where authenticated users can register, log in, and manage a private list of personal goals. Built in 2022 as a learning project to go through the full Redux Toolkit + Express + JWT flow.
✨ Features#
- JWT authentication: register / login with hashed passwords (
bcryptjs) andBearertoken sessions - Protected goal CRUD: create, read, update, and delete goals scoped to the logged-in user
- Redux Toolkit:
authSliceandgoalSlicehold all client state viacreateAsyncThunk - Protected routes on the React side with redirects for unauthenticated users
- Toast notifications via
react-toastifyfor auth and CRUD feedback - Centralized Express error handler with
express-async-handler
🛠️ Tech Stack#
- Frontend: React 17, Redux Toolkit, React Router v6, Axios, react-toastify
- Backend: Node.js, Express
- Database: MongoDB via Mongoose
- Auth: JWT (
jsonwebtoken) +bcryptjs - Dev tooling:
nodemon,concurrently
📁 Project Structure#
.
├── backend/
│ ├── config/ # Mongo connection
│ ├── controllers/ # goal + user controllers
│ ├── middleware/ # auth (protect) + error handler
│ ├── models/ # Mongoose models
│ ├── routes/ # /api/goals, /api/users
│ └── server.js
└── frontend/
└── src/
├── app/ # Redux store
├── features/
│ ├── auth/ # authSlice + authService
│ └── goals/ # goalSlice + goalService
├── components/
└── pages/🔌 API#
All /api/goals routes require an Authorization: Bearer <token> header.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/users |
Register a new user |
| POST | /api/users/login |
Log in, returns JWT |
| GET | /api/users/me |
Current user (protected) |
| GET | /api/goals |
List the user's goals |
| POST | /api/goals |
Create a goal |
| PUT | /api/goals/:id |
Update a goal |
| DELETE | /api/goals/:id |
Delete a goal |
🙌 Credits#
Built by Mohamed Gado.