All Projects → allaboutapps → Go Starter

allaboutapps / Go Starter

Licence: mit
An opinionated production-ready SQL-/Swagger-first RESTful JSON API written in Go, highly integrated with VSCode DevContainers by allaboutapps.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Go Starter

Walkable
A Clojure(script) SQL library for building APIs: Datomic® (GraphQL-ish) pull syntax, data driven configuration, dynamic filtering with relations in mind
Stars: ✭ 384 (+937.84%)
Mutual labels:  sql, postgresql, server
Vscode Sqltools
Database management for VSCode
Stars: ✭ 741 (+1902.7%)
Mutual labels:  sql, postgresql, vscode
Db Dumper
Dump the contents of a database
Stars: ✭ 744 (+1910.81%)
Mutual labels:  sql, postgresql
Mycat2
MySQL Proxy using Java NIO based on Sharding SQL,Calcite ,simple and fast
Stars: ✭ 750 (+1927.03%)
Mutual labels:  sql, server
Eralchemy
Entity Relation Diagrams generation tool
Stars: ✭ 767 (+1972.97%)
Mutual labels:  sql, postgresql
Sequelize
An easy-to-use and promise-based multi SQL dialects ORM tool for Node.js
Stars: ✭ 25,422 (+68608.11%)
Mutual labels:  sql, postgresql
Node Typescript Koa Rest
REST API boilerplate using NodeJS and KOA2, typescript. Logging and JWT as middlewares. TypeORM with class-validator, SQL CRUD. Docker included. Swagger docs, actions CI and valuable README
Stars: ✭ 739 (+1897.3%)
Mutual labels:  swagger, sql
Azuredatastudio
Azure Data Studio is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.
Stars: ✭ 6,605 (+17751.35%)
Mutual labels:  sql, postgresql
Beekeeper Studio
Modern and easy to use SQL client for MySQL, Postgres, SQLite, SQL Server, and more. Linux, MacOS, and Windows.
Stars: ✭ 8,053 (+21664.86%)
Mutual labels:  sql, postgresql
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+2051.35%)
Mutual labels:  postgresql, oauth2
Fluentpdo
A PHP SQL query builder using PDO
Stars: ✭ 783 (+2016.22%)
Mutual labels:  sql, postgresql
Efcore.pg
Entity Framework Core provider for PostgreSQL
Stars: ✭ 838 (+2164.86%)
Mutual labels:  sql, postgresql
Pmacct
pmacct is a small set of multi-purpose passive network monitoring tools [NetFlow IPFIX sFlow libpcap BGP BMP RPKI IGP Streaming Telemetry].
Stars: ✭ 677 (+1729.73%)
Mutual labels:  sql, postgresql
Sqlancer
Detecting Logic Bugs in DBMS
Stars: ✭ 672 (+1716.22%)
Mutual labels:  sql, postgresql
Rezoom.sql
Statically typechecks a common SQL dialect and translates it to various RDBMS backends
Stars: ✭ 621 (+1578.38%)
Mutual labels:  sql, postgresql
Usql
Universal command-line interface for SQL databases
Stars: ✭ 6,869 (+18464.86%)
Mutual labels:  sql, postgresql
Node Pg Migrate
Node.js database migration management for Postgresql
Stars: ✭ 838 (+2164.86%)
Mutual labels:  sql, postgresql
Trdsql
CLI tool that can execute SQL queries on CSV, LTSV, JSON and TBLN. Can output to various formats.
Stars: ✭ 593 (+1502.7%)
Mutual labels:  sql, postgresql
Lucid
AdonisJS official SQL ORM. Supports PostgreSQL, MySQL, MSSQL, Redshift, SQLite and many more
Stars: ✭ 613 (+1556.76%)
Mutual labels:  sql, postgresql
Smartsql
SmartSql = MyBatis in C# + .NET Core+ Cache(Memory | Redis) + R/W Splitting + PropertyChangedTrack +Dynamic Repository + InvokeSync + Diagnostics
Stars: ✭ 775 (+1994.59%)
Mutual labels:  sql, postgresql

go-starter

go-starter is an opinionated production-ready RESTful JSON backend template written in Go, highly integrated with VSCode DevContainers by allaboutapps.

go starter overview

Demo: https://go-starter.allaboutapps.at
FAQ: https://github.com/allaboutapps/go-starter/wiki/FAQ

Table of Contents

