This is an online code compiler built using Next js, TypeScript, Monaco Editor, and various backend services to execute code. The compiler supports multiple programming languages and allows users to write, execute, and view the output of their code directly in the browser.
- Multi-language support: Supports a variety of programming languages, including JavaScript, TypeScript, Rust, C++, Java, PHP, C#, Python.
- Editor: Monaco Editor is used for code editing with syntax highlighting and theming support (dark and light mode).
- Execution: The code is executed in the cloud via the Piston API.
- Output: Display the output of the executed code with a separate output section in the UI.
- Copy Code: Option to copy the written code to the clipboard.
- Responsive Layout: Designed to work on various screen sizes, including mobile and desktop.
Before you begin, ensure that you have the following:
- Node.js installed (version 14.x or higher).
- A modern browser (Chrome, Firefox, etc.).
-
Clone the repository:
git clone https://github.com/Pavan0228/Code-Editor.git cd Code-Editor
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
Your project will be available at
http://localhost:3000
in the browser.
- Select a Language: Choose a programming language from the sidebar.
- Write Code: Type your code in the Monaco Editor.
- Run the Code: Press the "Run" button to execute the code. The output will appear below the editor.
- Switch Theme: Toggle between light and dark themes using the theme switch button at the top.
- Copy Code: Press the "Copy" button to copy the code to your clipboard.
- JavaScript
- TypeScript
- Rust
- C++
- Java
- PHP
- C#
- Python
The code is executed on the Piston API backend. The API is designed to support multiple languages and versions and return the output or errors from the execution.
The Monaco Editor is used for a seamless code editing experience. It offers syntax highlighting, autocompletion, and code formatting for supported languages. You can switch between light and dark modes, as well as adjust font sizes.
- Fork this repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Monaco Editor: Used for the code editing component.
- Lucide React: For the icons used in the UI.
- Piston API: For executing the code in various languages.
Feel free to adjust the repository URL and any other details specific to your project.