Skip to content

SnippetBox is a secure and efficient web application for managing and sharing code snippets. Built with Go, it offers a clean user interface and a robust backend, making it an ideal tool for developers who need to organize their code snippets effectively.

License

Notifications You must be signed in to change notification settings

adcondev/snippet-box

Repository files navigation

SnippetBox: A Professional Code Snippet Manager

Project Logo


Badges

Go Version License Build Status


Overview

SnippetBox is a secure and efficient web application for managing and sharing code snippets. Built with Go, it offers a clean user interface and a robust backend, making it an ideal tool for developers who need to organize their code snippets effectively. The application features user authentication, session management, and a RESTful API for seamless integration with other tools.

Features

  • Secure User Authentication: Sign up, log in, and manage your account securely.
  • Snippet Management: Create, view, and delete your code snippets with ease.
  • Session Management: Persistent sessions allow you to stay logged in.
  • RESTful API: A well-defined API for programmatic access to your snippets.
  • Secure by Design: Implemented with security best practices, including HTTPS and password hashing.

Architecture

The application follows a classic client-server architecture, with a Go backend serving HTML templates and a RESTful API. The database is a MySQL instance, and communication is secured with TLS.

graph TD;
    A[Client] -->|HTTPS Request| B(Go Web Server);
    B -->|Database Query| C(MySQL Database);
    C -->|Query Result| B;
    B -->|HTML/JSON Response| A;
Loading

Getting Started

Prerequisites

  • Go (version 1.22 or higher)
  • MySQL

Installation

  1. Clone the repository:

    git clone https://github.com/adcondev/snippet-box.git
    cd snippetbox
  2. Install dependencies:

    go mod tidy
  3. Set up the database: Connect to your MySQL instance and run the SQL scripts in the /sql directory to create the necessary tables and user.

    ⚠️ Security Warning:
    Before running sql/create_user.sql, edit the file to change the default username and password to strong, unique values.
    Never use the default credentials in production environments.

Usage

  1. Configure the application: Set the required environment variables, such as the database DSN. You can use the .env.example file as a template.

  2. Run the server:

    go run ./cmd/web -dsn="web:password@/snippetbox?parseTime=true"

    The server will start on https://localhost:4000 by default.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss your ideas.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

SnippetBox is a secure and efficient web application for managing and sharing code snippets. Built with Go, it offers a clean user interface and a robust backend, making it an ideal tool for developers who need to organize their code snippets effectively.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 5