Features

  • Full local golang service development environment using Docker Compose and VSCode devcontainers that just works with Linux, MacOS and Windows.
  • Adheres to the project layout defined in golang-standard/project-layout.
  • Provides database migration (sql-migrate) and models generation (SQLBoiler) workflows for PostgreSQL databases.
  • Integrates IntegreSQL for fast, concurrent and isolated integration testing with real PostgreSQL databases.
  • Auto-installs our recommended VSCode extensions for golang development.
  • Integrates go-swagger for compile-time generation of swagger.yml, structs and request/response validation functions.
  • Integrates MailHog for easy SMTP-based email testing.
  • Integrates SwaggerUI for live-previewing your Swagger v2 schema.
  • Integrates pgFormatter and vscode-pgFormatter for SQL formatting.
  • Comes with fully implemented auth package, an OAuth2 RESTful JSON API ready to be extended according to your requirements.
  • Implements OAuth 2.0 Bearer Tokens and password authentication using argon2id hashes.
  • Comes with a tested mock and FCM provider for sending push notifications and storing push tokens.
  • CLI layer provided by spf13/cobra. It's exceptionally easy to add additional sub-commands.
  • Comes with an initial PostgreSQL database structure (see /migrations), covering:
    • auth tokens (access-, refresh-, password-reset-tokens),
    • a generic auth-related user model
    • an app-specific bare-bones app_user_profile model,
    • push notification tokens and
    • a health check sequence (for performing writeable checks).
  • API endpoints and CLI for liveness (/-/healthy) and readiness (/-/ready) probes
  • Parallel jobs optimized Makefile and various convenience scripts (see all targets and its description via make help). A full rebuild only takes seconds.
  • Multi-staged Dockerfile (development -> builder -> app).

Usage

Please find more detailed information regarding the history, usage and other whys? of this project in our FAQ.

Demo

A demo go-starter service is deployed at https://go-starter.allaboutapps.at for you to play around with.

Please visit our FAQ to find out more about the limitations of this demo environment.

Requirements

Requires the following local setup for development:

This project makes use of the Remote - Containers extension provided by Visual Studio Code. A local installation of the Go tool-chain is no longer required when using this setup.

Please refer to the official installation guide how this works for your host OS and head to our FAQ: How does our VSCode setup work? if you encounter issues.

Quickstart

Create a new git repository through the GitHub template repository feature (use this template). You will then start with a single initial commit in your own repository.

# Clone your new repository, cd into it, then easily start the docker-compose dev environment through our helper
./docker-helper.sh --up

You should be inside the 'service' docker container with a bash shell.

[email protected]:/app$ # inside your container...

# Shortcut for make init, make build, make info and make test
make all

# Print all available make targets
make help

Merge with the go-starter template repository to get future updates

These steps are not necessary if you have a "real" fork.

If your new project is generated from a template project (you have a single commit), you want to run the following command immediately and before applying any changes. Otherwise you won't be able to easily merge upstream go-starter changes into your own repository (see GitHub Template Repositories, Refusing to merge unrelated histories and FAQ: I want to compare or update my project/fork to the latest go-starter master).

make git-merge-go-starter
# Attempting to execute 'git merge --no-commit --no-ff go-starter/master' into your current HEAD.
# Are you sure? [y/N]y
# git merge --no-commit --no-ff --allow-unrelated-histories go-starter/master

git commit -m "Initial merge of unrelated go-starter template history"

Set project module name for your new project

To replace all occurrences of allaboutapps.dev/aw/go-stater (our internal module name of this project) with your desired projects' module name, do the following:

[email protected]:/app$ # inside your container...

# Set a new go project module name.
make set-module-name
# allaboutapps.dev/<GIT_PROJECT>/<GIT_REPO> (internal only)
# github.com/<USER>/<PROJECT>
# e.g. github.com/majodev/my-service

The above command writes your new go module name to tmp/.modulename, go.mod. It actually sets it everywhere in **/* - thus this step is typically only required once. If you need to merge changes from the upstream go-starter later, we may want to run make force-module-name to set your own go module name everywhere again (especially relevant for new files / import paths). See our FAQ for more information about this update flow.

Optionally you may want to move the original README.md and LICENSE away:

[email protected]:/app$ # inside your container...

# Optionally you may want to move our LICENSE and README.md away.
mv README.md README-go-starter.md
mv LICENSE LICENSE-go-starter

# Optionally create a new README.md for your project.
make get-module-name > README.md

Visual Studio Code

If you are new to VSCode Remote - Containers feature, see our FAQ: How does our VSCode setup work?.

Run CMD+SHIFT+P Go: Install/Update Tools after attaching to the container with VSCode to auto-install all golang related vscode extensions.

Building and testing

Other useful commands while developing your service:

[email protected]:/app$ # inside your container...

# Print all available make targets
make help

# Shortcut for make init, make build, make info and make test
make all

# Init install/cache dependencies and install tools to bin
make init

# Rebuild only after changes to files (generate, format, build, lint)
make

# Execute all tests
make test

Running

To run the service locally you may:

[email protected]:/app$ # inside your development container...

# First ensure you have a fresh `app` executable available
make build

# Check if all requirements for becoming are met (db is available, mnt path is writeable)
app probe readiness -v

# Migrate up the database
app db migrate

# Seed the database (if you have any fixtures defined in `/internal/data/fixtures.go`)
app db seed

# Start the locally-built server
app server

# Now available at http://127.0.0.1:8080

# You may also run all the above commands in a single command
app server --probe --migrate --seed # or `app server -pms`

Uninstall

Simply run ./docker-helper --destroy in your working directory (on your host machine) to wipe all docker related traces of this project (and its volumes!).

Additional resources

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Maintainers

License

MIT © 2021 aaa – all about apps GmbH | Michael Farkas | Nick Müller | Mario Ranftl | Manuel Wieser and the "go-starter" project contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].