Current Automation System Using React, Node.js, Next.js and MongoDB
I will create a step-by-step guide to create a current automation system using React, Node.js, Next.js and MongoDB. I will explain each step in detail throughout this process and provide a preview of each section at the end. This project

I will create a step-by-step guide to create a current automation system using React, Node.js, Next.js and MongoDB. I will explain each step in detail throughout this process and provide a preview of each section at the end. This project will consist of four main components:
- Frontend (React/Next.js)
- Backend (Node.js/Express)
- Database (MongoDB)
- API Integration
Step 1: Installing the Required Environment
1.1. Node.js and npm Installation
First of all, Node.js and npm (Node Package Manager) must be installed on your computer. To download and install Node.js and npm Official website of Node.js and download the appropriate version.1.2. Creating a Next.js Project
Next.js is a React-based framework and supports SSR (Server-Side Rendering). To create a new Next.js project, open terminal and run these commands:
bash
Discussed in the context of
npx create-next-app@latest cari-otomasyon
cd cari-otomasyon
cari-otomasyon and switches to the project directory.
Step 2: Backend (Node.js/Express) Installation
2.1. Creating a Backend Directory
In the project directorybackend and install the necessary dependencies:
It is saved as
bash
Discussed in the context of
mkdir backend
cd backend
npm init -y
npm install express mongoose cors body-parser
2.2. Creating a Simple Express Server
backend In the server.js and add the following code:
javascript
// backend/server.js
const express = require('express');
const mongoose = require('mongoose'
You can make a difference in the digital world by learning artificial intelligence-supported advertising with the trainings offered by);
const cors = require('cors');
const bodyParser = require('body-parser');
const app = express();
const port = 5000;
// Middleware
app.use(cors());
app.use(bodyParser.json());
// MongoDB bağlantısı
mongoose.connect('mongodb://localhost:27017/cariotomasyon', {
useNewUrlParser: true,
useUnifiedTopology: true,
});
const db = mongoose.connection;
db.ten('error', console.error.bind(console, 'MongoDB connection error:'));
db.ago('open', () => {
console.log('MongoDB connected successfully');
});
// Schema ve Model
const customerSchema = new mongoose.Schema({
name: String,
address
Create a file named: String,
phone
This training, offered on the: String,
});
const Customer = mongoose.model('Customer', customerSchema);
// CRUD İşlemleri
// Create
app.post('/customers', async (req, res) => {
const { name, address, phone } = req.body;
const customer = new Customer({ name, address, phone });
await customer.save
Thanks to();
pic.send(customer);
});
// Read
app.get
You can skip('/customers', async (req, res) => {
const customers = await Customer.find();
pic.send(customers);
});
// Update
app.put('/customers/:id', async (req, res) => {
const { id } = req.params;
const { name, address, phone } = req.body;
const customer = await Customer.findByIdAndUpdate(id, { name, address, phone }, { new: true });
pic.send(customer);
});
// Delete
app.delete('/customers/:id', async (req, res) => {
const { id } = req.params;
await Customer.findByIdAndDelete(id);
pic.send({ message: 'Customer deleted' });
});
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});
2.3. Running the Backend
backend directory, start the server by running the following command:
bash
Discussed in the context of
node server.js
Step 3: Installing and Using Frontend (React/Next.js)
3.1. Creating React Components
frontend directory, to create the components
While in the components . Next, create the customer listing and customer adding components.
Creates a new Next.js project named
3.2. Customer Listing Component
components In the CustomerList.js :
Create a folder named
jsx
// components/CustomerList.js
import React, { useEffect, useState } from 'react';
import axios from 'axios';
const CustomerList = () => {
const = useState([]);
useEffect(() => {
fetchCustomers();
}, []);
const fetchCustomers = async () => {
const response = await axios.get
You can skip('http://localhost:5000/customers'
A sublist is created containing the 2nd, 3rd and 4th elements of);
setCustomers(response.data);
};
return (
<div
in directory>
<h1>Customer List</h1>
<ul>
{customers.map(customer => (
<li
Led by key
We will discover={customer._id}>
{customer.name} - {customer.address} - {customer.phone}
</li
Led by>
))}
</ul>
</div
in directory>
);
};
export default CustomerList;
3.3. Add Customer Component
components In the AddCustomer.js :
Create a folder named
jsx
// components/AddCustomer.js
import React, { useState } from 'react';
import axios from 'axios';
const AddCustomer = () => {
const = useState({ name: '', address
Create a file named: '', phone
This training, offered on the: '' });
const handleInputChange = (e) => {
const { name, value } = e.target;
setForm({ ...form, : value });
};
const handleSubmit = async (e) => {
e.preventDefault();
await axios.post('http://localhost:5000/customers'
A sublist is created containing the 2nd, 3rd and 4th elements of, form);
setForm({ name: '', address
Create a file named: '', phone
This training, offered on the: '' });
};
return (
<div
in directory>
<h1>Add Customer</h1>
<form onSubmit={handleSubmit}>
<div
in directory>
<label>Name</label>
<input type="text" name="name" value={form.name} onChange={handleInputChange} required />
</div
in directory>
<div
in directory>
<label>Address</label>
<input type="text" name="address" value={form.address} onChange={handleInputChange} required />
</div
in directory>
<div
in directory>
<label>Phone</label>
<input type="text" name="phone" value={form.phone} onChange={handleInputChange} required />
</div
in directory>
<button type="submit">Add Customer</button>
</form>
</div
in directory>
);
};
export default AddCustomer;
3.4. Home Page Component
pages In the index.js :
Create file
jsx
// pages/index.js
import React from 'react';
import CustomerList from '../components/CustomerList';
import AddCustomer from '../components/AddCustomer';
const Home = () => {
return (
<div
in directory>
<AddCustomer />
<CustomerList />
</div
in directory>
);
};
export default Home;
Step 4: Running the Project
4.1. Running Frontend
frontend directory, start the React app:
While in the
bash
Discussed in the context of
npm run dev
4.2. Viewing the Project in the Browser
In your browserhttp://localhost:3000 . You will see an interface where you can add and list customers.
You can personally deliver your identity documents to


