├── .gitignore
├── README.md
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
└── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── layout
└── Navbar.js
├── logo.svg
├── pages
└── Home.js
├── reportWebVitals.js
├── setupTests.js
└── users
├── AddUser.js
├── EditUser.js
└── ViewUser.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FullStackApp
2 |
3 | FullStackApp is a web application built with Spring Boot for the backend and React for the frontend. It provides a seamless full-stack development experience for building modern web applications.
4 |
5 | ## Table of Contents
6 |
7 | - [Features](#features)
8 | - [Prerequisites](#prerequisites)
9 | - [Getting Started](#getting-started)
10 |
11 | ## Features
12 |
13 | - **Spring Boot Backend:**
14 | - RESTful API endpoints.
15 | - Database integration with Spring Data JPA.
16 |
17 | - **React Frontend:**
18 | - Responsive and dynamic user interface.
19 | - State management using React Hooks.
20 | - Integration with backend APIs.
21 |
22 | - **Full Stack:**
23 | - Seamless integration between the backend and frontend.
24 | - Modern and efficient development workflow.
25 |
26 | ## Prerequisites
27 |
28 | Before you begin, ensure you have met the following requirements:
29 |
30 | - Java Development Kit (JDK) installed.
31 | - Node.js and npm installed.
32 | - IDE with support for Spring Boot and React development.
33 |
34 | ## Getting Started
35 |
36 | Follow these steps to set up and run the FullStackApp locally:
37 |
38 | 1. Clone the backend repository:
39 |
40 | ```bash
41 | git clone https://github.com/arjungautam1/fullstack-backend.git
42 |
43 | 1. Clone the Frontend repository:
44 |
45 | ```bash
46 | git clone https://github.com/arjungautam1/fullstack-frontend.git
47 |
48 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "fullstack-front",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^5.16.4",
7 | "@testing-library/react": "^13.2.0",
8 | "@testing-library/user-event": "^13.5.0",
9 | "axios": "^0.27.2",
10 | "bootstrap": "^5.1.3",
11 | "react": "^18.1.0",
12 | "react-dom": "^18.1.0",
13 | "react-router-dom": "^6.3.0",
14 | "react-scripts": "5.0.1",
15 | "web-vitals": "^2.1.4"
16 | },
17 | "scripts": {
18 | "start": "react-scripts start",
19 | "build": "react-scripts build",
20 | "test": "react-scripts test",
21 | "eject": "react-scripts eject"
22 | },
23 | "eslintConfig": {
24 | "extends": [
25 | "react-app",
26 | "react-app/jest"
27 | ]
28 | },
29 | "browserslist": {
30 | "production": [
31 | ">0.2%",
32 | "not dead",
33 | "not op_mini all"
34 | ],
35 | "development": [
36 | "last 1 chrome version",
37 | "last 1 firefox version",
38 | "last 1 safari version"
39 | ]
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arjungautam1/fullstack-frontend/ce6a410b175cbb8747382fa632ee0b3fcf3ddae7/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arjungautam1/fullstack-frontend/ce6a410b175cbb8747382fa632ee0b3fcf3ddae7/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/arjungautam1/fullstack-frontend/ce6a410b175cbb8747382fa632ee0b3fcf3ddae7/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import "./App.css";
2 | import "../node_modules/bootstrap/dist/css/bootstrap.min.css";
3 | import Navbar from "./layout/Navbar";
4 | import Home from "./pages/Home";
5 | import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
6 | import AddUser from "./users/AddUser";
7 | import EditUser from "./users/EditUser";
8 | import ViewUser from "./users/ViewUser";
9 |
10 | function App() {
11 | return (
12 |
13 |
14 |
15 |
16 |
17 | } />
18 | } />
19 | } />
20 | } />
21 |
22 |
23 |
24 | );
25 | }
26 |
27 | export default App;
28 |
--------------------------------------------------------------------------------
/src/App.test.js:
--------------------------------------------------------------------------------
1 | import { render, screen } from '@testing-library/react';
2 | import App from './App';
3 |
4 | test('renders learn react link', () => {
5 | render();
6 | const linkElement = screen.getByText(/learn react/i);
7 | expect(linkElement).toBeInTheDocument();
8 | });
9 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(document.getElementById('root'));
8 | root.render(
9 |
10 |
11 |
12 | );
13 |
14 | // If you want to start measuring performance in your app, pass a function
15 | // to log results (for example: reportWebVitals(console.log))
16 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17 | reportWebVitals();
18 |
--------------------------------------------------------------------------------
/src/layout/Navbar.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import { Link } from "react-router-dom";
3 |
4 | export default function Navbar() {
5 | return (
6 |
7 |
29 |
30 | );
31 | }
32 |
--------------------------------------------------------------------------------
/src/logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/pages/Home.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import axios from "axios";
3 | import { Link, useParams } from "react-router-dom";
4 |
5 | export default function Home() {
6 | const [users, setUsers] = useState([]);
7 |
8 | const { id } = useParams();
9 |
10 | useEffect(() => {
11 | loadUsers();
12 | }, []);
13 |
14 | const loadUsers = async () => {
15 | const result = await axios.get("http://localhost:8080/users");
16 | setUsers(result.data);
17 | };
18 |
19 | const deleteUser = async (id) => {
20 | await axios.delete(`http://localhost:8080/user/${id}`);
21 | loadUsers();
22 | };
23 |
24 | return (
25 |
26 |
27 |
28 |
29 |
30 | S.N |
31 | Name |
32 | Username |
33 | Email |
34 | Action |
35 |
36 |
37 |
38 | {users.map((user, index) => (
39 |
40 |
41 | {index + 1}
42 | |
43 | {user.name} |
44 | {user.username} |
45 | {user.email} |
46 |
47 |
51 | View
52 |
53 |
57 | Edit
58 |
59 |
65 | |
66 |
67 | ))}
68 |
69 |
70 |
71 |
72 | );
73 | }
74 |
--------------------------------------------------------------------------------
/src/reportWebVitals.js:
--------------------------------------------------------------------------------
1 | const reportWebVitals = onPerfEntry => {
2 | if (onPerfEntry && onPerfEntry instanceof Function) {
3 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4 | getCLS(onPerfEntry);
5 | getFID(onPerfEntry);
6 | getFCP(onPerfEntry);
7 | getLCP(onPerfEntry);
8 | getTTFB(onPerfEntry);
9 | });
10 | }
11 | };
12 |
13 | export default reportWebVitals;
14 |
--------------------------------------------------------------------------------
/src/setupTests.js:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/src/users/AddUser.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 | import React, { useState } from "react";
3 | import { Link, useNavigate } from "react-router-dom";
4 |
5 | export default function AddUser() {
6 | let navigate = useNavigate();
7 |
8 | const [user, setUser] = useState({
9 | name: "",
10 | username: "",
11 | email: "",
12 | });
13 |
14 | const { name, username, email } = user;
15 |
16 | const onInputChange = (e) => {
17 | setUser({ ...user, [e.target.name]: e.target.value });
18 | };
19 |
20 | const onSubmit = async (e) => {
21 | e.preventDefault();
22 | await axios.post("http://localhost:8080/user", user);
23 | navigate("/");
24 | };
25 |
26 | return (
27 |
28 |
29 |
30 |
Register User
31 |
32 |
79 |
80 |
81 |
82 | );
83 | }
84 |
--------------------------------------------------------------------------------
/src/users/EditUser.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 | import React, { useEffect, useState } from "react";
3 | import { Link, useNavigate, useParams } from "react-router-dom";
4 |
5 | export default function EditUser() {
6 | let navigate = useNavigate();
7 |
8 | const { id } = useParams();
9 |
10 | const [user, setUser] = useState({
11 | name: "",
12 | username: "",
13 | email: "",
14 | });
15 |
16 | const { name, username, email } = user;
17 |
18 | const onInputChange = (e) => {
19 | setUser({ ...user, [e.target.name]: e.target.value });
20 | };
21 |
22 | useEffect(() => {
23 | loadUser();
24 | }, []);
25 |
26 | const onSubmit = async (e) => {
27 | e.preventDefault();
28 | await axios.put(`http://localhost:8080/user/${id}`, user);
29 | navigate("/");
30 | };
31 |
32 | const loadUser = async () => {
33 | const result = await axios.get(`http://localhost:8080/user/${id}`);
34 | setUser(result.data);
35 | };
36 |
37 | return (
38 |
39 |
40 |
41 |
Edit User
42 |
43 |
90 |
91 |
92 |
93 | );
94 | }
95 |
--------------------------------------------------------------------------------
/src/users/ViewUser.js:
--------------------------------------------------------------------------------
1 | import axios from "axios";
2 | import React, { useEffect,useState } from "react";
3 | import { Link, useParams } from "react-router-dom";
4 |
5 | export default function ViewUser() {
6 | const [user, setUser] = useState({
7 | name: "",
8 | username: "",
9 | email: "",
10 | });
11 |
12 | const { id } = useParams();
13 |
14 | useEffect(() => {
15 | loadUser();
16 | }, []);
17 |
18 | const loadUser = async () => {
19 | const result = await axios.get(`http://localhost:8080/user/${id}`);
20 | setUser(result.data);
21 | };
22 |
23 | return (
24 |
25 |
26 |
27 |
User Details
28 |
29 |
30 |
31 | Details of user id : {user.id}
32 |
33 | -
34 | Name:
35 | {user.name}
36 |
37 | -
38 | UserName:
39 | {user.username}
40 |
41 | -
42 | Email:
43 | {user.email}
44 |
45 |
46 |
47 |
48 |
49 | Back to Home
50 |
51 |
52 |
53 |
54 | );
55 | }
56 |
--------------------------------------------------------------------------------