orgnote-backend icon indicating copy to clipboard operation
orgnote-backend copied to clipboard

Backend side for second brain

:PROPERTIES: :ID: orgnote-backend :END:

#+html:

#+html: #+html:
#+html:  

#+TITLE: ✨ Org Note backend.

#+html:

#+html: #+html: Buy Me A Coffee donate button #+html: #+html: #+html: Patreon donate button #+html: #+html: wakatime #+html:
#+html:
#+html: Twitter link #+html: Mastodon Follow #+html: Discord #+html: YouTube Channel Views #+html:
  • Introduction This project is part of [[https://github.com/Artawower/orgnote][Org Note project]]. It is a backend part based on the [[https://gofiber.io/][GO fiber]] framework.
  • Connected links
  • [[http://65.108.90.95/api/v1/swagger/index.html][Swagger schema]]
  • [[https://github.com/Artawower/orgnote][Main repo]]
  • [[https://github.com/Artawower/orgnote-client][Org Note frontend]]
  • [[https://en.wikipedia.org/wiki/Zettelkasten][About Zettelkasten approach]]
  • [[https://gofiber.io/][GO fiber framework]]
  • [[https://github.com/swaggo/swag][GO swagger library]]
  • Install ** Environment variables
  • ~MONGO_USERNAME~
  • ~MONGO_URL~
  • ~MONGO_PASSWORD~
  • ~MONGO_PORT~
  • ~APP_ADDRESS~ - Current application address
  • ~GITHUB_ID~ - github id for oauth
  • ~GITHUB_SECRET~ - github secret for oauth
  • ~BACKEND_DOMAIN~ - backend domain address
  • ~BACKEND_SCHEMA~ - backend schema (http/https)
  • ~BACKEND_PORT~ - backend port
  • ~CLIENT_ADDRESS~ - client address for oauth redirect
  • ~ACCESS_CHECK_URL~ - url address for checking access to the backend. For self hosted systems this values should not be provided
  • ~ACCESS_CHECK_TOKEN~ - Auth token for request to ~ACCESS_CHECK_URL~. Will be added into ~Authorization~ header

** Local development *** External API schema [[https://github.com/deepmap/oapi-codegen][Install open api codegen and execute script]] #+BEGIN_SRC bash chmod +x generate-subscription-api.sh && ./generate-subscription-api #+END_SRC

  • =/api/subscription-info= - information about subscription #+BEGIN_SRC json { "email": "string", "spaceLimit": "bytes", "isActive": "boolean" } #+END_SRC *** Init .env file for storing environment variables #+BEGIN_SRC bash DEBUG=debug mode MONGO_USERNAME=mongo username MONGO_PASSWORD=mongo password GITHUB_ID=github id for oauth GITHUB_SECRET=github secret for oauth CLIENT_ADDRESS=url to redirect after oauth BACKEND_HOST=full backend host BACKEND_DOMAIN=backend domain BACKEND_SCHEMA=backend schema (http) ACCESS_CHECK_URL=http://65.108.90.95:8000 // check url for active subscription, leave empty for development ACCESS_CHECK_TOKEN=token for working with external service, leave empty for development #+END_SRC *** Run development docker container /Docker & docker-compose/ are required #+BEGIN_SRC bash docker compose -f docker-compose.db.yaml -f docker-compose.dev.yaml up --build #+END_SRC
  • 🍩 Contribute guide Any contribution is very much appreciated! Please read the [[https://github.com/Artawower/orgnote/wiki/Contribution-guide][style guide]] before contributing to avoid misunderstandings! I would also appreciate it if you would consider becoming my [[https://www.patreon.com/artawower][patron]]

  • Development ** Migrations =migrate create -ext mongodb -dir ./migrations -seq change_encrypted_field_name= [[https://github.com/golang-migrate/migrate/blob/master/GETTING_STARTED.md][See more details here]]