Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contact Manager

A full-stack web application to manage contacts — create, store and list contacts with name, email and phone number. Built with Node.js, Express and MySQL.

Tech Stack

  • Backend: Node.js, Express 5
  • Database: MySQL
  • Frontend: HTML5, CSS3, Vanilla JavaScript (Fetch API)
  • Dev tools: Nodemon

Features

  • Add new contacts through a clean, validated form
  • View all saved contacts in a responsive table
  • Server-side input validation (name and email required)
  • Parameterized SQL queries (SQL injection safe)
  • Responsive design for mobile and desktop

Getting Started

Prerequisites

Setup

  1. Clone the repository:
git clone https://github.com/your-username/contact-manager-nodejs.git
cd contact-manager-nodejs
  1. Install dependencies:
npm install
  1. Create the database — open MySQL and run:
mysql -u root < database.sql

Or copy the content of database.sql and run it in MySQL Workbench.

  1. Configure environment variables:
cp .env.example .env

Edit .env with your MySQL credentials if needed (defaults work for a standard local setup).

  1. Start the development server:
npm run dev
  1. Open http://localhost:3000 in your browser.

Project Structure

contact-manager-nodejs/
├── config/
│   └── db.js               # MySQL connection pool
├── routes/
│   └── contacts.routes.js   # API and page routes
├── public/
│   ├── css/
│   │   └── style.css        # Application styles
│   └── js/
│       ├── form.js          # Form submission handler
│       └── list.js          # Contact list loader
├── views/
│   ├── form.html            # New contact form
│   └── list.html            # Contact list page
├── .env.example             # Environment variables template
├── database.sql             # Database schema
├── server.js                # Express server entry point
└── package.json

API Routes

Method Route Description
GET / New contact form
POST /form Save a contact
GET /list Contact list page
GET /api/contactos JSON — returns all contacts

Deployment

This app can be deployed to platforms like Railway, Render or any VPS with Node.js and MySQL.

The config/db.js file already reads from environment variables, so just set DB_HOST, DB_USER, DB_PASSWORD, DB_NAME and DB_PORT in your hosting provider's dashboard.

Author

Alexandre Rocha

License

MIT

About

Full-stack CRUD app — Node.js, Express, MySQL, parameterized queries, REST API, vanilla JS frontend

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages