Project Structure
Application Structure
Default Raiden project structure.
├── configs │ ├── app.yaml # App configuration file │ └── modules/ # Module configuration file │ ├── module_a.yaml │ ├── module_b.yaml │ └── ... ├── cmd │ ├── apply/main.go # Command to apply changes (e.g., to PostgreSQL) │ ├── import/main.go # Command to import (e.g., PostgreSQL functions) │ └── project-name/ │ └── project_name.go # Main application entry point ├── internal │ ├── bootstrap # Application initialization and setup │ │ ├── route.go │ │ ├── rpc.go │ │ ├── roles.go │ │ ├── models.go │ │ ├── storages.go │ │ ├── libs.go │ │ ├── jobs.go │ │ └── subscribers.go │ ├── controllers # API controllers (REST, RPC, Custom) │ │ └── hello.go # Example controller │ ├── jobs # Background job definitions │ │ └── example.go # Example job │ ├── libs # Shared libraries and utilities │ │ └── email.go # Example library │ ├── models # Database schema definitions │ │ └── users.go # Example model │ ├── repositories # Data access layer │ │ └── user.go # Example repository │ ├── roles # ACL/RLS definitions │ │ └── members.go # Example role │ ├── rpc # Generated RPC function definitions │ │ └── get_user.go # Example RPC function │ ├── storages # Storage related implementations │ │ └── avatar.go # Example storage │ ├── subscribers # Event subscribers │ │ └── status.go # Example subscriber │ ├── types # Custom types and enums │ │ └── user_role.go # Example type │ └── utils # General utility functions │ └── string.go # Example utility ├── migrations # Database migration files ├── vendor # Go module dependencies ├── .env # Environment variables ├── .gitignore ├── Dockerfile ├── go.mod ├── go.sum └── README.md
Module Structure
├── pkg │ ├── controllers │ │ ├── hello.go │ │ └── ... │ ├── rbac │ │ ├── creator.go │ │ ├── approver.go │ │ └── ... │ ├── models │ │ ├── users.go │ │ └── ... │ ├── rpc │ │ └── get_user.go │ ├── topics │ │ ├── notification.go │ │ └── inbox.go │ └── storages │ └── avatar.go ├── go.sum └── go.mod
Directories
configs
Default config directory. Including the default config app.yaml. For more information, read Config.
cmd
Contains the main entry points for different application commands or services, such as apply, import, and the main project executable.
internal
This directory contains the core application logic and components.
internal/bootstrap
Handles the initialization and bootstrapping of various application components, including routes, RPCs, roles, models, storages, libraries, jobs, and subscribers.
internal/controllers
Defines the API controllers, which handle incoming requests and define the application's endpoints. This includes REST, RPC, and custom controllers. For more details, read Controller.
internal/jobs
Contains definitions for background jobs that perform asynchronous tasks.
internal/libs
Houses shared libraries and utility functions used across the application.
internal/models
Defines the database schema and data structures. Model definitions can auto-synchronize with Supabase. For more details, read Model.
internal/repositories
Provides an abstraction layer for data access, handling interactions with the database or other data sources.
internal/roles
Contains Access Control List (ACL) and Row Level Security (RLS) definitions, which can auto-sync with Supabase. For more details, read ACL.
internal/rpc
Contains generated Go code for PostgreSQL functions, allowing them to be called as Remote Procedure Calls within the application.
internal/storages
Manages storage-related implementations, such as file storage for avatars or attachments.
internal/subscribers
Defines event subscribers that react to specific application events.
internal/types
Contains custom Go types and enumerations used throughout the application.
internal/utils
Provides general utility functions that support various parts of the application.
migrations
Contains database migration files used to manage schema changes over time.
vendor
Stores Go module dependencies.