Skip to content

Personalized Flask web app that generates time-based greetings, validates user input, and tracks greeting history. Perfect beginner project for learning Flask, web development, and API design.

License

Notifications You must be signed in to change notification settings

enoughsudhanshu/smart-greeter-flask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Smart Greeter Flask Application

License: MIT Python Flask

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.

๐ŸŒŸ Features

  • ๐Ÿ“ 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

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.7 or higher
  • pip (Python package installer)

Installation

  1. Clone the repository

    git clone https://github.com/enoughsudhanshu/smart-greeter-flask.git
    cd smart-greeter-flask
  2. Create virtual environment

    python -m venv venv
    
    # Activate virtual environment
    # Windows:
    venv\\Scripts\\activate
    # macOS/Linux:
    source venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Run the application

    python app.py
  5. Open your browser Navigate to http://localhost:5000

๐Ÿ“ Project Structure

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

๐Ÿ”ง API Endpoints

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

API Response Example

[
  {
    "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."
  }
]

๐Ÿ’ก Learning Objectives

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

๐ŸŽจ Screenshots

Home Page

Clean form interface with validation

Greeting Display

Personalized time-based greeting

History View

Table showing all past greetings

๐Ÿงช Testing

Manual Testing

  1. Visit home page and test form validation
  2. Submit valid data and verify greeting
  3. Check history page for stored greetings
  4. Test API endpoint at /api/greetings

Validation Rules

  • Name and Work fields are required
  • Length must be between 1-40 characters
  • Input is sanitized (spaces trimmed)
  • Error messages display inline

๐Ÿ”’ Security Features

  • Input Sanitization: Prevents XSS attacks
  • Form Validation: Server-side validation
  • Template Escaping: Jinja2 auto-escaping
  • Length Limits: Prevents overflow attacks

๐ŸŒ Time-Based Greetings

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

๐Ÿค Contributing

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.

๐Ÿ“š Educational Use

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

๐Ÿ”ง Technologies Used

  • 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.

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘จโ€๐Ÿ’ป Author

Sudhanshu Pandey

๐Ÿ™ Acknowledgments

  • Flask documentation and community
  • Python Software Foundation
  • Open source contributors

๐Ÿ“ž Support

If you have any questions or run into issues:

  1. Check the Issues page
  2. Create a new issue if needed
  3. Contact the author

๐Ÿ”ฎ Future Enhancements

  • 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

About

Personalized Flask web app that generates time-based greetings, validates user input, and tracks greeting history. Perfect beginner project for learning Flask, web development, and API design.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published