A full-stack application for generating test cases, featuring a Node.js/TypeScript backend using gemini api and docker to run code with subscription feature using razorpay with Prisma ORM and a Next.js frontend.
- Server/: Backend API built with Node.js, TypeScript, Express, and Prisma
- web/: Frontend built with Next.js
- docker/: Docker configurations for containerization
- .github/workflows/: CI/CD pipeline for deployment
- User authentication (including Google OAuth)
- Test case generation
- Subscription management with Razorpay integration
- Cron jobs for automated tasks
- Cloudinary integration for file uploads
- Node.js 20+
- Docker (optional, for containerized deployment)
- PostgreSQL database (for Prisma)
-
Navigate to the Server directory:
cd Server -
Install dependencies:
npm install
-
Set up environment variables: Create a
.envfile in the Server directory with necessary variables (e.g., database URL, JWT secrets, OAuth keys). -
Run Prisma migrations:
npx prisma migrate deploy npx prisma generate
-
Build and run:
npm run build npm start
-
Navigate to the web directory:
cd web -
Install dependencies:
npm install
-
Run the development server:
npm run dev
To run the entire application using Docker:
-
Build the server image:
docker build -t test-case-server . -
Run the container:
docker run -p 3000:3000 test-case-server
Note: Ensure database and other services are properly configured for production use.
The project includes a GitHub Actions workflow for deployment. Push to the main branch to trigger automatic deployment.
-
Launch EC2 Instance:
- Choose Amazon Linux 2 or Ubuntu AMI
- Select t2.micro or t3.small for development
- Configure security group: Allow SSH (22), HTTP (80), HTTPS (443)
-
Install Dependencies:
sudo yum update -y # For Amazon Linux sudo yum install -y nodejs npm nginx git # Or for Ubuntu: # sudo apt update && sudo apt install -y nodejs npm nginx git
-
Clone Repository:
git clone https://github.com/your-username/test-case-generator.git cd test-case-generator -
Setup Backend:
cd Server npm install cp .env.example .env # Configure your environment variables npx prisma migrate deploy npx prisma generate npm run build npm start &
-
Setup Frontend:
cd ../web npm install npm run build sudo cp -r out/* /var/www/html/ # For static hosting
-
Configure Nginx: Create
/etc/nginx/sites-available/test-case-generator:server { listen 80; server_name your-domain.com; location / { proxy_pass http://localhost:3001; # Frontend if running Next.js in production proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } location /api { proxy_pass http://localhost:3000; # Backend proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
Enable site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/test-case-generator /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl restart nginx
-
SSL Certificate (Optional):
sudo yum install -y certbot python3-certbot-nginx sudo certbot --nginx -d your-domain.com
-
Monitor and Logs:
- Use
sudo systemctl status nginxto check status - Logs:
/var/log/nginx/ - Backend logs: Check PM2 or your process manager
- Use
The backend provides RESTful APIs for:
- Authentication
- User management
- Test case generation
- Subscription handling
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
ISC