Connect is a microservices-based backend platform designed to facilitate connections between travelers and locals. The platform enables travelers to discover locals in their destination cities and vice versa, creating opportunities for authentic travel experiences and cultural exchanges.
Connect is a social platform that bridges the gap between travelers and locals:
- For Travelers: Discover locals in your destination who can show you authentic experiences, hidden gems, and provide insider knowledge about their city
- For Locals: Connect with travelers visiting your city, share your local expertise, and potentially earn income by offering guided experiences
- Smart Matching: AI-powered discovery service that suggests relevant connections based on location, interests, and availability
Connect follows a microservices architecture with the following components:
-
API Gateway (Port: 4003)
- Single entry point for all client requests
- Routes requests to appropriate microservices
- Handles authentication and authorization
- No database required (stateless routing)
-
Authentication Service (Port: 4000)
- Database:
connect_auth_db- User authentication data, refresh tokens - User registration and login
- JWT token management
- Google OAuth2 integration
- Password-based authentication
- Database:
-
Connector Service (Port: 4001)
- Database:
connect_connector_db- User profiles, images, social media links - User profile management
- Profile photos and gallery
- Social media links
- Location-based profile data
- Database:
-
Trip Service (Port: 4002)
- Database:
connect_trip_db- Trip data, travel plans - Trip planning and management
- Travel dates and destinations
- Trip discovery for matching
- Database:
-
Discovery Service (Port: 4004)
- Database:
connect_discovery_db- Discovery preferences, matching data - AI-powered user matching
- Local and traveler discovery
- Smart recommendations
- Database:
Each service maintains its own database and communicates with other services via HTTP requests when needed. Services use internal endpoints for cross-service communication.
- Java 21 or later
- Maven 3.9.9 or later
- Spring Boot 3.5.3 or later
- PostgreSQL
- Docker (optional, for containerized deployment)
-
Clone the repository
git clone <your-repository-url> cd connect
-
Create databases for each service
createdb connect_auth_db createdb connect_connector_db createdb connect_trip_db createdb connect_discovery_db
-
Set up environment variables
Each service requires its own environment configuration. You can use
.envfiles, run configurations, or any method that injects variables into the application properties.API Gateway Environment Variables:
FRONTEND_URL=your_frontend_url #(if not set the default is http://localhost:5173) **Auth Service Environment Variables:** ```bash SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/connect_auth_db SPRING_DATASOURCE_USERNAME=your_username SPRING_DATASOURCE_PASSWORD=your_password JWT_PRIVATE_KEY=your_private_key_here JWT_PUBLIC_KEY=your_public_key_here GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret GOOGLE_REDIRECT_URI=http://localhost:3000/auth/callback
Connector Service Environment Variables:
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/connect_connector_db SPRING_DATASOURCE_USERNAME=your_username SPRING_DATASOURCE_PASSWORD=your_password JWT_PUBLIC_KEY=your_public_key_here CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
Trip Service Environment Variables:
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/connect_trip_db SPRING_DATASOURCE_USERNAME=your_username SPRING_DATASOURCE_PASSWORD=your_password JWT_PUBLIC_KEY=your_public_key_here
Discovery Service Environment Variables:
JWT_PUBLIC_KEY=your_public_key_here # OpenAI/Groq configuration GROQ_API_KEY=your_groq_api_key GROQ_BASE_URL=your_groq_base_url GROQ_TEMPERATURE=0.7 # or your preferred value GROQ_MODEL=llama3-70b-8192 # or your preferred model # Service URLs TRIP_SERVICE_BASE_URL=http://localhost:4002 CONNECTOR_SERVICE_BASE_URL=http://localhost:4001
-
Generate JWT keys (if you don't have them)
# Generate RSA key pair for JWT signing openssl genrsa -out private.pem 2048 openssl rsa -in private.pem -pubout -out public.pem
# Build all services
mvn clean install
# Run services in separate terminals
cd auth-service && mvn spring-boot:run
cd connector-service && mvn spring-boot:run
cd trip-service && mvn spring-boot:run
cd discovery-service && mvn spring-boot:run
cd api-gateway && mvn spring-boot:run# Build and run all services
docker-compose up --buildAll endpoints are accessible through the API Gateway at http://localhost:4003/api/
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/auth/register |
Register new user | No |
| POST | /api/auth/login |
Login with credentials | No |
| POST | /api/auth/refresh |
Refresh access token | No |
| POST | /api/auth/logout |
Logout user | Yes |
| DELETE | /api/auth/deleteUser |
Delete user account | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/connectors/me |
Create user profile | Yes |
| GET | /api/connectors/me |
Get my profile | Yes |
| PUT | /api/connectors/me |
Update my profile | Yes |
| GET | /api/connectors/public/{userId} |
Get public profile | No |
| POST | /api/connectors/me/gallery |
Add profile photo | Yes |
| DELETE | /api/connectors/me/gallery/{orderIndex} |
Delete profile photo | Yes |
| POST | /api/connectors/me/social-media |
Add social media link | Yes |
| PUT | /api/connectors/me/social-media/{platform} |
Update social media link | Yes |
| DELETE | /api/connectors/me/social-media/{platform} |
Delete social media link | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| POST | /api/trips/me |
Create new trip | Yes |
| GET | /api/trips/me |
Get my trips | Yes |
| PUT | /api/trips/me/{publicId} |
Update trip | Yes |
| DELETE | /api/trips/me/{publicId} |
Delete trip | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
| GET | /api/discovery/public/locals |
Discover locals | Yes |
| GET | /api/discovery/public/travelers |
Discover travelers | Yes |
The platform uses JWT (JSON Web Tokens) for authentication. To access protected endpoints, include the access token in the Authorization header:
Authorization: Bearer your-jwt-token
The platform uses Cloudinary for image storage:
- Generate upload signature from Connector Service
- Upload image to Cloudinary using the signature
- Add image URL to user profile via Connector Service
Import the provided Postman collection: Postman/connect.postman_collection.json
# Auth Service tests
cd auth-service
mvn test
# Connector Service tests
cd connector-service
mvn test- API Gateway: 4003
- Auth Service: 4000
- Connector Service: 4001
- Trip Service: 4002
- Discovery Service: 4004
- Databases: Use separate managed PostgreSQL instances for each service
- Image Storage: Cloudinary (already configured)
- JWT Keys: Store securely in environment variables
- API Gateway: Consider using AWS API Gateway or similar
- Monitoring: Implement logging and monitoring (ELK stack, Prometheus)
- Service Discovery: Implement service discovery for inter-service communication
# Build images
docker build -t connect-auth-service ./auth-service
docker build -t connect-connector-service ./connector-service
docker build -t connect-trip-service ./trip-service
docker build -t connect-discovery-service ./discovery-service
docker build -t connect-api-gateway ./api-gateway
# Run with docker-compose
docker-compose up -d- Install Lombok plugin
- Enable annotation processing
- Configure Java 21 SDK
If you encounter any issues:
- Check the API documentation at the Swagger endpoints
- Review the Postman collection for working examples
- Open an issue in the repository with detailed error information