TruVoice - A Multi Tier Microservices deployment with Kubernetes on AWS.
🎥 Click here to watch the video
- Kirtan Parikh (202251085)
- Rushikesh Chaudhari (202251113)
- Yash Bhattad (202251162)
- Gopal Verma (202251173)
TruVoice is an innovative platform designed to allow users to give and receive anonymous feedback. With the integration of AI, users can generate thoughtful and constructive feedback easily. Whether authenticated or not, users can provide feedback securely and anonymously.
- Anonymous Feedback: Receive feedback from others while keeping your identity secret.
- Email Authentication: Authenticate via email using OTP for secure feedback receipt.
- AI-Generated Feedback: Use Gemini AI to generate feedback messages.
- Cross-Platform: Fully responsive design for both desktop and mobile devices.
- Monitoring: Comprehensive monitoring with Prometheus and Grafana.
TruVoice is built using the following technologies:
- Frontend: Next.js, ShadCN
- Backend: Next.js API routes
- Database: MongoDB
- Authentication: Next-Auth, Auth.js, JWT tokens
- Validation: Zod
- Email Services: Nodemailer, Gmail API
- AI Integration: Gemini AI
- Deployment: Docker, Kubernetes (K3s)
- CI/CD: GitHub Actions
- Infrastructure: AWS (EC2, ECR)
- Infrastructure as Code: Terraform
- Monitoring: Prometheus, Grafana
To get a local copy up and running, follow these simple steps:
-
Clone the repo
git clone https://github.com/Kirtan134/TruVoice.git
-
Install NPM packages
npm install
-
Set up environment variables
- Create a
.env
file in the root directory - Add your MONGODB_URI, NEXTAUTH_SECRET, GEMINI_API_KEY, CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, REFRESH_TOKEN and other necessary credentials
- Create a
-
Run the development server
npm run dev
-
Authentication:
- Sign up with your email.
- Verify your email using the OTP sent to your inbox.
-
Giving Feedback:
- Choose to authenticate or give feedback anonymously.
- Use Gemini AI to generate feedback messages if needed.
- Submit your feedback.
-
Receiving Feedback:
- Receive feedback anonymously.
- Manage your feedback through the user dashboard.
TruVoice can be deployed using Docker or Kubernetes. Below are instructions for both methods.
-
Build the Docker image:
docker build -t truvoice:latest .
-
Run the container:
docker run -p 3000:3000 --env-file .env.local truvoice:latest
The application is deployed on a lightweight Kubernetes cluster (K3s) running on AWS EC2 t2.micro instances. The infrastructure is managed using Terraform, and the CI/CD pipeline is implemented using GitHub Actions.
- AWS Account with appropriate permissions
- Terraform installed locally (for manual deployment)
- GitHub account with repository access
- SSH key pair for EC2 instance access
- kubectl configured to access your Kubernetes cluster
-
Initialize Terraform:
cd terraform terraform init
-
Create a terraform.tfvars file with your configuration:
aws_region = "ap-south-1" environment = "dev" public_key_path = "~/.ssh/id_rsa.pub" private_key_path = "~/.ssh/id_rsa"
-
Apply the Terraform configuration:
terraform plan -out=tfplan terraform apply tfplan
-
Get the kubeconfig:
terraform output kubectl_config_command
-
Apply the Kubernetes manifests:
kubectl apply -f k8s/
-
Access the application:
kubectl port-forward svc/truvoice-service 3000:3000
-
Fork the repository to your GitHub account.
-
Set up the following GitHub Secrets:
AWS_ACCESS_KEY_ID
: Your AWS access keyAWS_SECRET_ACCESS_KEY
: Your AWS secret keyAWS_REGION
: The AWS region to deploy to (e.g., ap-south-1)
-
Push changes to the main branch to trigger the CI/CD pipeline.
TruVoice includes comprehensive monitoring with Prometheus and Grafana.
Prometheus is deployed in the monitoring
namespace and configured to scrape metrics from:
- Node Exporter (system metrics)
- Application metrics endpoint (
/api/metrics
)
Access Prometheus at: http://<your-server-ip>:30090
Grafana is deployed in the monitoring
namespace and configured to use Prometheus as a data source.
Access Grafana at: http://<your-server-ip>:30300
Default credentials:
- Username:
admin
- Password:
admin123
(change this in production!)
The application exposes metrics at /api/metrics
for Prometheus to scrape. These metrics include:
- HTTP request duration
- HTTP request count
- Voice recording duration
- Authentication attempts
This setup is optimized for cost by using t2.micro instances. However, these instances have limited resources, so monitor your application's performance and consider upgrading if needed.
-
K3s cluster not starting:
- Check the EC2 instance logs
- Verify security group settings
- Ensure the instance has enough resources
-
GitHub Actions deployment failing:
- Check the GitHub Actions logs
- Verify AWS credentials
- Ensure the ECR repository exists
-
Monitoring not working:
- Check if Prometheus and Grafana pods are running
- Verify network connectivity between pods
- Check Prometheus targets in the UI
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- 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
Distributed under the MIT License. See LICENSE
for more information.