Skip to content

clinotes/server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clinot.es server CircleCI

This is a side-project in Go to play with Heroku, Postmark, Stripe and PostgreSQL.

The server at clinot.es is a remote note management service with a command line client. Use the hosted service or feel to host it by yourself …

Features

  • Create account
  • Verify account
  • Create access token
  • Verify access token
  • Create subscriptions (draft)
  • Create notes
  • List notes

Dependecies

  • PostgreSQL database
  • Postmark (send emails, required)
  • Stripe (handle subscriptions, draft)

Setup

The API server works fine on a free Heroku dyno using the free PostgreSQL add-on. The free Postmark accounts comes with 25.000 free emails, so this should last for a couple of accounts ;)

Postmark

Postmark is used for sending emails to new users. You need to create three templates in your Postmark account and configure the template IDs in your environment variables. You will find the three HTML and plaintext templates inside the templates/ folder:

Make sure to validate your sender address in Postmark as well!

Application

$ > git clone git@github.com:clinotes/server.git
$ > cd server
$ > heroku create
$ > heroku addons:create heroku-postgresql:hobby-dev
$ > git push heroku master
$ > heroku info

…
Web URL: https://exmaple-url-12345.herokuapp.com/

Environment

$ > heroku config:set MAX_DB_CONNECTIONS=5
$ > heroku config:set POSTMARK_API_KEY=API_KEY
$ > heroku config:set POSTMARK_TEMPLATE_WELCOME=TEMPLATE_ID
$ > heroku config:set POSTMARK_TEMPLATE_CONFIRM=TEMPLATE_ID
$ > heroku config:set POSTMARK_TEMPLATE_TOKEN=TEMPLATE_ID
$ > heroku config:set POSTMARK_FROM=mail@clinot.es
$ > heroku config:set POSTMARK_REPLY_TO='"CLI Notes" <mail@clinot.es>'

Client

$ > brew tap clinotes/cn
$ > brew install cn
$ > echo "CLINOTES_API_HOSTNAME: https://exmaple-url-12345.herokuapp.com/" > ~/.clinotes.yaml
$ > cn version

client: v0.2.1
server: v0.0.5 (supports client >= v0.1.0)

License

Feel free to use the server code, it's released using the GPLv3 license.

Contributors