Skip to content

vanichitkara/PersonaPrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PersonaPrep - AI Communication Coach

PersonaPrep is an AI-powered communication coaching platform that helps users improve their interpersonal skills through interactive practice sessions. The application provides personalized coaching for various communication scenarios including interview preparation, networking, small talk, presentations, negotiation, and conflict resolution.

πŸš€ Features

  • Real-time AI Coaching: Interactive conversations with AI-powered feedback
  • Multiple Communication Types: Interview prep, networking, presentations, small talk, and more
  • Confidence Level Tracking: Adaptive coaching based on user skill level (Beginner to Expert)
  • Personalized Feedback: AI analyzes communication patterns and provides targeted suggestions
  • Conversation History: Track progress across multiple coaching sessions
  • WebSocket Support: Real-time messaging for seamless interaction
  • Responsive UI: Modern, mobile-friendly interface

πŸ› οΈ Technology Stack

  • Backend: Java 17, Spring Boot 3.5.4
  • Database: MongoDB (Atlas)
  • AI Integration: Google Gemini API
  • Frontend: HTML5, CSS3, JavaScript (Vanilla)
  • Build Tool: Gradle
  • Testing: JUnit, Embedded MongoDB

πŸ“‹ Prerequisites

Before running this project locally, ensure you have the following installed:

  • Java 17 or higher
  • MongoDB Atlas account (or local MongoDB instance)
  • Google Gemini API key
  • Git (for cloning the repository)

πŸ”§ Local Setup

1. Clone the Repository

git clone <repository-url>
cd PersonaPrep

2. Environment Configuration

Create environment variables for the required configurations. You can set these in your system or create a .env file:

Required Environment Variables:

# MongoDB Configuration
export MONGODB_URI="mongodb+srv://username:[email protected]/?retryWrites=true&w=majority"
export MONGODB_DATABASE="personaprep"

# Gemini AI Configuration
export GEMINI_API_KEY="your-gemini-api-key-here"
export GEMINI_BASE_URL="https://generativelanguage.googleapis.com/v1beta"

Setting up MongoDB Atlas:

  1. Create a free account at MongoDB Atlas
  2. Create a new cluster
  3. Create a database user with read/write permissions
  4. Get your connection string and replace <username> and <password>
  5. Whitelist your IP address in Network Access

Getting Gemini API Key:

  1. Go to Google AI Studio
  2. Create a new API key
  3. Copy the key for use in your environment variables

3. Build the Project

# Make gradlew executable (Linux/Mac)
chmod +x gradlew

# Build the project
./gradlew build

4. Run the Application

Option 1: Using Gradle (Recommended)

./gradlew bootRun

Option 2: Using Java directly

# Build JAR file
./gradlew build

# Run the JAR
java -jar build/libs/personaprep-0.0.1-SNAPSHOT.jar

Option 3: Using provided scripts

# For MongoDB Atlas (recommended)
./env.sh

# For embedded MongoDB (testing only)
./env-embedded.sh

5. Access the Application

Once the application starts successfully, you can access it at:

πŸ§ͺ Testing the Application

1. Web Interface Testing

  1. Open http://localhost:8080 in your browser
  2. Click "Register" and create a new account
  3. Fill in all fields including password
  4. After registration, you'll be redirected to the dashboard
  5. Click on any conversation type (e.g., "Interview Prep")
  6. Start chatting with the AI coach

2. API Testing

Register a User:

curl -X POST http://localhost:8080/api/users/register \
  -H "Content-Type: application/json" \
  -d '{"username":"testuser","email":"[email protected]","firstName":"Test","lastName":"User","password":"password123"}'

Start a Conversation:

curl -X POST http://localhost:8080/api/conversations/start \
  -H "Content-Type: application/json" \
  -d '{"userId":"USER_ID_FROM_REGISTRATION","title":"Interview Practice","type":"INTERVIEW_PREP"}'

Send a Message:

curl -X POST http://localhost:8080/api/conversations/CONVERSATION_ID/messages \
  -H "Content-Type: application/json" \
  -d '{"content":"Hello, I need help with interview preparation"}'

πŸ“ Project Structure

PersonaPrep/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ java/com/personaprep/
β”‚   β”‚   β”‚   β”œβ”€β”€ controller/          # REST & WebSocket controllers
β”‚   β”‚   β”‚   β”œβ”€β”€ model/              # Domain entities
β”‚   β”‚   β”‚   β”œβ”€β”€ repository/         # Data access layer
β”‚   β”‚   β”‚   β”œβ”€β”€ service/            # Business logic
β”‚   β”‚   β”‚   └── config/             # Configuration classes
β”‚   β”‚   └── resources/
β”‚   β”‚       β”œβ”€β”€ static/             # Frontend assets (HTML, CSS, JS)
β”‚   β”‚       └── application.properties
β”‚   └── test/                       # Test classes
β”œβ”€β”€ build.gradle                    # Build configuration
β”œβ”€β”€ env.sh                         # Environment setup script
└── README.md                      # This file

πŸ”Œ API Endpoints

User Management

  • POST /api/users/register - Register new user
  • POST /api/users/login - User login
  • GET /api/users/{id} - Get user details

Conversations

  • POST /api/conversations/start - Start new conversation
  • GET /api/conversations/{id} - Get conversation details
  • GET /api/conversations/user/{userId} - Get user's conversations
  • POST /api/conversations/{id}/messages - Send message
  • GET /api/conversations/{id}/messages - Get conversation messages

Personality Assessment

  • POST /api/personality/assess - Create personality profile
  • GET /api/personality/user/{userId} - Get user's personality profile

πŸ› Troubleshooting

Common Issues:

1. MongoDB Connection Failed

Error: MongoTimeoutException

Solution:

  • Check your MongoDB URI and credentials
  • Ensure your IP is whitelisted in MongoDB Atlas
  • Verify network connectivity

2. Gemini API Key Invalid

Error: 401 Unauthorized

Solution:

  • Verify your Gemini API key is correct
  • Check if the API key has proper permissions
  • Ensure the key is properly set in environment variables

3. Port 8080 Already in Use

Error: Port 8080 was already in use

Solution:

# Kill process using port 8080
sudo lsof -t -i:8080 | xargs kill -9

# Or run on different port
./gradlew bootRun --args='--server.port=8081'

4. Build Failures

# Clean and rebuild
./gradlew clean build

# Skip tests if needed
./gradlew build -x test

πŸ§ͺ Running Tests

# Run all tests
./gradlew test

# Run specific test class
./gradlew test --tests "UserControllerTest"

# Run tests with coverage
./gradlew test jacocoTestReport

πŸš€ Deployment

Environment-specific Configuration

For production deployment, ensure you:

  1. Set production MongoDB URI
  2. Use production Gemini API key
  3. Configure proper CORS origins
  4. Set up proper logging levels
  5. Use environment-specific profiles

Docker Deployment (Optional)

FROM openjdk:17-jdk-slim
COPY build/libs/personaprep-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app.jar"]

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ“ž Support

If you encounter any issues or have questions:

  1. Check the troubleshooting section above
  2. Review the application logs for error details
  3. Ensure all environment variables are properly set
  4. Verify your MongoDB and Gemini API configurations

🎯 Next Steps

After successfully running the application:

  1. Explore different conversation types
  2. Test the AI coaching feedback
  3. Try the personality assessment feature
  4. Experiment with the WebSocket real-time messaging
  5. Review the conversation history functionality

Happy Coding! πŸš€

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors