A personalized greeting web application built with Flask that provides time-based greetings and maintains greeting history. Perfect for learning Flask fundamentals and web development concepts.
- ๐ Personalized Forms: Enter your name and profession
- โฐ Time-Based Greetings: Dynamic greetings based on current time
- โ Input Validation: Client and server-side validation with error handling
- ๐ History Tracking: View all past greetings in a table
- ๐ JSON API: RESTful endpoint for programmatic access
- ๐ฑ Responsive Design: Mobile-friendly interface
- ๐จ Modern UI: Clean design with rounded corners and shadows
- Python 3.7 or higher
- pip (Python package installer)
-
Clone the repository
git clone https://github.com/enoughsudhanshu/smart-greeter-flask.git cd smart-greeter-flask -
Create virtual environment
python -m venv venv # Activate virtual environment # Windows: venv\\Scripts\\activate # macOS/Linux: source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Run the application
python app.py
-
Open your browser Navigate to
http://localhost:5000
smart_greeter/
โโโ app.py # Main Flask application
โโโ requirements.txt # Python dependencies
โโโ LICENSE # MIT License
โโโ README.md # Project documentation
โโโ .gitignore # Git ignore rules
โโโ static/
โ โโโ style.css # CSS styling
โโโ templates/
โโโ base.html # Base template
โโโ index.html # Home page
โโโ greeting.html # Greeting display
โโโ history.html # History page
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Home page with greeting form |
/greet |
POST | Process form and display greeting |
/history |
GET | View all greeting history |
/api/greetings |
GET | JSON API returning all greetings |
[
{
"timestamp": "2025-09-12 15:30:00",
"name": "John Doe",
"work": "Software Developer",
"greeting_text": "Good Afternoon, John Doe! We know you work as a Software Developer."
}
]This project demonstrates:
- Flask Fundamentals: Routing, templates, forms
- Web Development: HTML, CSS, responsive design
- Input Validation: Security best practices
- API Development: JSON endpoints
- Template Inheritance: DRY principle
- Time-Based Logic: Dynamic content generation
Clean form interface with validation
Personalized time-based greeting
Table showing all past greetings
- Visit home page and test form validation
- Submit valid data and verify greeting
- Check history page for stored greetings
- Test API endpoint at
/api/greetings
- Name and Work fields are required
- Length must be between 1-40 characters
- Input is sanitized (spaces trimmed)
- Error messages display inline
- Input Sanitization: Prevents XSS attacks
- Form Validation: Server-side validation
- Template Escaping: Jinja2 auto-escaping
- Length Limits: Prevents overflow attacks
| Time Range | Greeting |
|---|---|
| 5:00 AM - 11:59 AM | Good Morning |
| 12:00 PM - 4:59 PM | Good Afternoon |
| 5:00 PM - 8:59 PM | Good Evening |
| 9:00 PM - 4:59 AM | Good Night |
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
See CONTRIBUTING.md for details.
This project is perfect for:
- Computer Science Students: Learning web development
- Flask Beginners: Understanding framework basics
- College Projects: Meeting academic requirements
- Portfolio Projects: Demonstrating skills
- Backend: Flask 2.3.3, Python 3.7+
- Frontend: HTML5, CSS3, Jinja2 Templates
- Development: Virtual Environment, Git
- Deployment: Can be deployed to Heroku, PythonAnywhere, etc.
This project is licensed under the MIT License - see the LICENSE file for details.
Sudhanshu Pandey
- GitHub: @enoughsudhanshu
- Email: sudhanshupandey10124@gmail.com
- Flask documentation and community
- Python Software Foundation
- Open source contributors
If you have any questions or run into issues:
- Check the Issues page
- Create a new issue if needed
- Contact the author
- User authentication system
- Database integration (SQLite/PostgreSQL)
- Theme toggle (light/dark mode)
- Export greetings to CSV
- Email notifications
- Multiple language support
- Mobile app version
โญ Star this repository if it helped you learn Flask!
Made with โค๏ธ for learning and education