A command-line based salon appointment booking system built with Bash and PostgreSQL. This project allows customers to book salon services, manage customer information, and track appointments.
my-salon/
├── salon.sh # Main Bash script for the salon booking system
├── salon.sql # Database schema and initial data
└── README.md # This file
- Interactive Menu System: Easy-to-navigate CLI interface for customers
- Service Selection: Choose from available salon services (Wig install, Fade Cut, Hair Wash)
- Customer Management:
- New customer registration
- Existing customer recognition by phone number
- Appointment Booking: Schedule appointments with time selection
- Input Validation: Robust error handling for invalid inputs
- Database Persistence: All data stored in PostgreSQL database
- Bash Scripting - Interactive command-line interface
- PostgreSQL - Relational database for data storage
- PSQL Command Line - Database interaction
service_id(PK) - Unique service identifiername- Service name
customer_id(PK) - Unique customer identifierphone(UNIQUE) - Customer phone numbername- Customer name
appointment_id(PK) - Unique appointment identifiercustomer_id(FK) - References customers tableservice_id(FK) - References services tabletime- Appointment timename- [Note: This column appears redundant in the schema]
- Wig install
- Fade Cut
- Hair Wash
Before running this application, ensure you have:
- PostgreSQL installed and running
- Bash shell (available on Linux, macOS, or Windows WSL)
- Appropriate permissions to create databases and tables
# Create and populate the database
psql -U postgres -f salon.sqlAlternatively, you can run the SQL commands directly in psql.
The script uses the following connection parameters:
- Username:
freecodecamp - Database:
salon
Make sure the freecodecamp user exists and has appropriate permissions:
# Create user if needed
sudo -u postgres createuser --superuser freecodecampchmod +x salon.sh./salon.sh- Welcome Screen: The application displays available services
- Service Selection: Enter the number corresponding to your desired service
- Customer Verification: Enter your phone number
- If you're a new customer, you'll be prompted for your name
- Existing customers are recognized automatically
- Time Selection: Choose your preferred appointment time
- Confirmation: Receive a confirmation message with appointment details
~~~~~ MY SALON ~~~~~
Welcome to My Salon, how can I help you?
1) Wig install
2) Fade Cut
3) Hair Wash
> 2
What's your phone number?
> 555-1234
What time would you like your Fade Cut, John?
> 2:30 PM
I have put you down for a Fade Cut at 2:30 PM, John.
MAIN_MENU(): Primary function that handles the user interface flow- Input Validation: Checks for valid service numbers and existing services
- Customer Management: Automatically creates new customer records when needed
- Appointment Creation: Inserts appointments into the database
The script performs the following SQL operations:
- Retrieving available services
- Checking customer existence by phone number
- Inserting new customers
- Creating appointment records
- Formatting output data
-
Permission Denied:
chmod +x salon.sh
-
Database Connection Error:
- Ensure PostgreSQL is running
- Verify the
freecodecampuser exists - Check database name is
salon
-
Invalid Service Number:
- Only numbers 1-3 are valid (based on preloaded services)
- "That is not a valid service number": Entered non-numeric value
- "I could not find that service": Service ID doesn't exist
- "I don't have a record for that phone number": New customer registration
- The
appointmentstable has a redundantnamecolumn that is not used by the script - All times are stored as strings (VARCHAR) in the database
- Phone numbers are used as unique identifiers for customers
- The script uses
sedfor whitespace trimming in formatted output
- Add appointment date along with time
- Implement appointment cancellation functionality
- Add employee assignment to appointments
- Create an admin view for managing appointments
- Add input validation for phone number format
- Implement appointment time conflict checking
This project is for educational purposes as part of the freeCodeCamp curriculum.
Salon Appointment System - Created for database and bash scripting practice.
Note: This project demonstrates practical application of Bash scripting, PostgreSQL integration, and CLI application development.