A full-stack web application that allows users to explore different countries around the world and engage in real-time conversations with other users about their travel experiences and cultural insights.
- Interactive Country Explorer: Browse through 250+ countries worldwide
- Detailed Country Information: View flags, population, regions, capitals, and more
- Advanced Search & Filter: Search by country name and filter by geographical regions
- Country Details: Get comprehensive information about each country
- REST Countries API Integration: Real-time data from reliable sources
- Room-based Chat: Create or join chat rooms for different countries/topics
- Live Messaging: Real-time communication powered by Socket.io
- File Sharing: Send images and attachments in conversations
- User Presence: See who's online and active in each room
- User Registration & Authentication: Secure JWT-based authentication
- Profile Management: Customize your profile with avatars
- Password Management: Change passwords securely
- Protected Routes: Secure areas requiring authentication
- React 19: Modern React with hooks and context
- Vite: Fast build tool and development server
- Tailwind CSS: Utility-first CSS framework
- React Router: Client-side routing
- Socket.io Client: Real-time WebSocket communication
- Axios: HTTP client for API calls
- React Toastify: User notifications
- Node.js: Runtime environment
- Express.js: Web application framework
- Socket.io: Real-time bidirectional communication
- MongoDB: NoSQL database with Mongoose ODM
- JWT: JSON Web Token authentication
- bcrypt: Password hashing
- Multer: File upload handling
- Cloudinary: Cloud-based image and video storage
- CORS: Cross-origin resource sharing
Before you begin, ensure you have the following installed:
- Node.js (version 16.0 or higher)
- npm (version 7.0 or higher)
- MongoDB (local installation or MongoDB Atlas account)
- Cloudinary Account (for file storage - free tier available)
# Clone the repository
git clone https://github.com/abhas20/WorldAngel.git
cd WorldAngel
# Install concurrently for running both servers
npm install
# Install all dependencies for both frontend and backend
npm run install-all
# Copy environment files
cp backend_country/.env.example backend_country/.env
cp frontend_country/.env.example frontend_country/.env
# Configure your environment variables (see sections below)
# Then run both frontend and backend simultaneously
npm run devIf you prefer to set up each part manually:
git clone https://github.com/abhas20/WorldAngel.git
cd WorldAngelcd backend_country
# Install dependencies
npm install
# Create environment variables file
cp .env.example .env # If .env.example exists, otherwise create .env manuallyCreate a .env file in the backend_country directory with the following variables:
# Database Configuration
DB_URL=mongodb://localhost:27017/
# OR for MongoDB Atlas:
# DB_URL=your_atlas_url
DB_NAME=worldangel
# JWT Configuration
ACCESS_TOKEN_SECRET=your_super_secret_access_token_key_here
ACCESS_TOKEN_EXPIRY=15m
REFRESH_TOKEN_SECRET=your_super_secret_refresh_token_key_here
REFRESH_TOKEN_EXPIRY=10d
# Cloudinary Configuration (for file uploads)
CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
CLOUDINARY_API_KEY=your_cloudinary_api_key
CLOUDINARY_API_SECRET=your_cloudinary_api_secret
# Server Configuration
PORT=8080
FRONTEND_URL=http://localhost:5173cd ../frontend_country
# Install dependencies
npm install
# Create environment variables file
cp .env.example .env # If .env.example exists, otherwise create .env manuallyCreate a .env file in the frontend_country directory:
# Backend API Configuration
VITE_BACKEND_URL=http://localhost:8080/api/v1
VITE_BACKEND_URL_SOCKET=http://localhost:8080- Install MongoDB locally
- Start MongoDB service
- The application will create the database automatically
- Create a free account at MongoDB Atlas
- Create a new cluster
- Get your connection string
- Update the
DB_URLin your backend.envfile
- Create a free account at Cloudinary
- Get your Cloud Name, API Key, and API Secret from your dashboard
- Update the Cloudinary variables in your backend
.envfile
# From the root directory, run both frontend and backend simultaneously
npm run devThis will start:
- Backend server at
http://localhost:8080 - Frontend application at
http://localhost:5173
Backend Only:
cd backend_country
npm run devFrontend Only:
cd frontend_country
npm run devTerminal 1 - Backend:
cd backend_country
npm run devThe backend server will start at http://localhost:8080
Terminal 2 - Frontend:
cd frontend_country
npm run devThe frontend application will start at http://localhost:5173
Backend:
cd backend_country
npm startFrontend:
cd frontend_country
npm run build
npm run previewWorldAngel/
βββ backend_country/ # Backend Node.js application
β βββ config/ # Configuration files
β β βββ db.js # Database connection
β β βββ socket.js # Socket.io configuration
β βββ controller/ # Route controllers
β β βββ user.controller.js
β β βββ chat.controller.js
β β βββ message.controller.js
β βββ middlewares/ # Custom middlewares
β β βββ auth.middleware.js
β β βββ multer.middleware.js
β βββ models/ # Database models
β β βββ userModel.js
β β βββ chatModel.js
β β βββ messageModel.js
β βββ routes/ # API routes
β β βββ user.route.js
β β βββ chat.route.js
β βββ utils/ # Utility functions
β β βββ Cloudinary.js
β βββ app.js # Express app configuration
β βββ index.js # Server entry point
β
βββ frontend_country/ # Frontend React application
β βββ public/ # Static assets
β βββ src/
β β βββ api/ # API service functions
β β β βββ authApi.jsx
β β β βββ chatApi.jsx
β β β βββ postApi.jsx
β β βββ auth/ # Authentication context and hooks
β β βββ chat/ # Socket.io client configuration
β β βββ components/ # Reusable React components
β β β βββ layout/ # Layout components
β β β βββ ui/ # UI components
β β βββ pages/ # Page components
β β β βββ Home.jsx
β β β βββ Country.jsx
β β β βββ Chat.jsx
β β β βββ login.jsx
β β β βββ signup.jsx
β β βββ App.jsx # Main app component
β β βββ main.jsx # Application entry point
β βββ package.json
β βββ vite.config.js
β
βββ README.md # This file
POST /api/v1/user/signup- User registrationPOST /api/v1/user/login- User loginPOST /api/v1/user/logout- User logoutPOST /api/v1/user/refresh-token- Refresh access tokenGET /api/v1/user/current-user- Get current user infoPOST /api/v1/user/change-password- Change passwordPATCH /api/v1/user/update-avatar- Update user avatar
POST /api/v1/chat/create-room- Create a chat roomPOST /api/v1/chat/join-room- Join a chat roomGET /api/v1/chat/get-all-rooms- Get all available roomsPOST /api/v1/chat/send-message- Send a messageGET /api/v1/chat/get-messages- Get room messages
- The app uses REST Countries API for country information
- Frontend: Deployed on Vercel at
https://world-angel.vercel.app - Backend: Deployed backend server (URL configured in CORS)
-
MongoDB Connection Error
- Ensure MongoDB is running locally or your Atlas connection string is correct
- Check if your IP is whitelisted in MongoDB Atlas
-
Cloudinary Upload Errors
- Verify your Cloudinary credentials are correct
- Check your Cloudinary account limits
-
CORS Errors
- Ensure frontend URL is added to CORS origins in backend
- Check if both frontend and backend URLs are correct
-
Socket.io Connection Issues
- Verify
VITE_BACKEND_URL_SOCKETpoints to your backend server - Check if ports are correctly configured
- Verify
-
Environment Variables Not Loading
- Ensure
.envfiles are in the correct directories - Restart development servers after changing environment variables
- Check that variable names match exactly (case-sensitive)
- Ensure
- Use
npm run devfor both frontend and backend during development - Check browser console and terminal logs for detailed error information
- Ensure all required environment variables are set before running the application
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License.
- GitHub: @abhas20
β If you found this project helpful, please give it a star on GitHub!