Categorygithub.com/Turtel216/snippetbox
module
0.0.0-20250209230122-2690bb45412f
Repository: https://github.com/turtel216/snippetbox.git
Documentation: pkg.go.dev

# README

Snippetbox - A Golang Web Application

Welcome to Snippetbox, a web application for storing and managing snippets of text. This project is built as part of my journey to learn web development in Go (Golang), based on the book Let's Go! by Alex Edwards.

šŸš€ Project Overview

Snippetbox is a simple yet powerful web application that allows users to:

  • Create snippets of text.
  • View snippets by their unique ID.
  • Browse a list of the latest snippets.

This project is a learning exercise designed to implement the best practices in Go web development, including working with templates, routing, forms, authentication, and more.

🌟 Features

  • Fast and Efficient: Built using Go, a statically-typed, compiled language optimized for performance.
  • Clean Architecture: Implements the layered design principles from Let's Go!
  • HTML Templates: Dynamically render web pages using Go's html/template package.
  • Secure: Includes best practices for input validation and protection against common vulnerabilities like XSS.
  • MySQL Integration: Uses MySQL as the database to store snippet information.

šŸ“š What I Learned

While building this project, I focused on:

  1. Structuring a Go web application for maintainability and scalability.
  2. Using Go's built-in libraries for routing and templating.
  3. Handling forms and managing user input securely.
  4. Working with a database (MySQL) in Go.
  5. Adding session-based authentication.

šŸ”§ Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone https://github.com/Turtel216/snippetbox.git  
    cd snippetbox  
    
  2. Install dependencies:

    go mod tidy  
    
  3. Set up Docker:

    docker-compose up --build
    
  4. Open your browser and visit: http://localhost:4000

šŸ“‚ Project Structure

snippetbox/  
ā”œā”€ā”€ cmd/  
│   └── web/                # Entry point for the application  
ā”œā”€ā”€ internal/  
│   ā”œā”€ā”€ models/             # Database models and queries  
│   ā”œā”€ā”€ handlers/           # HTTP handlers for routing  
│   ā”œā”€ā”€ validation/         # Form validation helpers  
│   └── …  
ā”œā”€ā”€ init-scripts/           # Database schema and migrations  
ā”œā”€ā”€ go.mod                  # Dependencies file  
ā”œā”€ā”€ Dockerfile              # Snippetbox docker container  
ā”œā”€ā”€ docker-compose.yml      # Data base and web app config
└── README.md               # Project documentation  

šŸ¤ Contributing

Contributions are welcome! Feel free to submit issues or pull requests to improve this project.

šŸ“ License

This project is for educational purposes and is not intended for production use.

šŸ™Œ Acknowledgments

  • Special thanks to Alex Edwards for writing Let's Go!, which served as the primary resource for this project.

# Packages

No description provided by the author