Travel Eat Repeat. A social media web application built with Node.js, Express, MongoDB, and EJS.
- User registration and authentication
- Create, edit, and delete posts
- Follow/unfollow users
- Real-time chat functionality
- Search posts
- User profiles with followers/following
- Node.js 18.0.0 or higher
- MongoDB (local or MongoDB Atlas)
- npm (comes with Node.js)
git clone git@github.com:jessechumo/Treep.git
cd Treepnpm installCreate a .env file in the root directory:
touch .envAdd the following environment variables to .env:
CONNECTIONSTRING=mongodb+srv://username:password@cluster.mongodb.net/database?appName=Treep
PORT=3000
JWTSECRET=your_random_secret_string_here
SENDGRIDAPIKEY=your_sendgrid_api_key_hereRequired:
CONNECTIONSTRING- Your MongoDB connection string (get from MongoDB Atlas)JWTSECRET- Any random string for JWT token signing
Optional:
PORT- Server port (defaults to 3000)SENDGRIDAPIKEY- For email notifications (leave empty if not using)
Example .env file:
CONNECTIONSTRING=mongodb+srv://user:pass@cluster.mongodb.net/treep?appName=Treep
PORT=3000
JWTSECRET=mysupersecretkey123
SENDGRIDAPIKEY=npm run buildDevelopment mode (with auto-reload):
npm run devDevelopment mode (with webpack watch):
npm run watchProduction mode:
npm startOpen your browser and navigate to: http://localhost:3000
npm start- Start the production servernpm run dev- Start development server with nodemonnpm run watch- Start dev server with webpack watchnpm run build- Build frontend assets for production
- Create a free account at MongoDB Atlas
- Create a new cluster
- Create a database user
- Get your connection string from "Connect" → "Connect your application"
- Add the connection string to your
.envfile - In Network Access, add your server's IP to allow connections from it.
- Backend: Node.js, Express.js
- Database: MongoDB
- Template Engine: EJS
- Real-time: Socket.io
- Frontend: Vanilla JavaScript (bundled with Webpack)
- Authentication: Express Sessions, JWT
- Other: Bcrypt, Marked (Markdown), Sanitize HTML
treep/
├── controllers/ # Route controllers
├── models/ # Database models
├── views/ # EJS templates
├── frontend-js/ # Client-side JavaScript
├── public/ # Static assets
├── router.js # Main routes
├── router-api.js # API routes
├── app.js # Express app configuration
├── db.js # Database connection
└── webpack.config.js