Skip to content
/ codexgo Public template

Example CRUD project applying Hexagonal Architecture, DDD, EDA, CQRS, BDD, CI, and more... in Go.

License

Notifications You must be signed in to change notification settings

bastean/codexgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo readme

Example CRUD project applying Hexagonal Architecture, Domain-Driven Design (DDD), Event-Driven Architecture (EDA), Command Query Responsibility Segregation (CQRS), Behavior-Driven Development (BDD), Continuous Integration (CI), and more... in Go.


license MIT go report card commitizen friendly release it

upgrade workflow ci workflow release workflow

go reference github release

Showcase

Usage (Demo)

Note

  • System Requirements
  • In the Demo version, the link to confirm the account is sent through the Terminal.
    • "Hi <username>, please confirm your account through this link: <link>"
  • You can define your own SMTP configuration in the .env.demo file by simply modifying the SERVER_SMTP_* variables, then you will receive the links by mail.
make demo

Features

Project Layout

Git

make commit

Linting/Formatting Tools

  • Go: staticcheck and gofmt.
  • templ: templ fmt.
  • Gherkin: Cucumber extension.
  • Others: Prettier cli/extension.

Testing Packages

Releases

  • Automatically managed by Release It!:
    • Before/After Hooks for:
      • Linting
      • Testing
    • Bump version based on Conventional Commits and SemVer:
      • CHANGELOG generator
      • Commits and Tags generator
      • GitHub Releases

GitHub

  • Actions for:
    • Setup Languages and Dependencies
  • Workflows running:
    • Automatically (Triggered by Push or Pull requests):
    • Manually (Using the Actions tab on GitHub):
      • Upgrade Dependencies
      • Automate Release
  • Issue Templates (Defaults).

Devcontainer

  • Multiple Features already pre-configured:
    • Go
    • Node
    • Docker in Docker
  • Extensions and their respective settings to work with:
    • Go
    • templ
    • Cucumber
      • Gherkin
    • Prettier
    • Better Comments
    • Todo Tree
    • cSpell

Docker

  • Dockerfile
    • Multi-stage builds:
      • Development
      • Testing
      • Build
      • Production
  • Compose
    • Switched by ENVs.

Message Broker

Security

  • Form validation at the client using Fomantic - Form Validation.
    • On the server, the validations are performed using the Value Objects defined in the Context.
  • Data authentication via JWT managed by Session Cookies.
  • Account confirmation via Mail or Terminal.
  • Password hashing using Bcrypt.
  • Requests Rate Limiting.
  • Server log files.

Scripts

  • syncenv
    • Synchronize all .env* files in the directory using an .env model.
  • copydeps
    • Copies the files required by the browser dependencies from the node_modules folder and places them inside the static folder on the server.
  • upgrade
    • Perform the following steps to upgrade the project:
      1. Upgrade Go and Node dependencies.
      2. Linting and Testing.
      3. Commit changes.
  • run
    • Display the logs and redirect them to a file whose name depends on the time at which the service was run.
    • Used in Production Image.

First Steps

Clone

HTTPS

git clone https://github.com/bastean/codexgo.git && cd codexgo

SSH

git clone git@github.com:bastean/codexgo.git && cd codexgo

Initialize

Dev Container (recommended)

  1. System Requirements

  2. Start VS Code

    code .
  3. Open Command Palette

    • Ctrl+Shift+P
  4. Run

    Dev Containers: Reopen in Container

Locally

  1. System Requirements

  2. Run

    make init

ZIP

  1. System Requirements

  2. Run

    make init-zero

GitHub Repository

Settings

Actions
  • General

    • Workflow permissions

      • Read and write permissions
Secrets and variables
  • Actions

    • New repository secret

      • BOT_GPG_PRIVATE_KEY

        gpg --armor --export-secret-key [Pub_Key_ID (*-BOT)]
      • BOT_GPG_PASSPHRASE

Run

ENVs

Important

Before running it, you must set the following environment variables and rename the file to .env.(dev|test|prod).

Tip

You can check the demo file to see which values you can use.

Development

make compose-dev

Tests

Unit
make test-unit
Integration
make compose-test-integration
Acceptance
make compose-test-acceptance
Unit/Integration/Acceptance
make compose-tests

Production

make compose-prod

Tech Stack

Base

Please see

Contributing

License

About

Example CRUD project applying Hexagonal Architecture, DDD, EDA, CQRS, BDD, CI, and more... in Go.

Topics

Resources

License

Stars

Watchers

Forks