A full-stack wellness community web app built with HTML, CSS, vanilla JavaScript, Node.js, Express, and MongoDB.
This project combines community posting, personalized wellness resources, and health tracking inside a single authenticated app experience. Users can create an account, join wellness communities, share posts, like and comment on posts, track activity, and view personalized wellness picks based on the communities they join.
https://healthopia-8bvr.onrender.com/
https://github.com/upendra-devhub/Healthopia_Backup if you want to see to repo withput any of the clutter please consider visiting the the provided link
- Authentication with registration, login, logout, and avatar selection
- Community discovery with join and leave actions
- Community-based feed and post detail pages
- Post creation with image upload pipeline using Multer and Cloudinary middleware
- Post likes with optimistic UI handling on the frontend
- Post comments
- Delete-your-own-comment support
- Health tracking for water, steps, running, and sleep
- A rolling 7-day Health Pulse view
- Personalized wellness resources filtered by joined communities
- Profile page with posts, liked posts, and profile stats
- Client-side saved posts support in the frontend
- Public landing page
- Sign-in page
- Registration page
- Authenticated app shell for:
- Home feed
- Profile
- Health
- Wellness Picks
- Community detail
- Post detail
- HTML
- CSS
- Vanilla JavaScript
- Node.js
- Express
- MongoDB with Mongoose
Render
bcryptfor password hashingjsonwebtokenfor authentication tokenscookie-parserfor cookie handlingmulterfor image upload handlingcloudinaryfor image upload storage flowdotenvfor environment variables
health-wellness-community-main/
|-- public/
| |-- css/
| |-- js/
| |-- avatars/
| |-- images/
| |-- landing.html
| |-- sign-in.html
| |-- register.html
| |-- app.html
|-- src/
| |-- config/
| |-- controllers/
| |-- middleware/
| |-- models/
| |-- routes/
| |-- services/
| |-- utils/
| |-- app.js
|-- tests/
|-- uploads/
|-- server.js
|-- package.json
- A visitor lands on the public landing page.
- The user registers or signs in.
- After authentication, the app serves
public/app.html. - The frontend loads shell data such as profile, communities, and health info.
- The user joins communities to personalize the experience.
- Posts shown in the main feed are filtered by the communities the user has joined.
- Wellness Picks are filtered by normalized community categories.
- Health data is loaded and displayed in the Health Pulse dashboard.
Implemented in:
src/controllers/authController.jssrc/middleware/auth.jssrc/utils/authTokens.js
Capabilities:
- Register with username, email, password, and a selected avatar
- Password hashing using
bcrypt - Login with email and password
- Logout by clearing the auth cookie
- Protected API routes and protected page routes
Notes:
- Avatar choices are validated against the available preset avatar filenames
- A
HealthTrackerdocument is created automatically when a user registers
Implemented in:
src/controllers/communityController.jssrc/models/Community.js
Capabilities:
- Fetch all communities
- Mark communities as joined or not joined for the current user
- Join a community
- Leave a community
- View posts inside a specific community
The app seeds starter communities at server startup from src/config/seed.js.
Implemented in:
src/controllers/postController.jssrc/services/postLikeService.jssrc/models/Post.jspublic/js/app.jspublic/js/postLikeManager.js
Capabilities:
- Create posts
- View feed posts
- View single post detail
- Delete your own post
- Like and unlike posts
- Add comments
- Delete your own comments
Behavior notes based on the current code:
- Feed posts default to communities joined by the signed-in user
- Likes are handled with optimistic frontend updates
- Comments are stored as embedded subdocuments on each
Post - Comment deletion is exposed through
DELETE /api/comments/:id
Implemented in:
src/controllers/healthController.jssrc/models/HealthTracker.jspublic/js/app.js
Tracked values:
- Water intake
- Water goal
- Steps
- Running
- Sleep
- Daily activity logs
Current health behavior:
- The dashboard shows a rolling last 7 days window
- The selected day defaults to the real current day
- Daily log entries are stored in
dailyLogs - Today’s summary is synced back into the main tracker values when the logged date is today
Implemented in:
src/controllers/resourceController.jssrc/models/Resource.jssrc/config/resources.seed.json
Capabilities:
- Fetch wellness resources personalized to the user’s joined communities
- Paginate resource results
- Sort results by priority and metadata
The server seeds starter resource data at startup.
Implemented in:
src/controllers/userController.jspublic/js/app.js
Capabilities:
- View the signed-in user profile
- View own posts
- View liked posts
- See profile stats:
- total posts
- communities joined
- comments count on the user’s posts
- likes count on the user’s posts
Create a .env file in the project root.
The code currently reads these environment variables:
PORT=3000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secretImportant notes:
src/config/env.jsusesPORT,MONGODB_URI, andJWT_SECRET- Cloudinary configuration is read directly from
process.envinsidesrc/middleware/cloudnire.upload.js - For GitHub, do not commit real secrets in
.env
git clone <your-repository-url>
cd health-wellness-community-mainnpm installCreate a .env file in the project root using the variables listed above.
npm startThe app starts on:
http://localhost:3000
npm startnpm run devnpm testPOST /api/auth/registerPOST /api/auth/loginPOST /api/auth/logout
GET /api/users/profile
GET /api/communitiesGET /api/communities/:idPOST /api/communities/:id/joinDELETE /api/communities/:id/join
GET /api/postsPOST /api/postsGET /api/posts/:idDELETE /api/posts/:idPOST /api/posts/:id/likePOST /api/posts/:id/comment
DELETE /api/comments/:id
GET /api/healthPUT /api/healthGET /api/health/todayGET /api/health/weeklyPOST /api/health/log
GET /api/resourcesGET /api/resources/picks
Stores:
nameemailpasswordusernameavatarpostslikedPostscommunitiesJoined
Stores:
communityNamedescriptionpostsnoOfActiveMemberscommunityPhoto
Stores:
- author references
- title/body/description
- image metadata
- likes and liked users
- embedded comments
- tags
- community references
Stores:
userIdwaterIntakewaterGoalstepsrunningsleepdailyLogs
Stores:
titledescriptioncategorysourcecommunityTagreadTimeurlpriority
The frontend is a vanilla JavaScript single-app shell served through public/app.html.
Important frontend modules:
public/js/app.jsfor app state, routing, rendering, feed interactions, profile, health, and wellness viewspublic/js/api.jsfor API requests with cookie credentialspublic/js/postLikeManager.jsfor optimistic like state managementpublic/js/register.jsandpublic/js/sign-in.jsfor auth flowspublic/js/landing.jsfor landing page interactions
This repository includes Node-based tests in the tests/ folder.
Current test coverage includes checks around:
- post like behavior
- create post flow
- landing/avatar/resource regressions
- profile/theme regressions
- health tracker rolling 7-day logic
- delete-own-comment behavior
Run all tests with:
npm testThe current codebase includes these logic updates:
- Health Tracker date handling uses a dynamic current date and rolling last 7 days logic
- Existing stored health data is mapped onto the correct daily keys
- Users can delete only their own comments through a protected API route and frontend action
Before uploading this project to GitHub:
- remove or rotate any real secrets stored in
.env - keep
.envout of version control - consider adding a
.env.examplefile for safer setup sharing
No license file is currently present in this repository.