CodeLink is a collaborative code-sharing application that allows users to share code in real-time with others. It provides a code editor with live updates using socket.io, supports various themes and languages, and includes features like user customization and session validation.
- Real-time collaborative code editing
- Supports multiple themes and languages
- Customizable editor settings (theme, font size, language)
- Live code updates with socket.io
- Room validation for secure code sharing
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/Jeet-baldha/codelink.git
-
Navigate to the project directory:
cd codelink
-
Install server dependencies:
cd backend npm install
-
Install client dependencies:
cd ../frontend npm install
-
Start the server:
cd ../backend node index.js
-
Start the client:
cd ../frontend npm run dev
- Open your browser and navigate to
http://localhost:5173
to access the application. - Click on the "Share now" button to open the code editor. Then click on the Link icon on the right sidebar, copy the link, and share it with your friend.
- Start coding and see your changes live with other participants in the room.
The server can be configured by editing the environment variables in the .env
file located in the backend
directory.
PORT=3000
MONGODB_URL=your_mongodb_connection_string
Tailwind CSS is used for styling the frontend. Follow these steps to set it up:
-
Install Tailwind CSS via npm:
npm install -D tailwindcss postcss autoprefixer npx tailwindcss init -p
-
Configure your
tailwind.config.js
file:/** @type {import('tailwindcss').Config} */ module.exports = { content: [ "./src/**/*.{js,jsx,ts,tsx}", ], theme: { extend: {}, }, plugins: [], }
-
Add the Tailwind directives to your CSS file (e.g.,
src/index.css
):@tailwind base; @tailwind components; @tailwind utilities;
-
Ensure your CSS file is imported in your
src/main.jsx
orsrc/main.tsx
:import './index.css';
Validates if a room URL exists.
- Request Body:
{ url: string }
- Response:
{ data: boolean }
Creates a new room with a unique URL.
- Response:
{ url: string }
-
Frontend:
- React
- Tailwind css
- Ace Editor
- Redux
- React Router
- Socket.io-client
- Axios
-
Backend:
- Node.js
- Express
- Socket.io
- Mongoose
- Redis
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature-name
). - Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature/your-feature-name
). - Open a pull request.