Mindful helps coordinate volunteers, track events, manage participants, and streamline volunteer engagement through an intuitive web application.
How might we reduce friction in activity sign-ups for both individuals and caregivers, while reducing manual effort for staff in managing and consolidating registration data?
- 🔐 Secure Authentication: User registration and login with role-based access control
- 👥 Role-Based Access: Three user roles - Admin, Volunteer, and Participant with specific permissions
- 📅 Event Management: Create, view, and manage events with detailed information
- 🗓️ Calendar View: Visual calendar interface to browse events by month
- 🔒 JWT Sessions: Secure session management with HttpOnly cookies
- 💾 MongoDB Integration: Robust data persistence with MongoDB
- React 19: Modern UI library with hooks and concurrent features
- React Router 7: Client-side routing with data loaders
- Vite: Lightning-fast build tool and dev server
- TypeScript: Type-safe JavaScript for better code quality
- Tailwind CSS 4: Utility-first CSS framework
- Lucide React: Beautiful, consistent icon library
- Axios: HTTP client for API communication
- Express.js 5: Fast, unopinionated web framework
- TypeScript: Type-safe backend development
- MongoDB 7: NoSQL database for flexible data storage
- JWT (jose): Secure token generation and verification
- bcrypt: Password hashing and security
- CORS: Cross-origin resource sharing for frontend communication
- ESLint: Code linting and quality
- Tailwind CSS Vite Plugin: Optimized CSS bundling
- TypeScript Compiler: Type checking and compilation
mindful/
├── client/ # React frontend application
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ │ ├── EventAdmin/
│ │ │ ├── EventCalendar/
│ │ │ ├── EventCard/
│ │ │ ├── EventDetails/
│ │ │ ├── EventParticipants/
│ │ │ ├── EventVolunteers/
│ │ │ ├── Navbar/ # Navigation bar with profile menu
│ │ │ ├── ThemeToggle/ # Dark/light mode toggle
│ │ │ └── ui/ # Shadcn UI components
│ │ ├── layouts/
│ │ │ ├── AuthLayout/ # Layout for login/signup pages
│ │ │ └── DefaultLayout/ # Main app layout with navbar
│ │ ├── pages/ # Full page components
│ │ │ ├── AdminDashboard/
│ │ │ ├── CalendarPage/
│ │ │ ├── ErrorPage/
│ │ │ ├── EventCreatePage/
│ │ │ ├── EventPage/
│ │ │ ├── LandingPage/ # Public landing page
│ │ │ ├── Login/
│ │ │ ├── Signup/
│ │ │ ├── ParticipantDashboard/
│ │ │ └── VolunteerDashboard/
│ │ ├── services/ # Business logic & API calls
│ │ │ ├── AuthService.tsx # Authentication logic
│ │ │ ├── DataService.tsx # Data fetching
│ │ │ ├── HTTPService.tsx # Axios instance with interceptors
│ │ │ └── UserService.tsx # User data types
│ │ ├── loaders/ # React Router data loaders
│ │ │ ├── auth_loaders.tsx # Role-based access control
│ │ │ ├── conditional_components.tsx
│ │ │ └── page_loaders.tsx
│ │ ├── helpers/ # Utility functions
│ │ │ └── text_methods.tsx # Input validation helpers
│ │ ├── contexts/ # React contexts
│ │ ├── lib/
│ │ │ └── utils.ts
│ │ ├── index.css # Global styles
│ │ └── main.tsx # App entry point & router config
│ ├── .env # Environment variables
│ ├── vite.config.ts
│ ├── tsconfig.json
│ └── package.json
│
├── server/ # Express backend application
│ ├── src/
│ │ ├── app.ts # Express app setup & routes
│ │ ├── api_routes/ # API endpoints
│ │ │ ├── auth.ts # Login/signup routes
│ │ │ ├── event.ts # Event CRUD routes
│ │ │ └── user.ts # User routes
│ │ ├── services/ # Business logic
│ │ │ ├── authService.ts # Auth & JWT logic
│ │ │ ├── userService.ts # User model & operations
│ │ │ └── eventService.ts # Event operations
│ │ ├── lib/
│ │ │ ├── dbClient.ts # MongoDB connection
│ │ │ └── middlewares.ts # Express middlewares
│ │ ├── util/
│ │ │ ├── checkProperty.ts # Type checking utilities
│ │ │ └── loadEnv.ts # Environment config
│ │ └── tooling/
│ │ ├── populateDB.ts # Seed database
│ │ └── nukeDB.ts # Clear database
│ ├── dist/ # Compiled JavaScript
│ ├── .env # Environment variables
│ ├── tsconfig.json
│ └── package.json
│
└── README.md # This file
- Node.js (v18 or higher)
- npm (v10 or higher)
- MongoDB (local instance or MongoDB Atlas cloud)
- Git
-
Clone the repository
git clone https://github.com/geraldnyeo/mindful.git cd mindful -
Setup Backend
For more information, see the README in /server
cd server npm installCreate a
.envfile in theserverdirectory:PORT=3000 MONGODBSTRING="your_mongodb_connection_string" CLIENTORIGIN="http://localhost:5173" JWTSECRET="your_jwt_secret_key"
For local MongoDB:
MONGODBSTRING="mongodb://localhost:27017/mindful"
Place SSL certificate and private key in /server
Build and start the server:
npm run build npm run start
To build and start at the same time:
npm run dev
-
Setup Frontend
cd client npm installCreate a
.envfile in theclientdirectory:VITE_API_URL=http://localhost:3000
Start the development server:
npm run dev
The frontend will be available at
http://localhost:5173
Terminal 1 - Backend:
cd server
npm run devTerminal 2 - Frontend:
cd client
npm run devPopulate database with sample data:
cd server
npm run populate-dbClear the database:
cd server
npm run nuke-dbClear and repopulate:
cd server
npm run nuke-populate-db- User signs up with email, username, password, and role
- Password is hashed with bcrypt and stored securely in MongoDB
- On login, credentials are validated and JWT token is generated
- Token is stored in an HttpOnly cookie for security
- Subsequent requests include the cookie for authentication
- Role-based routing enforces access control on protected routes
- Admin: Full system access, can manage users and events
- Volunteer: Can view events and volunteer for activities
- Participant: Can register for events and view participation details
- Guest: Unauthenticated user (limited to landing page)
/dashboard- Accessible to all authenticated users/calendar/:monthyear- Event calendar view/event/:eventid- Event details page/admin- Admin-only dashboard/volunteer- Volunteer-specific dashboard/participant- Participant-specific dashboard
POST /api/auth/signup- Register new userPOST /api/auth/login- Login with credentialsPOST /api/auth/refresh- Refresh JWT token
GET /api/user/me- Get current user profile
GET /api/event/range- Get events in date rangeGET /api/event/:id- Get event detailsPOST /api/event/create- Create new eventPUT /api/event/:id- Update eventDELETE /api/event/:id- Delete eventPOST /api/event/:id/register- Register for eventPOST /api/event/:id/cancel- Cancel registration
- Create component in
client/src/pages/PageName/ - Add route in
client/src/main.tsx - Create loader if needed in
client/src/loaders/
- Create component in
client/src/components/ComponentName/ - Include
componentName.cssfor styling - Export from
ComponentName.tsx
- Create endpoint in
server/src/api_routes/ - Implement business logic in
server/src/services/ - Register route in
server/src/app.ts
- Check if port 3000 is already in use:
lsof -i :3000 - Verify MongoDB connection string is correct
- Check
.envfile has all required variables
- Ensure
CLIENTORIGINin server.envmatches frontend URL - Check that frontend and backend are on the same domain or properly configured
- Verify MongoDB is running (local) or connection string is valid (cloud)
- Check credentials in MongoDB Atlas if using cloud
- Ensure network access is allowed in MongoDB settings
- Clear browser cookies and localStorage
- Check JWT secret is consistent between restarts
- Verify HttpOnly cookies are being set (check browser DevTools)