Skip to content

4kpros/go-api

Repository files navigation

Simple and well-structured API for multiple projects

This repository contains a simple API written in Go, designed to be reusable and easily integrated into multiple projects. The API is built with a focus on performance, scalability, and maintainability.

Features

  • History

  • Roles

  • Permissions

  • Authentication

  • Users

TODO

  • Add 2FA and passKey, and add Google reCAPTCHA to all endpoints starting with /auth

  • Add testing

  • Add CI pipeline with GitHub actions(build image)

To get started with the API, follow these steps:

1. Requirements

  • Make installed for shortcuts

  • Docker installed if you want to build and start postgres or redis containers

  • Build and start Redis container with the command make docker-redis

  • Build and start postgres container with the command make docker-postgres

  • Rename .env.example to app.env

  • JWT .pem files with ES512(ECDSA SHA-512) algorithm: ./assets/private/keys/jwt/private.pem ./assets/private/keys/jwt/public.pem You ca use this website to generate JWT keys for your tests JWT online generator

  • Password is hashed using Argon2id algorithm. If you want to customize salinity, you can edit the .env.example file

Others information such configurations are on app.env

2. Clone the repository

git clone https://github.com/4kpros/go-api.git
cd go-api/

The entry point of the project is cmd/ folder. In this folder the is the main.go file.

3. Install dependencies

make install

4. Run the API

make build
make run

API docs with openAPI v3.1(latest) is on

/api/v1/docs

If you want to scan vulnerabilities(security issues)

make scan

You can choose between 4 templates: Scalar(Default), Redocly, Stoplight, Swagger.

Scalar(default) template screenshot Scalar

Redocly template screenshot Redocly

Stoplight template screenshot Stoplight

Swagger template screenshot Swagger

About

School management API backend

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages