This project was bootstrapped with Create React App.
In the project directory, you can run:
Runs the api in the development mode.
using http://localhost:3001
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
The page will reload when you make changes.
You may also see any lint errors in the console.
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
- Allows users to write and edit code.
- Supports syntax highlighting for different programming languages.
- Provides a text area for input and output display.
- Manages multiple code tabs concurrently.
- Allows users to open, close, and switch between tabs seamlessly.
- Enables users to add new file names and extensions for each code tab.
- Enhances the user interface with styling for better code view.
- Sends code and language information to the backend for execution.
- Retrieves and displays the output received from the backend.
- Saves code state in local storage to retain it when the webpage is refreshed or closed.
- Provides endpoints for code execution, e.g.,
/api/execute. - Receives code and language information from the frontend.
- Executes Python, TypeScript, and JavaScript code based on the specified language.
- Uses temporary files for code execution.
- Manages temporary files for each code execution.
- Writes code to a temporary file before execution.
- Catches errors during code execution and returns appropriate responses.
-
User Interaction:
- Users interact with the frontend, writing and editing code, managing tabs, and initiating code execution.
-
Frontend Communication:
- Frontend sends requests to the backend API, providing code, language, and other relevant information.
-
Backend Processing:
- Backend receives the requests and processes them.
- It executes the code using the appropriate language runtime (Python, TypeScript, or Node.js).
-
Code Execution:
- Temporary files are created to store the user's code.
- The backend executes the code and captures the output.
-
Backend Response:
- The backend sends the output or error information back to the frontend.
-
Frontend Display:
- The frontend displays the output or error to the user in the code editor interface.
-
Auto-Saving:
- Code state is auto-saved to local storage, allowing users to resume their work after refreshing or closing the webpage.
- Data flows from the frontend to the backend through API requests.
- Temporary files are used for handling code during execution.
- Output from code execution flows back from the backend to the frontend.
- React.js for building the user interface.
- Local storage for auto-saving code state.
- RESTful API for communication with the backend.
- Node.js with Express.js for building the server.
- Child process module for executing code in different languages.
- Implement proper input validation and sanitization to prevent code injection.
- Secure the communication between the frontend and backend.
- Consider horizontal scaling for handling increased traffic.
- Load balancing strategies to distribute requests.
- Consider using databases for more persistent storage if needed (e.g., user accounts, file history).
- Implement robust error handling mechanisms for both frontend and backend.
- Log errors for debugging and monitoring.
- Optimize the code editor interface for a smooth and responsive user experience.