Skip to main content

Introduction

This page will guide you on how to set up Fluxend locally. We assume you’re interested in modifying functionality or fixing bugs in either the Frontend or the Backend parts of the application. If you follow to end, you’ll fully understand how to make changes in either part.

Prerequisites

Before installing Fluxend, ensure you have the following tools installed and available via your command line interface:
  • Docker: Container platform for running applications
  • Docker Compose: Tool for defining multi-container applications
  • Make: Build automation tool for making your life easier
  • Git: Version control system
  • Golang:^1.23.x installed and accessible by running go version
  • Node:^20.16.x installed and accessible by running node --version
  • Yarn: Build tool responsible for frontend app
  • Goose: Database migration tool, must be accessible at goose version
You can verify these tools are installed by running docker --version, docker-compose --version, make --version, and git --version in your terminal.

Setup

Once you have all requirements satisfied, follow the Quickstart guide for initial setup. The basic installation process. The next steps will be different. If you’re only interested in backend, you can ignore frontend and vice versa.
Please ensure to set URL_SCEHEME to http to avoid SSL issues when running application locally

Backend

Our backend app runs a compiled binary inside fluxend_api container. If you’re interested in changing/developing a feature in this area, you should run this without a container to see realtime changes without having to re-compile each time.

You can following command inside fluxend directory to initiate a real-time Golang Echo server
You’ll now be able to see all logs and errors as they happen. If you’re also working on frontend, you’ll need to modify ENV for frontend app by modifiying web/.env file and point it to http://api.localhost:8080/

Frontend

Our frontend app runs on React and using container fluxend_frontend In order to see changes realtime, you should first install dependencies by running:
Once this command has finished, you can don’t need to worry about dependencies anymore. You can begin running following:

Architecture

This section dives deep into architecture. It will give you an overview of directory structure, design principals, and other related topics.

File structure

Clean Architecture Foundation

Our BaaS follows Uncle Bob’s Clean Architecture principles with four distinct layers:
  • Domain Layer (innermost) - Pure business logic, no external dependencies
  • Application Layer - Use cases and application services
  • Infrastructure Layer - External concerns (database, web, file system)
  • Interface Layer - Controllers, presenters, and gateways

Dependency Rule

Source code dependencies must point only toward higher-level policies:
  • Domain layer has no dependencies on other layers
  • Application layer depends only on domain
  • Infrastructure layer depends on application and domain
  • Interface layer depends on all inner layers

Debugging

You can use pkg.DumpJSON to print debug info when dealing with go related issues. We also use Zerolog so you can use it for printing information. Also, try looking into other files under pkg directory. When it comes to frontend, console.log is your friend. We’ll be updating this section with more helpful resources.

Go Conventions

When writing code, please ensure to follow best practices and write consistent code.

Naming Conventions

  • Variables & Functions: Use camelCase for all variables, functions, and methods
  • Constants: Use PascalCase for constants
  • Types & Structs: Use PascalCase for exported types, camelCase for unexported
  • Interfaces: Use PascalCase with descriptive names (e.g., UserRepository, EmailSender)
  • File Names: Use snake_case for all Go files
  • Test Files: Append _test.go to the corresponding file name

Database Management

  • Always Close Connections: Database connections must be closed properly
  • Use defer: Close connections immediately after opening
  • Context Handling: Use context for timeout management
  • Error Handling: Always check connection errors

Error Handling

  • Same-Line if Statements: Use inline error checking for cleaner code
  • Wrap Errors: Use fmt.Errorf with %w verb for error wrapping
  • Early Returns: Return errors early to reduce nesting