Categorygithub.com/segment3d-app/segment3d-be
modulepackage
0.0.0-20240811054026-f122863d37a3
Repository: https://github.com/segment3d-app/segment3d-be.git
Documentation: pkg.go.dev

# README

Segment3D Backend

This project is a part of the backend service for the Segment3D App. It is built using Go, a statically typed, compiled programming language designed for simplicity and performance. The API provides core functionality for both the Segment3D Mobile and Web applications. For database management, the project uses PostgreSQL, and it leverages Docker for containerization, ensuring consistency across different development and production environments. Additionally, the project utilizes Air for live reloading during development, streamlining the development process by automatically restarting the server on code changes.

Table of Contents

Getting Started

Prerequisites

Ensure you have the following tools installed on your machine:

Installation

  1. Clone the repository:

    git clone https://github.com/segment3d-app/backend.git
    cd backend
    
  2. Install dependencies:

    go get -u ./...
    
  3. Install golang-migrate: The golang-migrate package is a CLI tool that you can use to run migrations. You can easily install it on various operating systems such as Linux, Mac and Windows by using package managers like curl, brew, and scoop, respectively.

    • using curl
    curl -L https://packagecloud.io/golang-migrate/migrate/gpgkey| apt-key add -
    echo "deb https://packagecloud.io/golang-migrate/migrate/ubuntu/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/migrate.list
    apt-get update
    apt-get install -y migrate
    
    • using homebrew
    brew install golang-migrate
    
    • using scoop
    scoop install migrate
    

Configuration

  1. Create RabbitMQ Container simply by running the Makefile script:

    make run-rabbitmq
    make rabbitmq-up
    
  2. Create and run PostgreSQL Container simply by running the Makefile script:

    make run-postgres
    make postgres-up
    
  3. Create Database Schema:

    make create-db
    
  4. Run Migrations:

    make migrate-up
    
  5. Copy the .env.example file to .env:

    cp .env.example .env
    

Usage

Running the Server

make server-dev

Running with Docker Compose

You can also run the entire application using Docker Compose. This will set up the necessary containers for the backend and any other services you may have.

  1. Build and start the application using Docker Compose:

    docker-compose up --build
    

    This command will build the Docker image and start the containers, and you can access the API at http://localhost:8080.

  2. Stop the application:

    To stop the running containers, use:

    docker-compose down
    

Running All Services

If you want to run all services, you can visit Deployment Master Services

API Documentation

To access the API documentation, visit the Swagger documentation at http://localhost:8080/swagger/index.html after starting the server.

License

This project is licensed under the MIT License.

# Packages

No description provided by the author
No description provided by the author
Package docs Code generated by swaggo/swag.
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author