CodeBrewery is an innovative web application that enables users to write, run, and experiment with code in multiple programming languages. Built with React for the frontend and Go for the backend, CodeBrewery provides an interactive platform for developers to learn and improve their coding skills through hands-on practice.
- Multi-language support: Write and run code in C++, Java, Go, and Python.
- Interactive code editor: A user-friendly interface for editing and testing code snippets.
- Real-time output: See your code's output instantly.
- Responsive design: Optimized for both desktop and mobile devices.
CodeBrewery is designed using a microservices architecture that currently consists of:
- API Gateway: Acts as the entry point for client requests, routing them to the appropriate services.
- Code Execution Service: Handles the execution of code snippets in multiple programming languages.
To get a local copy of CodeBrewery up and running, follow these simple steps:
-
Clone the repository:
git clone https://github.com/slashexx/CodeBrewery.git
-
Navigate to the project directory:
cd CodeBrewery
-
Install dependencies for each service (optional):
If you prefer to run the services separately, navigate into each service's folder and run:
-
Backend :
cd backend/api-gateway go mod download cd ../code-execution-service go mod download
-
Frontend :
cd frontend pnpm install
CodeBrewery can be easily deployed using Docker. Here’s how:
-
Build the Docker images:
From the root level of your project, run:
- Backend :
cd backend/api-gateway docker build -t codebrewery-api-gateway . cd ../code-execution-service docker build -t codebrewery-code-execution-service .
- Frontend :
Then run each image separately !
cd ../../frontend docker build -t codebrewery-frontend .
For quick and easy setup of the entire project, you can use the docker-compose.yml
file located at the root of the project. This setup will orchestrate all necessary services for both the API gateway and the code execution service.
-
Make sure you have Docker and Docker Compose installed.
-
Start the application using Docker Compose:
docker-compose up --build
This command will build and run all services defined in the
docker-compose.yml
file. Access the application athttp://localhost:5173
. -
Stop the application:
To stop all services, you can use:
docker-compose down
For deploying CodeBrewery to a local Kubernetes cluster using Minikube, follow these steps:
-
Prerequisites: Ensure you have Minikube and kubectl installed and configured to use the Docker driver.
-
Start Minikube:
minikube start --driver=docker
-
Build Docker images:
Navigate to each backend directory and build the Docker images for the services:
cd api-gateway docker build -t codebrewery-api-gateway:latest . cd ../code-execution-service docker build -t codebrewery-code-execution-service:latest . cd ../frontend docker build -t codebrewery-frontend:latest .
-
Load Kubernetes YAML files:
Load the necessary Kubernetes configurations defined in the
k8s
directory. Run the following commands:kubectl apply -f k8s/api-gateway/ kubectl apply -f k8s/code-execution-service/ kubectl apply -f k8s/frontend/
-
Check the status of the pods:
To see the running pods and ensure everything is functioning correctly, use:
kubectl get pods
-
Access the application:
You can access the frontend application using:
minikube service codebrewery-frontend
This command will open the default web browser to the service's URL.
- The frontend of CodeBrewery is deployed on Vercel.
- The backend microservices (API Gateway and Code Execution Service) are deployed as separate Docker images on Render, so the code might take a while to execute on the first try since the server spins down on inactivity haha. It'll work fine after that though.
To ensure everything is working as expected, you can run the tests using the following command from the frontend directory:
npm test
For backend tests, navigate to the respective service directory and run the tests using:
go test ./...
This project uses GitHub Actions for Continuous Integration (CI). Every push and pull request to the main
branch triggers automated tests to maintain code quality.
Check out CONTRIBUTING.md for details on how to contribute!
Distributed under the MIT License. See LICENSE for more information.
Thank you for checking out CodeBrewery! Happy coding!