- A MERN stack application built to help users set goals, track their progress, edit, and delete them with ease.
- The main purpose of this project is to understand and implement a complete MERN stack workflow, including authentication, authorization, token handling, and clean code organization.
- β User authentication & authorization
- β Token handling with cookies (res.cookies) β secure and modern approach
- β Centralized API handling with credentials support in frontend
- β Well-structured backend folder organization
- β Goal management: Create, Edit, Delete, Track progress
- β Type-safe frontend with TypeScript
- β Form validation using React Hook Form + Zod
- β API handling with React Query
Frontend
- β‘ Vite β Modern build tool
- βοΈ React 19 β UI development
- π¦ React Query β API handling
- π‘οΈ TypeScript β Type safety
- β React Hook Form + Zod β Form validation
Backend
- π’ Node.js β Runtime environment
- π Express.js β Server framework
- π MongoDB (NoSQL) β Database
- π JWT + Cookies β Authentication
Goal-Setter/
β
βββ backend/ # Express + MongoDB backend
β βββ config/ # DB connection & Cores Options setup
β β βββ db.js
β β βββ coresOptions.js
β β
β βββ controllers/ # Route logic
β β βββ goal.controller.js # Goal Controller logics
| | βββ user.controller.js # User COntroller logics
β β
β βββ middleware/ # Auth & error handling
β β βββ authMiddleware.js
β β βββ errorMiddleware.js
β β
β βββ models/
| | βββ user.model.js # MongoDB models
β β βββ goal.model.js
β β
β βββ routes/ # API routes
β β βββ goal.routes.js
β β βββ user.routes.js
β βββ server.js # Entry point
β βββ package.json
β
βββ client/ # React + Vite frontend
β βββ public/ # Static assets
β β βββ favicon.ico
β β
β βββ src/
β β βββ app/ # Centralized API handling
| | | βββ AuthLoader.tsx # load to logic on every hard refresh
β β β βββ apiSlice.tsx # base url with code splitting allowed
β β β βββ store.tsx # store
β β β
β β βββ ui/ # Reusable UI components
| | | βββ NotFoundPage.tsx
β β β βββ Navbar.tsx
β β β
β β βββ features/ # feature wise file organised
| | | βββ goal/
| | | | βββ goalApiSlice.tsx # goal apis called
| | | | βββ goal/ # goal feature components
β β β βββ auth/
| | | βββ authApiSlice.tsx # auth apis called
| | | βββ auth/ # auth feature components
β β β
β β βββ layouts/ # Layouts (auth and main)
β β β βββ AuthLayout.tsx
| | | βββ AuthenticatedLayout.tsx
| | |
β β βββ routes/ # Routes configured
β β β βββ ProtectedRoute.tsx
β β β βββ PublicRoute.tsx
β β β βββ index.tsx
β β β
β β βββ utils/ # utils
β β β βββ useAuth.tsx # use Auth hook
β β β βββ getErrorMessage.tsx # Error display logic function
β β β
β β βββ App.tsx # Root component
β β βββ main.tsx # Entry point
β β
β βββ tsconfig.app.json
β βββ eslint.config.js
β βββ vite.config.ts
β βββ package.json
β
βββ README.md # Readme
1οΈβ£ Clone the repository git clone https://github.com/amgowda42/Goal_Setter.git
2οΈβ£ Backend Setup
cd backend
npm install
Create a .env file inside the backend/ folder and add:
MONGODB_URI=your_mongodb_connection_string
PORT=8000
JWT_SECRET=your_secret_key
Start backend:
npm run dev
3οΈβ£ Frontend Setup
cd client
npm install
Start frontend:
npm run dev
- Register/Login as a user.
- Set your goals (title, description, etc.).
- Track progress, edit, or delete goals anytime.
- Authentication is handled securely using cookies.
- Through this project, I focused on:
- Building a full-stack MERN app with modern best practices.
- Implementing authentication/authorization using JWT + cookies.
- Organizing backend with a clean folder structure.
- Using React Query for centralized API handling.
- Adding type safety & validation in frontend with TypeScript + Zod.
- This project is licensed under the MIT License.