Giter VIP home page Giter VIP logo

einkaufsliste-go-gin's Introduction

einkaufsliste-go-gin

A simple shopping list application written in Go, using a PostgreSQL database to store all entries. Serving a REST-API for the frontend.

Frontend

A basic vue.js frontend exists c-jaenicke/einkaufsliste-vue.

A better and more modern looking frontend written using svelte c-jaenicke/einkaufsliste-svelte.

Authentication

There is no built-in authentication!

This doesn't have any authentication included! If you want yours to be secure, put something like Authelia or Authentik in front ot it.

Everyone that has access to the site can change the entries!


Docker

version: "3.9"

services:
  db:
    container_name: einkaufsliste-db
    hostname: einkaufsliste-db
    image: postgres:15
    restart: unless-stopped
    environment:
      # change values here!
      - POSTGRES_PASSWORD=<SET PASSWORD HERE>
      - POSTGRES_USER=<SET USERNAME HERE>
      - POSTGRES_DB=<SET DB NAME HERE>
    volumes:
      - einkaufsliste-db-volume:/var/lib/postgresql/data
    expose:
      - 5432
    healthcheck:
      test: [ "CMD-SHELL", "pg_isready -d <SET DB NAME HERE> -U <SET USERNAME HERE>" ]
      interval: 10s
      timeout: 5s
      retries: 5

  frontend:
    container_name: einkaufsliste-frontend
    hostname: einkaufsliste-frontend
    image: einkaufsliste-svelte:latest
    restart: unless-stopped
    environment:
      - "ORIGIN=<SET DOMAIN HERE, LOCALHOST:PORT WHEN TESTING>"
    ports:
      - 3000:3000
    expose:
      - 3000

  backend:
    container_name: einkaufsliste-api
    hostname: einkaufsliste-api
    image: einkaufsliste-rest:latest
    restart: unless-stopped
    ports:
      - 8080:8080
    environment:
      # make sure to change values here! need to be the same as above!
      - DSS=host=einkaufsliste-db port=5432 user=<SET USERNAME HERE> dbname=<SET DB NAME HERE> password=<SET PASSWORD HERE> sslmode=disable
      # switch gin mode [debug|test|release]
      - GIN_MODE=release
      # set allowed origins for cors, string of urls seperated by a ","
      - ALLOWED_ORIGINS=http://localhost:3000,http://einkaufsliste-frontend:3000
    expose:
      - 8080
    depends_on:
      db:
        condition: service_healthy

volumes:
  einkaufsliste-db-volume:

networks:
  default:
    driver: bridge

.env

Following string has to be set, either in the .env file when building the docker image, or in the docker-compose file.

DSS=host=<db container name> port=5432 user=<username> dbname=<db name> password=<password> sslmode=disable

Test Release Mode Locally

Run using GIN_MODE=release go run cmd/enting/main.go


REST-API

Category

Get     category/all
Post    category/new
Delete  category/:id/delete
Put     (category/:id/update)

Get

[
  {
    "id": "NUMBER",
    "name": "STRING",
    "color": "STRING(#000000-#ffffff)",
    "edges": {}
  }
]

Post

{
  "id": "NUMBER",
  "name": "STRING",
  "color": "STRING"
}

Store

Get     store/all
Post    store/new
Delete  store/:id/delete
Put     (store/:id/update)

Get

[
  {
    "id": "NUMBER",
    "name": "STRING",
    "edges": {}
  }
]

Post

    {
  "name": "STRING"
}

Item

Get     item/all
Get     item/all?store=store&category=category&=status
Post    item/new
Put     item/:id/update
Delete  item/:id/delete
Patch   item/:id/switch

Get

[
  {
    "id": "NUMBER",
    "name": "STRING",
    "note": "STRING",
    "amount": "NUMBER",
    "status": "STRING[new|bought]",
    "store_id": "NUMBER",
    "category_id": "NUMBER",
    "edges": {}
  }
]

Status can be new or bought.

Post / Put

{
  "name": "STRING",
  "note": "STRING",
  "amount": "NUMBER",
  "store_id": "NUMBER",
  "category_id": "NUMBER"
}

Pet

Get

{
	"fed_at": "UNIX TIME AS INT64",
	"amount_fed": "STRING",
	"is_inside": "BOOLEAN"
}

einkaufsliste-go-gin's People

Contributors

c-jaenicke avatar dependabot[bot] avatar

Watchers

Kostas Georgiou avatar  avatar

einkaufsliste-go-gin's Issues

Implement Categories

Implement categories to group items by.

  • Create category
  • Change category
  • Delete category
  • Give item category
  • Update existing item with new category
  • Category overview
  • Category overview with amount of items in category
  • List of items in category

Add Readme

Basic readme exists, expand with following topics

  • docker
  • installation
  • why no real deletion

Implement Colors for Categories

Implement support for colors when creating a category.

Color should be displayed in overview of items. Either as Box before name or as background of name table field.

  • Give 10 colors to choose from, maybe more, all pastel like colors
  • Expand database
  • Choose color in "Create Category" form
  • Choose color in "Update Category" form
  • Show color in item listings

Simplify Forms

Try to simplify the following forms code wise

  • category-form
  • form

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.