friend.ly is a small social media platform that uses 'cards' to connect people virtually, built with the PERN stack (PostgreSQL, Express.js, React, Node.js).
- User authentication (sign up/sign in)
- Create and share posts
- Like/unlike posts
- User profiles with customizable descriptions
- Real-time social interactions
- Modern UI with React 18 and Bootstrap 5
- Dark Mode theme
- Node.js with Express.js 5 (latest with modern async/await patterns)
- PostgreSQL 17 with Sequelize ORM
- JWT for authentication
- bcrypt for password hashing
- Cloudinary for image storage (with local fallback)
- Multer with manual upload handling for Express 5 compatibility
- Sharp for image processing
- React 19 with concurrent features and automatic memoization
- Redux Toolkit for state management
- React Router 7 for enhanced navigation
- Bootstrap 5 for styling
- Vite 7 for lightning-fast development and bundling
- esbuild for ultra-fast transpilation
- Node.js (v14 or higher)
- PostgreSQL 17 (or any modern version)
- npm or yarn
git clone <repository-url>
cd social-mernbrew install postgresql@17
brew services start postgresql@17sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresqlDownload and install from PostgreSQL official website
# Create the database
createdb social_mern_db
# Or use the npm script
npm run db:create --prefix serverCopy the example environment file and configure your settings:
cp server/.env.example server/.envEdit server/.env with your configuration:
# Database Configuration
DB_HOST=localhost
DB_PORT=5432
DB_NAME=social_mern_db
DB_USERNAME=postgres
DB_PASSWORD=your_password
# JWT Secret Key (generate a random string)
SECRET_KEY=your-super-secret-jwt-key-here
# Cloudinary Configuration (optional)
CLOUDINARY_CLOUD_NAME=your_cloud_name
CLOUDINARY_API_KEY=your_api_key
CLOUDINARY_API_SECRET=your_api_secret
# Server Configuration
NODE_ENV=development
PORT=3000npm run postinstall# Run both client and server in development mode
npm run dev
# Or run them separately:
# Client only (with hot reload)
npm run serve --prefix client
# Server only (with nodemon)
npm run dev --prefix server# Build and start the application
npm startThe application will be available at:
- Frontend: http://localhost:8080 (development) or http://localhost:3000 (production)
- Backend API: http://localhost:3000/api
social-mern/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # Reusable React components
β β βββ pages/ # Page components
β β βββ actions/ # Redux actions
β β βββ reducers/ # Redux reducers
β β βββ styles/ # SCSS stylesheets
β β βββ assets/ # Static assets
β βββ webpack.config.js # Webpack configuration
β βββ package.json
βββ server/ # Node.js backend
β βββ routes/ # API routes
β βββ models/ # Sequelize models
β βββ middlewares/ # Express middlewares
β βββ db/ # Database configuration
β βββ scripts/ # Serverside scripts
β βββ seeders/ # Database population
β βββ public/ # Static files
β βββ package.json
βββ package.json # Root package.json
# Create database
npm run db:create --prefix server
# Drop database
npm run db:drop --prefix server
# Reset database (drop and recreate)
npm run db:reset --prefix server
# Sync database schema
npm run db:sync --prefix server
# Populate the database with user data (all passwords use 'password123')
npm run db:seed --prefix server- Password hashing with bcrypt
- JWT token authentication
- CORS configuration
- Input validation and sanitization
- Modern security headers
-
Make sure PostgreSQL is running:
brew services start postgresql@17 # macOS sudo systemctl start postgresql # Linux
-
Check if database exists:
psql -l
-
Create user if needed:
createuser -s postgres
-
Clear node_modules:
rm -rf node_modules client/node_modules server/node_modules npm run postinstall
-
Clear build cache:
rm -rf client/dist server/public
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the ISC License.
- Originally implemented with the MERN stack
- Modernized with PostgreSQL, React 18, and latest dependencies
- Security vulnerabilities fixed and dependencies updated
Made with β€οΈ.
