This project is a clone of the popular Threads app, built using React for the frontend and json-server for a mock backend. It demonstrates the power of React for building interactive user interfaces and showcases how to use a JSON file as a simple database for rapid prototyping and development.
- 📝 Create and view threads
- 💬 Comment on threads
- 👤 User profiles
- 🔄 Real-time updates using json-server
- 🎨 Responsive design
- 🚀 Fast development and prototyping
- React - A JavaScript library for building user interfaces
- json-server - Get a full fake REST API with zero coding
- React Router - Declarative routing for React
- Axios - Promise based HTTP client for the browser and node.js
- CSS Modules - Locally scoped CSS
- Node.js (v14 or later)
- npm or yarn
-
Clone the repository:
git clone https://github.com/yusrilprayoga-code/threads-clone.git cd threads-clone
-
Install dependencies:
npm install
-
Start the json-server (make sure you're in the project directory):
json-server --watch db.json
-
In a new terminal, start the React development server:
npm start
-
Open http://localhost:3000 in your browser to see the application.
To start the mock backend server, run:
json-server --watch db.json
This will start the server at http://localhost:3000.
In a separate terminal, run:
npm start
This will start the React app at http://localhost:3001 (or another available port if 3001 is in use).
- Use the "New Thread" button to create a new thread.
- Click on a thread to view and add comments.
- Visit user profiles by clicking on usernames.
- Open
db.json
in the root directory. - Modify the JSON structure to add or change data.
- The changes will be immediately reflected in the app.
├── public/
├── src/
│ ├── components/ # React components
│ ├── pages/ # Page components
│ ├── styles/ # CSS Module files
│ ├── services/ # API services
│ ├── App.js # Main App component
│ └── index.js # Entry point
├── db.json # JSON database file
├── package.json
└── README.md # This file
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Threads for the inspiration
- json-server for the easy-to-use mock backend
- Create React App for the React project setup
Developed with ❤️ by Yusril Prayoga