Skip to content

Full-stack phonebook app for managing contacts. Built with React, Node.js, Express, and MongoDB. Supports CRUD operations with a responsive UI.

Notifications You must be signed in to change notification settings

CodeByYuxuan/phonebook-app-react-mongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ž Phonebook App (React + Node.js + MongoDB)

A full-stack contact management application built with React for the frontend, Node.js/Express for the backend, and MongoDB Atlas for persistent storage.

This project is part of the Full Stack Open course and focuses on mastering CRUD operations, backend deployment, environment configuration, and RESTful API development.


πŸš€ Features

  • Add, update, delete, and list contacts
  • Client-side input validation
  • Backend data validation with Mongoose
  • Real-time notifications on operations
  • Responsive UI with React
  • MongoDB Atlas for cloud-based data persistence
  • RESTful API with Express.js

πŸ—‚ Project Structure

Phonebook/
β”œβ”€β”€ backend/           # Node.js + Express backend
β”‚   β”œβ”€β”€ index.js
β”‚   β”œβ”€β”€ models/
β”‚   └── controllers/
β”œβ”€β”€ frontend/          # React + Vite frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ App.jsx
β”‚   β”‚   β”œβ”€β”€ main.jsx
β”‚   β”‚   └── services/
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html
β”‚   └── package.json

βš™οΈ Getting Started

🧩 Prerequisites

  • Node.js >= 14
  • npm or yarn
  • MongoDB Atlas account

πŸ“¦ Installation

Backend

cd backend
npm install

Set up a .env file in /backend:

MONGODB_URI=mongodb+srv://<username>:<password>@<cluster-url>/<dbname>?retryWrites=true&w=majority
PORT=3001

Start the backend:

npm start

Frontend

cd frontend
npm install
npm run dev

πŸ”Œ API Endpoints (Backend)

Method Endpoint Description
GET /api/persons Get all contacts
POST /api/persons Add a new contact
PUT /api/persons/:id Update a contact
DELETE /api/persons/:id Delete a contact

🌐 Deployment

You can deploy the backend to Render or Railway, and the frontend to Netlify or Vercel.


βœ… ESLint Setup

The frontend uses ESLint with:

  • eslint-plugin-react
  • @eslint/js
  • Vite for fast development

Lint code with:

npm run lint

πŸ“š Learn More


πŸ§‘β€πŸ’» Author

Yuxuan β€” developed as part of Full Stack Open coursework.


πŸ“ License

This project is licensed for educational purposes. Use it to learn, extend, and build upon your own full-stack apps.

About

Full-stack phonebook app for managing contacts. Built with React, Node.js, Express, and MongoDB. Supports CRUD operations with a responsive UI.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published