A modern, web-based code editor with live preview functionality. Built with Node.js, Express, and Monaco Editor for a professional coding experience.
- Live Code Editor: Write HTML, CSS, JavaScript, and PHP with syntax highlighting
- Real-time Preview: See your changes instantly in the preview window
- PHP Execution: Server-side PHP code execution with live preview
- Project Management: Save, load, and organize your coding projects
- User Authentication: Secure login/registration system
- Export Functionality: Download your projects as HTML files
- Auto-save: Automatic saving to prevent data loss
- Modern Dark Theme: Professional VS Code-like interface
- Responsive Design: Works on desktop and mobile devices
- Tabbed Editor: Switch between HTML, CSS, JavaScript, and PHP
- Project Sidebar: Easy access to all your saved projects
- Fullscreen Preview: Expand preview for better viewing
- Monaco Editor: Same editor used in VS Code
- SQLite Database: Lightweight, file-based data storage
- JWT Authentication: Secure token-based authentication
- RESTful API: Clean, well-structured backend API
- CORS Enabled: Cross-origin resource sharing support
Before running this application, make sure you have:
- Node.js (version 14 or higher)
- npm (comes with Node.js)
- PHP (version 7.4 or higher) - Required for PHP code execution
-
Clone or download the project
git clone <repository-url> cd codingapp
-
Install dependencies
npm install
-
Start the server
npm start
-
Open your browser Navigate to
http://localhost:3000
To run the application in development mode with auto-restart:
npm run devcodingapp/
βββ public/ # Frontend files
β βββ index.html # Main HTML file
β βββ styles.css # CSS styles
β βββ app.js # Frontend JavaScript
βββ server.js # Express server
βββ package.json # Dependencies and scripts
βββ codingapp.db # SQLite database (created automatically)
βββ README.md # This file
POST /api/register- Register a new userPOST /api/login- Login user
GET /api/projects- Get all user projectsGET /api/projects/:id- Get specific projectPOST /api/projects- Create new projectPUT /api/projects/:id- Update projectDELETE /api/projects/:id- Delete projectGET /api/projects/:id/export- Export project as HTML
POST /api/execute-php- Execute PHP code and return HTML output
- Register/Login: Create an account or login with existing credentials
- Create Project: Click "New Project" to start coding
- Write Code: Use the tabbed editor to write HTML, CSS, JavaScript, and PHP
- Live Preview: See your changes instantly in the preview panel
- Save Project: Click "Save" to store your project (auto-save also available)
- Export: Download your project as an HTML file
- Syntax Highlighting: Automatic highlighting for HTML, CSS, JavaScript, and PHP
- Auto-completion: Intelligent code suggestions
- Error Detection: Real-time error highlighting
- Line Numbers: Easy navigation with line numbers
- Word Wrap: Automatic text wrapping for better readability
- Server-side Execution: PHP code runs on the server and displays output in preview
- Error Handling: PHP errors are displayed in the preview window
- HTML Integration: PHP code can be mixed with HTML, CSS, and JavaScript
- Real-time Preview: See PHP output immediately as you type
- Security: PHP execution is sandboxed and has timeout protection
- Save Projects: Projects are automatically saved to your account
- Load Projects: Access all your projects from the sidebar
- Project List: View all projects with last modified dates
- Delete Projects: Remove projects you no longer need
You can configure the application using environment variables:
PORT=3000 # Server port (default: 3000)
JWT_SECRET=your-secret-key # JWT secret for authenticationThe application uses SQLite for data storage. The database file (codingapp.db) is created automatically when you first run the application.
- Password Hashing: Passwords are hashed using bcrypt
- JWT Tokens: Secure authentication tokens
- Input Validation: Server-side validation for all inputs
- SQL Injection Protection: Parameterized queries
- CORS Protection: Configured for security
- Chrome (recommended)
- Firefox
- Safari
- Edge
-
Port already in use
# Change the port in server.js or use a different port PORT=3001 npm start -
Database errors
# Delete the database file and restart rm codingapp.db npm start -
Monaco Editor not loading
- Check your internet connection
- Ensure CDN is accessible
- Try refreshing the page
-
PHP execution not working
- Ensure PHP is installed and accessible from command line
- Check if
phpcommand is in your system PATH - Verify PHP version is 7.4 or higher
- Check server logs for PHP execution errors
- Close unused browser tabs
- Use modern browsers for best performance
- Large projects may take longer to load
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.
If you encounter any issues or have questions:
- Check the troubleshooting section
- Review the browser console for errors
- Ensure all dependencies are installed
- Verify your Node.js version
- Support for more programming languages
- Collaborative editing
- Version control integration
- Custom themes
- Plugin system
- Cloud storage integration
- Real-time collaboration
- Advanced debugging tools
Happy Coding! π
